/** * Gets the Local Scope relative to the current Scope. For LocalScopes this will be itself. * Blocks will contain the LocalScope it contains. * * @return localScope */ public StaticScope getLocalScope() { return (type != Type.BLOCK) ? this : enclosingScope.getLocalScope(); }
/** * Gets the Local Scope relative to the current Scope. For LocalScopes this will be itself. * Blocks will contain the LocalScope it contains. * * @return localScope */ public StaticScope getLocalScope() { return (type != Type.BLOCK) ? this : enclosingScope.getLocalScope(); }
public StaticScope getLocalScope() { return enclosingScope.getLocalScope(); }
public StaticScope getLocalScope() { return (isEval || !isBlock) ? this : enclosingScope.getLocalScope(); }
public StaticScope getLocalScope() { return (isEval || !isBlock) ? this : enclosingScope.getLocalScope(); }
public StaticScope getLocalScope() { return enclosingScope.getLocalScope(); }
/** * Find the scope to use for flip-flops. Flip-flops live either in the * topmost "method scope" or in their nearest containing "eval scope". * * @return The scope to use for flip-flops */ public DynamicScope getFlipScope() { if (staticScope.getLocalScope() == staticScope) { return this; } else { return parent.getFlipScope(); } }
/** * Find the scope to use for flip-flops. Flip-flops live either in the * topmost "method scope" or in their nearest containing "eval scope". * * @return The scope to use for flip-flops */ public DynamicScope getFlipScope() { if (staticScope.getLocalScope() == staticScope) { return this; } else { return parent.getFlipScope(); } }
/** * Find the scope to use for flip-flops. Flip-flops live either in the * topmost "method scope" or in their nearest containing "eval scope". * * @return The scope to use for flip-flops */ public DynamicScope getFlipScope() { if (staticScope.getLocalScope() == staticScope) { return this; } else { return parent.getFlipScope(); } }
/** * Find the scope to use for flip-flops. Flip-flops live either in the * topmost "method scope" or in their nearest containing "eval scope". * * @return The scope to use for flip-flops */ public DynamicScope getFlipScope() { if (staticScope.getLocalScope() == staticScope) { return this; } else { return parent.getFlipScope(); } }
@Override public Object execute(ParserSupport support, RubyYaccLexer lexer, Object yyVal, Object[] yyVals, int yyTop) { String identifier = (String) ((Token)yyVals[-2+yyTop]).getValue(); if (support.getCurrentScope().getLocalScope().isDefined(identifier) >= 0) { support.yyerror("duplicate optional argument name"); } support.getCurrentScope().getLocalScope().addVariable(identifier); yyVal = support.assignable(((Token)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop])); return yyVal; } };
@Override public Object execute(ParserSupport support, RubyYaccLexer lexer, Object yyVal, Object[] yyVals, int yyTop) { String identifier = (String) ((Token)yyVals[-2+yyTop]).getValue(); if (support.getCurrentScope().getLocalScope().isDefined(identifier) >= 0) { support.yyerror("duplicate optional argument name"); } support.getCurrentScope().getLocalScope().addVariable(identifier); yyVal = support.assignable(((Token)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop])); return yyVal; } };
@Override public Object execute(ParserSupport support, RubyYaccLexer lexer, Object yyVal, Object[] yyVals, int yyTop) { yyVal = new UnnamedRestArgNode(((Token)yyVals[0+yyTop]).getPosition(), "", support.getCurrentScope().getLocalScope().addVariable("*")); return yyVal; } };
public BlockArgNode newBlockArg(ISourcePosition position, Token nameToken) { String identifier = (String) nameToken.getValue(); if (getCurrentScope().getLocalScope().isDefined(identifier) >= 0) { throw new SyntaxException(PID.BAD_IDENTIFIER, position, lexer.getCurrentLine(), "duplicate block argument name"); } return new BlockArgNode(position, getCurrentScope().getLocalScope().addVariable(identifier), identifier); }
@Override public Object execute(ParserSupport support, RubyYaccLexer lexer, Object yyVal, Object[] yyVals, int yyTop) { String identifier = (String) ((Token)yyVals[0+yyTop]).getValue(); if (support.getCurrentScope().getLocalScope().isDefined(identifier) >= 0) { support.yyerror("duplicate argument name"); } int location = support.getCurrentScope().getLocalScope().addVariable(identifier); yyVal = new ArgumentNode(((Token)yyVals[0+yyTop]).getPosition(), identifier, location); return yyVal; } };
public BlockArgNode newBlockArg(ISourcePosition position, Token nameToken) { String identifier = (String) nameToken.getValue(); if (getCurrentScope().getLocalScope().isDefined(identifier) >= 0) { throw new SyntaxException(PID.BAD_IDENTIFIER, position, lexer.getCurrentLine(), "duplicate block argument name"); } return new BlockArgNode(position, getCurrentScope().getLocalScope().addVariable(identifier), identifier); }
@Override public Object execute(ParserSupport support, RubyYaccLexer lexer, Object yyVal, Object[] yyVals, int yyTop) { String identifier = (String) ((Token)yyVals[0+yyTop]).getValue(); if (support.getCurrentScope().getLocalScope().isDefined(identifier) >= 0) { support.yyerror("duplicate argument name"); } int location = support.getCurrentScope().getLocalScope().addVariable(identifier); yyVal = new ArgumentNode(((Token)yyVals[0+yyTop]).getPosition(), identifier, location); return yyVal; } };
@Override public Object execute(ParserSupport support, RubyYaccLexer lexer, Object yyVal, Object[] yyVals, int yyTop) { yyVal = new UnnamedRestArgNode(((Token)yyVals[0+yyTop]).getPosition(), "", support.getCurrentScope().getLocalScope().addVariable("*")); return yyVal; } };
@Override public Object execute(ParserSupport support, RubyYaccLexer lexer, Object yyVal, Object[] yyVals, int yyTop) { String identifier = (String) ((Token)yyVals[0+yyTop]).getValue(); if (support.getCurrentScope().getLocalScope().isDefined(identifier) >= 0) { support.yyerror("duplicate rest argument name"); } yyVal = new RestArgNode(((Token)yyVals[-1+yyTop]).getPosition(), (String) ((Token)yyVals[0+yyTop]).getValue(), support.getCurrentScope().getLocalScope().addVariable(identifier)); return yyVal; } };
@Override public Object execute(ParserSupport support, RubyYaccLexer lexer, Object yyVal, Object[] yyVals, int yyTop) { String identifier = (String) ((Token)yyVals[0+yyTop]).getValue(); if (support.getCurrentScope().getLocalScope().isDefined(identifier) >= 0) { support.yyerror("duplicate rest argument name"); } yyVal = new RestArgNode(((Token)yyVals[-1+yyTop]).getPosition(), (String) ((Token)yyVals[0+yyTop]).getValue(), support.getCurrentScope().getLocalScope().addVariable(identifier)); return yyVal; } };