@Deprecated public Node parse(String content, String file, DynamicScope scope, int lineNumber, boolean extraPositionInformation) { return parser.parse(file, content.getBytes(), scope, new ParserConfiguration(this, lineNumber, extraPositionInformation, false, true, config)); }
/** * Wraps node with NEWLINE node. * *@param node */ public Node newline_node(Node node, ISourcePosition position) { if (node == null) return null; configuration.coverLine(position.getLine()); node.setNewline(); return node; }
@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); }
/** * Create a source. * * @param name the name of the source (e.g a filename: foo.rb) * @param content the data of the source * @return the new source */ public static LexerSource getSource(String name, InputStream content, List<String> list, ParserConfiguration configuration) { return new InputStreamLexerSource(name, content, list, configuration.getLineNumber(), configuration.hasExtraPositionInformation()); }
@SuppressWarnings("unchecked") public Node parse(String file, ByteList content, DynamicScope blockScope, ParserConfiguration configuration) { configuration.setDefaultEncoding(content.getEncoding()); RubyArray list = getLines(configuration, runtime, file); LexerSource lexerSource = new ByteListLexerSource(file, configuration.getLineNumber(), content, list); return parse(file, lexerSource, blockScope, configuration); }
@Override public void regexpFragmentCheck(RegexpNode end, ByteList value) { setRegexpEncoding(end, value); RubyRegexp.preprocessCheck(configuration.getRuntime(), value); }
configuration.parseAsBlock(blockScope); RubyParser parser = RubyParserPool.getInstance().borrowParser(configuration.getVersion()); RubyParserResult result = null; parser.setWarnings(runtime.getWarnings()); try { result = parser.parse(configuration, lexerSource); if (result.getEndOffset() >= 0 && configuration.isSaveData()) { IRubyObject verbose = runtime.getVerbose(); runtime.setVerbose(runtime.getNil()); runtime.getCoverageData().prepareCoverage(file, configuration.getCoverage());
/** 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(); } }
if (!warnings.isVerbose() || (!configuration.isInlineSource() && configuration.isEvalParse())) return;
public void warnUnlessEOption(ID id, Node node, String message) { if (!configuration.isInlineSource()) { warnings.warn(id, node.getPosition(), message); } }
/** * Is the top of this scope a block scope (which happens in evals). * This is supposed to serve same purpose as MRIs: dyna_in_block but * I don't quite get why it is so complicated. All non-eval parsers * have local scopes except eval but they combine in_main || compile_for_eval? */ public boolean isBlockTopLevel() { return getConfiguration().isEvalParse(); }
configuration.parseAsBlock(blockScope); try { result = parser.parse(configuration); if (parser.lexer.isEndSeen() && configuration.isSaveData()) { IRubyObject verbose = runtime.getVerbose(); runtime.setVerbose(runtime.getNil());
/** 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.getKCode().getEncoding()); yyparse(lexer, configuration.isDebug() ? new YYDebug() : null); return support.getResult(); } }
/** * Description of the RubyMethod */ public void initTopLocalVariables() { DynamicScope scope = configuration.getScope(); currentScope = scope.getStaticScope(); result.setScope(scope); }
/** The parse method use an lexer stream and parse it to an AST node * structure */ public RubyParserResult parse(ParserConfiguration configuration) throws IOException { support.reset(); support.setConfiguration(configuration); support.setResult(new RubyParserResult()); yyparse(lexer, configuration.isDebug() ? new YYDebug() : null); return support.getResult(); } }
@Override public void regexpFragmentCheck(RegexpNode end, ByteList value) { setRegexpEncoding(end, value); RubyRegexp.preprocessCheck(configuration.getRuntime(), value); }
configuration.parseAsBlock(blockScope); RubyParser parser = RubyParserPool.getInstance().borrowParser(configuration.getVersion()); RubyParserResult result = null; parser.setWarnings(runtime.getWarnings()); try { result = parser.parse(configuration, lexerSource); if (result.getEndOffset() >= 0 && configuration.isSaveData()) { IRubyObject verbose = runtime.getVerbose(); runtime.setVerbose(runtime.getNil()); runtime.getCoverageData().prepareCoverage(file, configuration.getCoverage());
/** 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(); } }
if (!warnings.isVerbose() || (!configuration.isInlineSource() && configuration.isEvalParse())) return;
public void warnUnlessEOption(ID id, Node node, String message) { if (!configuration.isInlineSource()) { warnings.warn(id, node.getPosition(), message); } }