@SuppressWarnings("unchecked") public Node parse(String file, byte[] content, DynamicScope blockScope, ParserConfiguration configuration) { RubyArray list = getLines(configuration, runtime, file); ByteList in = new ByteList(content, configuration.getDefaultEncoding()); LexerSource lexerSource = new ByteListLexerSource(file, configuration.getLineNumber(), in, list); return parse(file, lexerSource, blockScope, configuration); }
@SuppressWarnings("unchecked") public Node parse(String file, byte[] content, DynamicScope blockScope, ParserConfiguration configuration) { RubyArray list = getLines(configuration, runtime, file); ByteList in = new ByteList(content, configuration.getDefaultEncoding()); LexerSource lexerSource = new ByteListLexerSource(file, configuration.getLineNumber(), in, list); return parse(file, lexerSource, blockScope, configuration); }
@SuppressWarnings("unchecked") public Node parse(String file, InputStream content, DynamicScope blockScope, ParserConfiguration configuration) { if (content instanceof LoadServiceResourceInputStream) { return parse(file, ((LoadServiceResourceInputStream) content).getBytes(), blockScope, configuration); } else { RubyArray list = getLines(configuration, runtime, file); RubyIO io; if (content instanceof FileInputStream) { io = new RubyFile(runtime, file, ((FileInputStream) content).getChannel()); } else { io = RubyIO.newIO(runtime, Channels.newChannel(content)); } LexerSource lexerSource = new GetsLexerSource(file, configuration.getLineNumber(), io, list, configuration.getDefaultEncoding()); try { return parse(file, lexerSource, blockScope, configuration); } finally { // In case of GetsLexerSource we actually will dispatch to gets which will increment $. // We do not want that in the case of raw parsing. runtime.setCurrentLine(0); } } }
@SuppressWarnings("unchecked") public Node parse(String file, InputStream content, DynamicScope blockScope, ParserConfiguration configuration) { if (content instanceof LoadServiceResourceInputStream) { return parse(file, ((LoadServiceResourceInputStream) content).getBytes(), blockScope, configuration); } else { RubyArray list = getLines(configuration, runtime, file); RubyIO io; if (content instanceof FileInputStream) { io = new RubyFile(runtime, file, ((FileInputStream) content).getChannel()); } else { io = RubyIO.newIO(runtime, Channels.newChannel(content)); } LexerSource lexerSource = new GetsLexerSource(file, configuration.getLineNumber(), io, list, configuration.getDefaultEncoding()); try { return parse(file, lexerSource, blockScope, configuration); } finally { // In case of GetsLexerSource we actually will dispatch to gets which will increment $. // We do not want that in the case of raw parsing. runtime.setCurrentLine(0); } } }
/** The parse method use an lexer stream and parse it to an AST node * structure */ public RubyParserResult parse(ParserConfiguration configuration, LexerSource source) throws IOException { support.reset(); support.setConfiguration(configuration); support.setResult(new RubyParserResult()); lexer.reset(); lexer.setSource(source); lexer.setEncoding(configuration.getDefaultEncoding()); yyparse(lexer, configuration.isDebug() ? new YYDebug() : null); return support.getResult(); } }
/** The parse method use an lexer stream and parse it to an AST node * structure */ public RubyParserResult parse(ParserConfiguration configuration, LexerSource source) throws IOException { support.reset(); support.setConfiguration(configuration); support.setResult(new RubyParserResult()); lexer.reset(); lexer.setSource(source); lexer.setEncoding(configuration.getDefaultEncoding()); yyparse(lexer, configuration.isDebug() ? new YYDebug() : null); return support.getResult(); } }
/** The parse method use an lexer stream and parse it to an AST node * structure */ public RubyParserResult parse(ParserConfiguration configuration, LexerSource source) throws IOException { support.reset(); support.setConfiguration(configuration); support.setResult(new RubyParserResult()); lexer.reset(); lexer.setSource(source); lexer.setEncoding(configuration.getDefaultEncoding()); yyparse(lexer, configuration.isDebug() ? new YYDebug() : null); return support.getResult(); } }
/** The parse method use an lexer stream and parse it to an AST node * structure */ public RubyParserResult parse(ParserConfiguration configuration, LexerSource source) throws IOException { support.reset(); support.setConfiguration(configuration); support.setResult(new RubyParserResult()); lexer.reset(); lexer.setSource(source); lexer.setEncoding(configuration.getDefaultEncoding()); yyparse(lexer, configuration.isDebug() ? new YYDebug() : null); return support.getResult(); } }