@SuppressWarnings("unchecked") public Node parse(String file, InputStream content, DynamicScope blockScope, ParserConfiguration configuration) { RubyArray list = getLines(configuration, runtime, file); if (content instanceof LoadServiceResourceInputStream) { return parse(file, ((LoadServiceResourceInputStream) content).getBytes(), blockScope, configuration); } else { LexerSource lexerSource = LexerSource.getSource(file, content, list, configuration); return parse(file, lexerSource, blockScope, configuration); } }
@SuppressWarnings("unchecked") public Node parse(String file, InputStream content, DynamicScope blockScope, ParserConfiguration configuration) { RubyArray list = getLines(configuration, runtime, file); if (content instanceof LoadServiceResourceInputStream) { return parse(file, ((LoadServiceResourceInputStream) content).getBytes(), blockScope, configuration); } else { LexerSource lexerSource = LexerSource.getSource(file, content, list, configuration); 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); } } }