protected void ambiguousOperator(String op, String syn) { warnings.warn(ID.AMBIGUOUS_ARGUMENT, getFile(), ruby_sourceline, "`" + op + "' after local variable or literal is interpreted as binary operator"); warnings.warn(ID.AMBIGUOUS_ARGUMENT, getFile(), ruby_sourceline, "even though it seems like " + syn); }
protected void ambiguousOperator(String op, String syn) { warnings.warn(ID.AMBIGUOUS_ARGUMENT, getFile(), ruby_sourceline, "`" + op + "' after local variable or literal is interpreted as binary operator"); warnings.warn(ID.AMBIGUOUS_ARGUMENT, getFile(), ruby_sourceline, "even though it seems like " + syn); }
public ISourcePosition getPosition(ISourcePosition startPosition) { if (startPosition != null) return startPosition; if (tokline != null && ruby_sourceline == tokline.getLine()) return tokline; return new SimpleSourcePosition(getFile(), ruby_sourceline); }
public ISourcePosition getPosition(ISourcePosition startPosition) { if (startPosition != null) return startPosition; if (tokline != null && ruby_sourceline == tokline.getLine()) return tokline; return new SimpleSourcePosition(getFile(), ruby_sourceline); }
public void pushBlockScope() { currentScope = configuration.getRuntime().getStaticScopeFactory().newBlockScope(currentScope, lexer.getFile()); }
/** * Description of the RubyMethod */ public void initTopLocalVariables() { DynamicScope scope = configuration.getScope(lexer.getFile()); currentScope = scope.getStaticScope(); result.setScope(scope); }
private boolean arg_ambiguous() { if (warnings.isVerbose() && Options.PARSER_WARN_AMBIGUOUS_ARGUMENTS.load()) { warnings.warning(ID.AMBIGUOUS_ARGUMENT, getFile(), ruby_sourceline, "Ambiguous first argument; make sure."); } return true; }
private boolean arg_ambiguous() { if (warnings.isVerbose() && Options.PARSER_WARN_AMBIGUOUS_ARGUMENTS.load()) { warnings.warning(ID.AMBIGUOUS_ARGUMENT, getFile(), ruby_sourceline, "Ambiguous first argument; make sure."); } return true; }
/** * Description of the RubyMethod */ public void initTopLocalVariables() { DynamicScope scope = configuration.getScope(lexer.getFile()); currentScope = scope.getStaticScope(); result.setScope(scope); }
public void compile_error(String message) { // mri: rb_compile_error_with_enc String line = lexer.getCurrentLine(); ISourcePosition position = lexer.getPosition(); String errorMessage = lexer.getFile() + ":" + (position.getLine() + 1) + ": "; if (line != null && line.length() > 5) { boolean addNewline = message != null && ! message.endsWith("\n"); message += (addNewline ? "\n" : "") + line; } throw getConfiguration().getRuntime().newSyntaxError(errorMessage + message); }
public void compile_error(String message) { // mri: rb_compile_error_with_enc String line = lexer.getCurrentLine(); ISourcePosition position = lexer.getPosition(); String errorMessage = lexer.getFile() + ":" + (position.getLine() + 1) + ": "; if (line != null && line.length() > 5) { boolean addNewline = message != null && ! message.endsWith("\n"); message += (addNewline ? "\n" : "") + line; } throw getConfiguration().getRuntime().newSyntaxError(errorMessage + message); }
/** * assign_in_cond **/ private boolean checkAssignmentInCondition(Node node) { if (node instanceof MultipleAsgnNode || node instanceof LocalAsgnNode || node instanceof DAsgnNode || node instanceof GlobalAsgnNode || node instanceof InstAsgnNode) { Node valueNode = ((AssignableNode) node).getValueNode(); if (isStaticContent(valueNode)) { warnings.warn(ID.ASSIGNMENT_IN_CONDITIONAL, lexer.getFile(), lexer.getLineOffset(), "found = in conditional, should be =="); } return true; } return false; }
@Override public Object execute(ParserSupport support, RubyLexer lexer, Object yyVal, Object[] yyVals, int yyTop) { yyVal = new FileNode(lexer.tokline, new ByteList(lexer.getFile().getBytes(), support.getConfiguration().getRuntime().getEncodingService().getLocaleEncoding())); return yyVal; } };
@Override public Object execute(ParserSupport support, RubyLexer lexer, Object yyVal, Object[] yyVals, int yyTop) { yyVal = new FileNode(lexer.tokline, new ByteList(lexer.getFile().getBytes(), support.getConfiguration().getRuntime().getEncodingService().getLocaleEncoding())); return yyVal; } };
public void compile_error(PID pid, String message) { String src = createAsEncodedString(lex_lastline.unsafeBytes(), lex_lastline.begin(), lex_lastline.length(), getEncoding()); throw new SyntaxException(pid, getFile(), ruby_sourceline, src, message); }
public void compile_error(PID pid, String message) { String src = createAsEncodedString(lex_lastline.unsafeBytes(), lex_lastline.begin(), lex_lastline.length(), getEncoding()); throw new SyntaxException(pid, getFile(), ruby_sourceline, src, message); }
public void pushLocalScope() { currentScope = configuration.getRuntime().getStaticScopeFactory().newLocalScope(currentScope, lexer.getFile()); currentScope.setCommandArgumentStack(lexer.getCmdArgumentState().getStack()); lexer.getCmdArgumentState().reset(0); }
public void pushLocalScope() { currentScope = configuration.getRuntime().getStaticScopeFactory().newLocalScope(currentScope, lexer.getFile()); currentScope.setCommandArgumentStack(lexer.getCmdArgumentState().getStack()); lexer.getCmdArgumentState().reset(0); }
public ByteList shadowing_lvar(ByteList nameBytes) { if (nameBytes.realSize() == 1 && nameBytes.charAt(0) == '_') return nameBytes; RubySymbol name = symbolID(nameBytes); String id = name.idString(); StaticScope current = getCurrentScope(); if (current.exists(id) >= 0) yyerror("duplicated argument name"); if (current.isBlockScope() && warnings.isVerbose() && current.isDefined(id) >= 0 && Options.PARSER_WARN_LOCAL_SHADOWING.load()) { Ruby runtime = getConfiguration().getRuntime(); warnings.warning(ID.STATEMENT_NOT_REACHED, lexer.getFile(), lexer.getPosition().getLine(), str(runtime, "shadowing outer local variable - ", ids(runtime, name))); } return nameBytes; }
public ByteList shadowing_lvar(ByteList nameBytes) { if (nameBytes.realSize() == 1 && nameBytes.charAt(0) == '_') return nameBytes; RubySymbol name = symbolID(nameBytes); String id = name.idString(); StaticScope current = getCurrentScope(); if (current.exists(id) >= 0) yyerror("duplicated argument name"); if (current.isBlockScope() && warnings.isVerbose() && current.isDefined(id) >= 0 && Options.PARSER_WARN_LOCAL_SHADOWING.load()) { Ruby runtime = getConfiguration().getRuntime(); warnings.warning(ID.STATEMENT_NOT_REACHED, lexer.getFile(), lexer.getPosition().getLine(), str(runtime, "shadowing outer local variable - ", ids(runtime, name))); } return nameBytes; }