Permalink
Browse files

Lexical Scoping: Phase 1

 - New StaticScoping with subclasses BlockStaticScope and LocalStaticScope.  These replace two things:
    1. BlockNames + LocalNames.  Intermediate objects now not needed
    2. ScopeNode.  A static Scope still lives in the same place as ScopeNode did but it just hold scoping info and is not longer visitable
 - StaticScoping structure is a spaghetti stack as such Nodes now can walk down the stack to see subsequent outer scopes.  This will
   enable part two of lexical scoping where we can start replacing cref and/or parent

git-svn-id: http://svn.codehaus.org/jruby/branches/enebo_lexical@2381 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information...
1 parent 15fad82 commit a5306b8d46a4cc8981330d4820f3dcc6208706ca @enebo enebo committed Oct 24, 2006
Showing with 806 additions and 1,042 deletions.
  1. +3 −4 src/org/jruby/RubyKernel.java
  2. +19 −5 src/org/jruby/ast/ClassNode.java
  3. +19 −5 src/org/jruby/ast/DefnNode.java
  4. +19 −5 src/org/jruby/ast/DefsNode.java
  5. +18 −5 src/org/jruby/ast/ModuleNode.java
  6. +18 −5 src/org/jruby/ast/SClassNode.java
  7. +0 −106 src/org/jruby/ast/ScopeNode.java
  8. +0 −7 src/org/jruby/ast/executable/InstructionCompiler2.java
  9. +0 −5 src/org/jruby/ast/visitor/AbstractVisitor.java
  10. +0 −9 src/org/jruby/ast/visitor/DefaultIteratorVisitor.java
  11. +0 −2 src/org/jruby/ast/visitor/NodeVisitor.java
  12. +0 −6 src/org/jruby/evaluator/CreateJumpTargetVisitor.java
  13. +21 −28 src/org/jruby/evaluator/EvaluationState.java
  14. +12 −11 src/org/jruby/internal/runtime/methods/DefaultMethod.java
  15. +6 −5 src/org/jruby/lexer/yacc/RubyYaccLexer.java
  16. +0 −85 src/org/jruby/parser/BlockNamesElement.java
  17. +0 −63 src/org/jruby/parser/BlockNamesStack.java
  18. +47 −0 src/org/jruby/parser/BlockStaticScope.java
  19. +372 −374 src/org/jruby/parser/DefaultRubyParser.java
  20. +35 −36 src/org/jruby/parser/DefaultRubyParser.y
  21. +0 −154 src/org/jruby/parser/LocalNamesElement.java
  22. +54 −0 src/org/jruby/parser/LocalStaticScope.java
  23. +6 −6 src/org/jruby/parser/Parser.java
  24. +39 −83 src/org/jruby/parser/ParserSupport.java
  25. +3 −6 src/org/jruby/parser/RubyParserConfiguration.java
  26. +8 −7 src/org/jruby/parser/RubyParserResult.java
  27. +102 −0 src/org/jruby/parser/StaticScope.java
  28. +5 −9 src/org/jruby/runtime/DynamicVariableSet.java
  29. +0 −11 test/testPositions.rb
View
7 src/org/jruby/RubyKernel.java
@@ -547,10 +547,9 @@ public static RubyArray local_variables(IRubyObject recv) {
}
}
- Iterator dynamicNames = tc.getCurrentDynamicVars().names().iterator();
- while (dynamicNames.hasNext()) {
- String name = (String) dynamicNames.next();
- localVariables.append(runtime.newString(name));
+ String[] names = tc.getCurrentDynamicVars().names();
+ for (int i = 0; i < names.length; i++) {
+ localVariables.append(runtime.newString(names[i]));
}
return localVariables;
View
24 src/org/jruby/ast/ClassNode.java
@@ -35,6 +35,7 @@
import org.jruby.ast.visitor.NodeVisitor;
import org.jruby.evaluator.Instruction;
import org.jruby.lexer.yacc.ISourcePosition;
+import org.jruby.parser.StaticScope;
/**
* A class statement.
@@ -49,12 +50,14 @@
static final long serialVersionUID = -1369424045737867587L;
private final Node cpath;
- private final ScopeNode bodyNode;
+ private final StaticScope scope;
+ private final Node bodyNode;
private final Node superNode;
- public ClassNode(ISourcePosition position, Node cpath, ScopeNode bodyNode, Node superNode) {
+ public ClassNode(ISourcePosition position, Node cpath, StaticScope scope, Node bodyNode, Node superNode) {
super(position, NodeTypes.CLASSNODE);
this.cpath = cpath;
+ this.scope = scope;
this.bodyNode = bodyNode;
this.superNode = superNode;
}
@@ -66,13 +69,24 @@ public ClassNode(ISourcePosition position, Node cpath, ScopeNode bodyNode, Node
public Instruction accept(NodeVisitor iVisitor) {
return iVisitor.visitClassNode(this);
}
+
/**
- * Gets the bodyNode.
- * @return Returns a ScopeNode
+ * Gets the body of this class.
+ *
+ * @return the contents
*/
- public ScopeNode getBodyNode() {
+ public Node getBodyNode() {
return bodyNode;
}
+
+ /**
+ * Get the static scoping information.
+ *
+ * @return the scoping info
+ */
+ public StaticScope getScope() {
+ return scope;
+ }
/**
* Gets the className.
View
24 src/org/jruby/ast/DefnNode.java
@@ -36,6 +36,7 @@
import org.jruby.ast.visitor.NodeVisitor;
import org.jruby.evaluator.Instruction;
import org.jruby.lexer.yacc.ISourcePosition;
+import org.jruby.parser.StaticScope;
import org.jruby.runtime.Visibility;
/**
@@ -48,14 +49,17 @@
private final ArgumentNode nameNode;
private final Node argsNode;
- private final ScopeNode bodyNode;
+ private final StaticScope scope;
+ private final Node bodyNode;
private final Visibility visibility;
- public DefnNode(ISourcePosition position, ArgumentNode nameNode, Node argsNode, ScopeNode bodyNode, Visibility visibility) {
+ public DefnNode(ISourcePosition position, ArgumentNode nameNode, Node argsNode,
+ StaticScope scope, Node bodyNode, Visibility visibility) {
super(position, NodeTypes.DEFNNODE);
this.nameNode = nameNode;
this.argsNode = argsNode;
+ this.scope = scope;
this.bodyNode = bodyNode;
this.visibility = visibility;
}
@@ -73,10 +77,20 @@ public Node getArgsNode() {
}
/**
- * Gets the bodyNode.
- * @return Returns a ScopeNode
+ * Get the static scoping information.
+ *
+ * @return the scoping info
*/
- public ScopeNode getBodyNode() {
+ public StaticScope getScope() {
+ return scope;
+ }
+
+ /**
+ * Gets the body of this class.
+ *
+ * @return the contents
+ */
+ public Node getBodyNode() {
return bodyNode;
}
View
24 src/org/jruby/ast/DefsNode.java
@@ -36,6 +36,7 @@
import org.jruby.ast.visitor.NodeVisitor;
import org.jruby.evaluator.Instruction;
import org.jruby.lexer.yacc.ISourcePosition;
+import org.jruby.parser.StaticScope;
/** Represents a singleton method definition.
*
@@ -47,13 +48,16 @@
private final Node receiverNode;
private String name;
private final Node argsNode;
- private final ScopeNode bodyNode;
+ private final StaticScope scope;
+ private final Node bodyNode;
- public DefsNode(ISourcePosition position, Node receiverNode, String name, Node argsNode, ScopeNode bodyNode) {
+ public DefsNode(ISourcePosition position, Node receiverNode, String name, Node argsNode,
+ StaticScope scope, Node bodyNode) {
super(position, NodeTypes.DEFSNODE);
this.receiverNode = receiverNode;
this.name = name.intern();
this.argsNode = argsNode;
+ this.scope = scope;
this.bodyNode = bodyNode;
}
@@ -81,10 +85,20 @@ public Node getArgsNode() {
}
/**
- * Gets the bodyNode.
- * @return Returns a ScopeNode
+ * Get the static scoping information.
+ *
+ * @return the scoping info
*/
- public ScopeNode getBodyNode() {
+ public StaticScope getScope() {
+ return scope;
+ }
+
+ /**
+ * Gets the body of this definition.
+ *
+ * @return the contents
+ */
+ public Node getBodyNode() {
return bodyNode;
}
View
23 src/org/jruby/ast/ModuleNode.java
@@ -35,6 +35,7 @@
import org.jruby.ast.visitor.NodeVisitor;
import org.jruby.evaluator.Instruction;
import org.jruby.lexer.yacc.ISourcePosition;
+import org.jruby.parser.StaticScope;
/** Represents a module definition.
*
@@ -44,11 +45,13 @@
static final long serialVersionUID = 4938115602547834310L;
private final Node cpath;
- private final ScopeNode bodyNode;
+ private final StaticScope scope;
+ private final Node bodyNode;
- public ModuleNode(ISourcePosition position, Node cpath, ScopeNode bodyNode) {
+ public ModuleNode(ISourcePosition position, Node cpath, StaticScope scope, Node bodyNode) {
super(position, NodeTypes.MODULENODE);
this.cpath = cpath;
+ this.scope = scope;
this.bodyNode = bodyNode;
}
@@ -61,12 +64,22 @@ public Instruction accept(NodeVisitor iVisitor) {
}
/**
- * Gets the bodyNode.
- * @return Returns a ScopeNode
+ * Gets the body of this class.
+ *
+ * @return the contents
*/
- public ScopeNode getBodyNode() {
+ public Node getBodyNode() {
return bodyNode;
}
+
+ /**
+ * Get the static scoping information.
+ *
+ * @return the scoping info
+ */
+ public StaticScope getScope() {
+ return scope;
+ }
/**
* Gets the name.
View
23 src/org/jruby/ast/SClassNode.java
@@ -35,6 +35,7 @@
import org.jruby.ast.visitor.NodeVisitor;
import org.jruby.evaluator.Instruction;
import org.jruby.lexer.yacc.ISourcePosition;
+import org.jruby.parser.StaticScope;
/** Singleton class definition.
*
@@ -50,11 +51,13 @@
static final long serialVersionUID = -3706492163082062224L;
private final Node receiverNode;
- private final ScopeNode bodyNode;
+ private final StaticScope scope;
+ private final Node bodyNode;
- public SClassNode(ISourcePosition position, Node recvNode, ScopeNode bodyNode) {
+ public SClassNode(ISourcePosition position, Node recvNode, StaticScope scope, Node bodyNode) {
super(position, NodeTypes.SCLASSNODE);
this.receiverNode = recvNode;
+ this.scope = scope;
this.bodyNode = bodyNode;
}
@@ -67,12 +70,22 @@ public Instruction accept(NodeVisitor iVisitor) {
}
/**
- * Gets the bodyNode.
- * @return Returns a ScopeNode
+ * Gets the body of this class.
+ *
+ * @return the contents
*/
- public ScopeNode getBodyNode() {
+ public Node getBodyNode() {
return bodyNode;
}
+
+ /**
+ * Gets the scope of this class
+ *
+ * @return the scope
+ */
+ public StaticScope getScope() {
+ return scope;
+ }
/**
* Gets the receiverNode.
View
106 src/org/jruby/ast/ScopeNode.java
@@ -1,106 +0,0 @@
-/***** BEGIN LICENSE BLOCK *****
- * Version: CPL 1.0/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Common Public
- * License Version 1.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * Copyright (C) 2001 Chad Fowler <chadfowler@chadfowler.com>
- * Copyright (C) 2001-2002 Jan Arne Petersen <jpetersen@uni-bonn.de>
- * Copyright (C) 2001-2002 Benoit Cerrina <b.cerrina@wanadoo.fr>
- * Copyright (C) 2002-2004 Anders Bengtsson <ndrsbngtssn@yahoo.se>
- * Copyright (C) 2004-2005 Thomas E Enebo <enebo@acm.org>
- * Copyright (C) 2004 Stefan Matthias Aust <sma@3plus4.de>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the CPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the CPL, the GPL or the LGPL.
- ***** END LICENSE BLOCK *****/
-package org.jruby.ast;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.jruby.ast.visitor.NodeVisitor;
-import org.jruby.evaluator.Instruction;
-import org.jruby.lexer.yacc.ISourcePosition;
-
-/**
- * Scope in the parse tree.
- * indicates where in the parse tree a new scope should be started when evaling.
- * Unlike many node this is not created directly as part of the parce process,
- * rather it is created as a side effect of other things like creating a ClassNode
- * or SClassNode. It can also be created by evaling a DefnNode or DefsNode as
- * part of the call to copyNodeScope.
- *
- * @author jpetersen
- */
-public class ScopeNode extends Node {
- static final long serialVersionUID = 3694868125861223886L;
-
- private String[] localNames;
- private final Node bodyNode;
-
- public ScopeNode(ISourcePosition position, String[] table, Node bodyNode) {
- super(position, NodeTypes.SCOPENODE);
- this.localNames = new String[table.length];
- for (int i = 0; i < table.length; i++)
- if (table[i] != null)
- localNames[i] = table[i].intern();
- this.bodyNode = bodyNode;
- }
-
- private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
- in.defaultReadObject();
-
- // deserialized strings are not interned; intern it now
- String[] old = localNames;
- this.localNames = new String[old.length];
- for (int i = 0; i < old.length; i++)
- if (old[i] != null)
- localNames[i] = old[i].intern();
- }
-
- /**
- * Accept for the visitor pattern.
- * @param iVisitor the visitor
- **/
- public Instruction accept(NodeVisitor iVisitor) {
- return iVisitor.visitScopeNode(this);
- }
-
- /**
- * Gets the bodyNode.
- * @return Returns a Node
- */
- public Node getBodyNode() {
- return bodyNode;
- }
-
- /**
- * Gets the localNames.
- * @return Returns a List
- */
- public String[] getLocalNames() {
- return localNames;
- }
-
- public List childNodes() {
- return createList(bodyNode);
- }
-
-}
View
7 src/org/jruby/ast/executable/InstructionCompiler2.java
@@ -105,7 +105,6 @@
import org.jruby.ast.ReturnNode;
import org.jruby.ast.SClassNode;
import org.jruby.ast.SValueNode;
-import org.jruby.ast.ScopeNode;
import org.jruby.ast.SelfNode;
import org.jruby.ast.SplatNode;
import org.jruby.ast.StrNode;
@@ -884,12 +883,6 @@ public Instruction visitSClassNode(SClassNode iVisited) {
throw new NotCompilableException("Node not supported: " + iVisited.toString());
}
- public Instruction visitScopeNode(ScopeNode iVisited) {
- iVisited.getBodyNode().accept(this);
-
- return null;
- }
-
public Instruction visitSelfNode(SelfNode iVisited) {
throw new NotCompilableException("Node not supported: " + iVisited.toString());
}
View
5 src/org/jruby/ast/visitor/AbstractVisitor.java
@@ -105,7 +105,6 @@
import org.jruby.ast.ReturnNode;
import org.jruby.ast.SClassNode;
import org.jruby.ast.SValueNode;
-import org.jruby.ast.ScopeNode;
import org.jruby.ast.SelfNode;
import org.jruby.ast.SplatNode;
import org.jruby.ast.StrNode;
@@ -424,10 +423,6 @@ public Instruction visitSClassNode(SClassNode iVisited) {
return visitNode(iVisited);
}
- public Instruction visitScopeNode(ScopeNode iVisited) {
- return visitNode(iVisited);
- }
-
public Instruction visitSelfNode(SelfNode iVisited) {
return visitNode(iVisited);
}
View
9 src/org/jruby/ast/visitor/DefaultIteratorVisitor.java
@@ -108,7 +108,6 @@
import org.jruby.ast.ReturnNode;
import org.jruby.ast.SClassNode;
import org.jruby.ast.SValueNode;
-import org.jruby.ast.ScopeNode;
import org.jruby.ast.SelfNode;
import org.jruby.ast.SplatNode;
import org.jruby.ast.StrNode;
@@ -574,14 +573,6 @@ public Instruction visitSClassNode(SClassNode iVisited) {
return null;
}
- public Instruction visitScopeNode(ScopeNode iVisited) {
- iVisited.accept(_Payload);
- if (iVisited.getBodyNode() != null) {
- iVisited.getBodyNode().accept(this);
- }
- return null;
- }
-
public Instruction visitSelfNode(SelfNode iVisited) {
iVisited.accept(_Payload);
return null;
View
2 src/org/jruby/ast/visitor/NodeVisitor.java
@@ -105,7 +105,6 @@
import org.jruby.ast.ReturnNode;
import org.jruby.ast.SClassNode;
import org.jruby.ast.SValueNode;
-import org.jruby.ast.ScopeNode;
import org.jruby.ast.SelfNode;
import org.jruby.ast.SplatNode;
import org.jruby.ast.StrNode;
@@ -207,7 +206,6 @@
public Instruction visitRetryNode(RetryNode iVisited);
public Instruction visitReturnNode(ReturnNode iVisited);
public Instruction visitSClassNode(SClassNode iVisited);
- public Instruction visitScopeNode(ScopeNode iVisited);
public Instruction visitSelfNode(SelfNode iVisited);
public Instruction visitSplatNode(SplatNode iVisited);
public Instruction visitStrNode(StrNode iVisited);
View
6 src/org/jruby/evaluator/CreateJumpTargetVisitor.java
@@ -79,7 +79,6 @@
import org.jruby.ast.ReturnNode;
import org.jruby.ast.SClassNode;
import org.jruby.ast.SValueNode;
-import org.jruby.ast.ScopeNode;
import org.jruby.ast.SplatNode;
import org.jruby.ast.ToAryNode;
import org.jruby.ast.UntilNode;
@@ -420,11 +419,6 @@ public Instruction visitSClassNode(SClassNode iVisited) {
return null;
}
- public Instruction visitScopeNode(ScopeNode iVisited) {
- visit(iVisited.getBodyNode());
- return null;
- }
-
public Instruction visitSplatNode(SplatNode iVisited) {
visit(iVisited.getValue());
return null;
View
49 src/org/jruby/evaluator/EvaluationState.java
@@ -96,7 +96,6 @@
import org.jruby.ast.ReturnNode;
import org.jruby.ast.SClassNode;
import org.jruby.ast.SValueNode;
-import org.jruby.ast.ScopeNode;
import org.jruby.ast.SplatNode;
import org.jruby.ast.StrNode;
import org.jruby.ast.SuperNode;
@@ -118,6 +117,7 @@
import org.jruby.internal.runtime.methods.DefaultMethod;
import org.jruby.internal.runtime.methods.WrapperCallable;
import org.jruby.lexer.yacc.ISourcePosition;
+import org.jruby.parser.StaticScope;
import org.jruby.runtime.Block;
import org.jruby.runtime.CallType;
import org.jruby.runtime.ICallable;
@@ -386,7 +386,7 @@ public static IRubyObject eval(ThreadContext context, Node node, IRubyObject sel
rubyClass.extendObject(context.getWrapper());
rubyClass.includeModule(context.getWrapper());
}
- return evalClassDefinitionBody(context, iVisited.getBodyNode(), rubyClass, self);
+ return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), rubyClass, self);
}
case NodeTypes.CLASSVARASGNNODE: {
ClassVarAsgnNode iVisited = (ClassVarAsgnNode) node;
@@ -520,10 +520,12 @@ public static IRubyObject eval(ThreadContext context, Node node, IRubyObject sel
visibility = Visibility.PRIVATE;
}
- DefaultMethod newMethod = new DefaultMethod(containingClass, iVisited.getBodyNode(),
- (ArgsNode) iVisited.getArgsNode(), visibility, context.peekCRef());
+ DefaultMethod newMethod = new DefaultMethod(containingClass, iVisited.getScope(),
+ iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), visibility, context.peekCRef());
- iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod));
+ if (iVisited.getBodyNode() != null) {
+ iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod));
+ }
containingClass.addMethod(name, newMethod);
@@ -569,11 +571,13 @@ public static IRubyObject eval(ThreadContext context, Node node, IRubyObject sel
}
}
- DefaultMethod newMethod = new DefaultMethod(rubyClass, iVisited.getBodyNode(),
- (ArgsNode) iVisited.getArgsNode(), Visibility.PUBLIC, context
- .peekCRef());
-
- iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod));
+ DefaultMethod newMethod = new DefaultMethod(rubyClass, iVisited.getScope(),
+ iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(),
+ Visibility.PUBLIC, context.peekCRef());
+
+ if (iVisited.getBodyNode() != null) {
+ iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod));
+ }
rubyClass.addMethod(iVisited.getName(), newMethod);
receiver.callMethod("singleton_method_added", runtime.newSymbol(iVisited.getName()));
@@ -912,7 +916,7 @@ public static IRubyObject eval(ThreadContext context, Node node, IRubyObject sel
} else {
module = enclosingModule.defineModuleUnder(name);
}
- return evalClassDefinitionBody(context, iVisited.getBodyNode(), module, self);
+ return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), module, self);
}
case NodeTypes.MULTIPLEASGNNODE: {
MultipleAsgnNode iVisited = (MultipleAsgnNode) node;
@@ -1207,18 +1211,7 @@ public static IRubyObject eval(ThreadContext context, Node node, IRubyObject sel
singletonClass.includeModule(context.getWrapper());
}
- return evalClassDefinitionBody(context, iVisited.getBodyNode(), singletonClass, self);
- }
- case NodeTypes.SCOPENODE: {
- ScopeNode iVisited = (ScopeNode) node;
-
-
- context.preScopedBody(iVisited.getLocalNames());
- try {
- return eval(context, iVisited.getBodyNode(), self);
- } finally {
- context.postScopedBody();
- }
+ return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), singletonClass, self);
}
case NodeTypes.SELFNODE:
return self;
@@ -1402,17 +1395,17 @@ private static IRubyObject aryToAry(IRubyObject value) {
/** Evaluates the body in a class or module definition statement.
*
*/
- private static IRubyObject evalClassDefinitionBody(ThreadContext context, ScopeNode iVisited, RubyModule type,
- IRubyObject self) {
+ private static IRubyObject evalClassDefinitionBody(ThreadContext context, StaticScope scope,
+ Node bodyNode, RubyModule type, IRubyObject self) {
IRuby runtime = context.getRuntime();
- context.preClassEval(iVisited.getLocalNames(), type);
+ context.preClassEval(scope.getVariables(), type);
try {
if (isTrace(runtime)) {
callTraceFunction(context, "class", type);
}
- return eval(context, iVisited.getBodyNode(), type);
+ return eval(context, bodyNode, type);
} finally {
context.postClassEval();
@@ -1421,7 +1414,7 @@ private static IRubyObject evalClassDefinitionBody(ThreadContext context, ScopeN
}
}
}
-
+
private static RubyClass getSuperClassFromNode(ThreadContext context, Node superNode, IRubyObject self) {
if (superNode == null) {
return null;
View
23 src/org/jruby/internal/runtime/methods/DefaultMethod.java
@@ -41,11 +41,11 @@
import org.jruby.ast.ArgsNode;
import org.jruby.ast.ListNode;
import org.jruby.ast.Node;
-import org.jruby.ast.ScopeNode;
import org.jruby.evaluator.AssignmentVisitor;
import org.jruby.evaluator.EvaluationState;
import org.jruby.exceptions.JumpException;
import org.jruby.lexer.yacc.ISourcePosition;
+import org.jruby.parser.StaticScope;
import org.jruby.runtime.Arity;
import org.jruby.runtime.ICallable;
import org.jruby.runtime.Scope;
@@ -58,18 +58,19 @@
*
*/
public final class DefaultMethod extends AbstractMethod {
- private ScopeNode body;
+ private StaticScope staticScope;
+ private Node body;
private ArgsNode argsNode;
private SinglyLinkedList cref;
- public DefaultMethod(RubyModule implementationClass, ScopeNode body, ArgsNode argsNode,
- Visibility visibility, SinglyLinkedList cref) {
+ public DefaultMethod(RubyModule implementationClass, StaticScope staticScope, Node body,
+ ArgsNode argsNode, Visibility visibility, SinglyLinkedList cref) {
super(implementationClass, visibility);
this.body = body;
+ this.staticScope = staticScope;
this.argsNode = argsNode;
this.cref = cref;
- assert body != null;
assert argsNode != null;
}
@@ -94,8 +95,8 @@ public IRubyObject internalCall(IRuby runtime, IRubyObject receiver, RubyModule
ThreadContext context = runtime.getCurrentContext();
Scope scope = context.getFrameScope();
- if (body.getLocalNames() != null) {
- scope.resetLocalVariables(body.getLocalNames());
+ if (staticScope.getVariables() != null) {
+ scope.resetLocalVariables(staticScope.getVariables());
}
if (argsNode.getBlockArgNode() != null && context.isBlockGiven()) {
@@ -109,7 +110,7 @@ public IRubyObject internalCall(IRuby runtime, IRubyObject receiver, RubyModule
traceCall(runtime, receiver, name);
- return receiver.eval(body.getBodyNode());
+ return receiver.eval(body);
} catch (JumpException je) {
if (je.getJumpType() == JumpException.JumpType.ReturnJump) {
if (je.getPrimaryData() == this) {
@@ -226,8 +227,8 @@ private void traceCall(IRuby runtime, IRubyObject receiver, String name) {
return;
}
- ISourcePosition position = body.getBodyNode() != null ?
- body.getBodyNode().getPosition() : body.getPosition();
+ ISourcePosition position = body != null ?
+ body.getPosition() : runtime.getCurrentContext().getPosition();
runtime.callTraceFunction("call", position, receiver, name, getImplementationClass()); // XXX
}
@@ -237,6 +238,6 @@ public Arity getArity() {
}
public ICallable dup() {
- return new DefaultMethod(getImplementationClass(), body, argsNode, getVisibility(), cref);
+ return new DefaultMethod(getImplementationClass(), staticScope, body, argsNode, getVisibility(), cref);
}
}
View
11 src/org/jruby/lexer/yacc/RubyYaccLexer.java
@@ -43,9 +43,9 @@
import org.jruby.ast.FloatNode;
import org.jruby.ast.NthRefNode;
import org.jruby.common.IRubyWarnings;
-import org.jruby.parser.BlockNamesElement;
-import org.jruby.parser.LocalNamesElement;
+import org.jruby.parser.BlockStaticScope;
import org.jruby.parser.ParserSupport;
+import org.jruby.parser.StaticScope;
import org.jruby.parser.Tokens;
import org.jruby.util.IdUtil;
import org.jruby.util.PrintfFormat;
@@ -1525,10 +1525,11 @@ else if (c == '=') {
// Lame: parsing logic made it into lexer in ruby...So we
// are emulating
+ StaticScope scope = parserSupport.getCurrentScope();
if (IdUtil.getVarType(tempVal) != IdUtil.LOCAL_VAR &&
- ((((LocalNamesElement) parserSupport.getLocalNames().peek()).isInBlock() &&
- ((BlockNamesElement) parserSupport.getBlockNames().peek()).isDefined(tempVal)) ||
- ((LocalNamesElement) parserSupport.getLocalNames().peek()).isLocalRegistered(tempVal))) {
+ scope instanceof BlockStaticScope &&
+ ((scope.isDefined(tempVal) >= 0) ||
+ (scope.getLocalScope().isDefined(tempVal) >= 0))) {
lex_state = LexState.EXPR_END;
}
View
85 src/org/jruby/parser/BlockNamesElement.java
@@ -1,85 +0,0 @@
-/***** BEGIN LICENSE BLOCK *****
- * Version: CPL 1.0/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Common Public
- * License Version 1.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * Copyright (C) 2002 Jan Arne Petersen <jpetersen@uni-bonn.de>
- * Copyright (C) 2004 Anders Bengtsson <ndrsbngtssn@yahoo.se>
- * Copyright (C) 2004 Stefan Matthias Aust <sma@3plus4.de>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the CPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the CPL, the GPL or the LGPL.
- ***** END LICENSE BLOCK *****/
-package org.jruby.parser;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.jruby.util.collections.StackElement;
-
-/**
- *
- * @author jpetersen
- */
-public class BlockNamesElement implements StackElement {
- private BlockNamesElement next;
-
- private List blockNames;
-
- public BlockNamesElement() {}
-
- public BlockNamesElement(List names) {
- setNames(names);
- }
-
- /**
- * @see StackElement#getNext()
- */
- public StackElement getNext() {
- return next;
- }
-
- /**
- * @see StackElement#setNext(StackElement)
- */
- public void setNext(StackElement newNext) {
- next = (BlockNamesElement)newNext;
- }
-
- public boolean isDefined(String name) {
- return (blockNames != null ? blockNames.contains(name) : false) || (next != null && next.isDefined(name));
- }
-
- public void add(String name) {
- if (blockNames == null) {
- blockNames = new ArrayList();
- }
- blockNames.add(name);
- }
-
- public List getNames() {
- return blockNames != null ? Collections.unmodifiableList(blockNames) : Collections.EMPTY_LIST;
- }
-
- public void setNames(List names) {
- blockNames = names;
- }
-}
View
63 src/org/jruby/parser/BlockNamesStack.java
@@ -1,63 +0,0 @@
-/***** BEGIN LICENSE BLOCK *****
- * Version: CPL 1.0/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Common Public
- * License Version 1.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * Copyright (C) 2002 Jan Arne Petersen <jpetersen@uni-bonn.de>
- * Copyright (C) 2002-2004 Anders Bengtsson <ndrsbngtssn@yahoo.se>
- * Copyright (C) 2004 Stefan Matthias Aust <sma@3plus4.de>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the CPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the CPL, the GPL or the LGPL.
- ***** END LICENSE BLOCK *****/
-package org.jruby.parser;
-
-import java.util.Stack;
-
-import org.jruby.util.collections.AbstractStack;
-import org.jruby.util.collections.StackElement;
-
-/**
- *
- * @author jpetersen
- */
-public class BlockNamesStack extends AbstractStack {
- private Stack localNames;
-
- public BlockNamesStack(Stack localNames) {
- this.localNames = localNames;
- }
-
- /**
- * @see AbstractStack#pop()
- */
- public StackElement pop() {
- ((LocalNamesElement) localNames.peek()).changeBlockLevel(-1);
- return super.pop();
- }
-
- /**
- * @see AbstractStack#push(StackElement)
- */
- public Object push(StackElement newElement) {
- ((LocalNamesElement) localNames.peek()).changeBlockLevel(1);
- return super.push(newElement);
- }
-}
View
47 src/org/jruby/parser/BlockStaticScope.java
@@ -0,0 +1,47 @@
+package org.jruby.parser;
+
+import org.jruby.ast.AssignableNode;
+import org.jruby.ast.DAsgnNode;
+import org.jruby.ast.DVarNode;
+import org.jruby.ast.Node;
+import org.jruby.lexer.yacc.ISourcePosition;
+
+public class BlockStaticScope extends StaticScope {
+ private static final long serialVersionUID = -3882063260379968149L;
+
+ public BlockStaticScope(StaticScope parentScope) {
+ super(parentScope);
+ }
+
+ public StaticScope getLocalScope() {
+ return getEnclosingScope().getLocalScope();
+ }
+
+ public int isDefined(String name) {
+ int slot = exists(name);
+ if (slot >= 0) return slot;
+
+ return getEnclosingScope().isDefined(name);
+ }
+
+ protected AssignableNode assign(ISourcePosition position, String name, Node value, StaticScope topScope) {
+ int slot = exists(name);
+
+ if (slot >= 0) {
+ return new DAsgnNode(position, name, value);
+ }
+
+ return getEnclosingScope().assign(position, name, value, topScope);
+ }
+
+ public AssignableNode addAssign(ISourcePosition position, String name, Node value) {
+ // TODO: This can be curried (see assignable in older code for clues)
+ addVariable(name);
+ return new DAsgnNode(position, name, value);
+ }
+
+ public Node declare(ISourcePosition position, String name) {
+ return exists(name) >= 0 ? new DVarNode(position, name) :
+ getEnclosingScope().declare(position, name);
+ }
+}
View
746 src/org/jruby/parser/DefaultRubyParser.java
@@ -97,7 +97,6 @@
import org.jruby.ast.ReturnNode;
import org.jruby.ast.SClassNode;
import org.jruby.ast.SValueNode;
-import org.jruby.ast.ScopeNode;
import org.jruby.ast.SelfNode;
import org.jruby.ast.SplatNode;
import org.jruby.ast.StarNode;
@@ -146,7 +145,7 @@ public void setWarnings(IRubyWarnings warnings) {
support.setWarnings(warnings);
lexer.setWarnings(warnings);
}
- // line 150 "-"
+ // line 149 "-"
// %token constants
public static final int kCLASS = 257;
public static final int kMODULE = 258;
@@ -923,14 +922,14 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
switch (yyN) {
case 1:
- // line 257 "DefaultRubyParser.y"
+ // line 256 "DefaultRubyParser.y"
{
lexer.setState(LexState.EXPR_BEG);
support.initTopLocalVariables();
}
break;
case 2:
- // line 260 "DefaultRubyParser.y"
+ // line 259 "DefaultRubyParser.y"
{
if (((Node)yyVals[0+yyTop]) != null) {
/* last expression should not be void */
@@ -945,7 +944,7 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 3:
- // line 273 "DefaultRubyParser.y"
+ // line 272 "DefaultRubyParser.y"
{
Node node = ((Node)yyVals[-3+yyTop]);
@@ -963,7 +962,7 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 4:
- // line 289 "DefaultRubyParser.y"
+ // line 288 "DefaultRubyParser.y"
{
if (((Node)yyVals[-1+yyTop]) instanceof BlockNode) {
support.checkUselessStatements(((BlockNode)yyVals[-1+yyTop]));
@@ -972,74 +971,74 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 6:
- // line 297 "DefaultRubyParser.y"
+ // line 296 "DefaultRubyParser.y"
{
yyVal = support.newline_node(((Node)yyVals[0+yyTop]), getPosition(((Node)yyVals[0+yyTop]), true));
}
break;
case 7:
- // line 300 "DefaultRubyParser.y"
+ // line 299 "DefaultRubyParser.y"
{
yyVal = support.appendToBlock(((Node)yyVals[-2+yyTop]), support.newline_node(((Node)yyVals[0+yyTop]), getPosition(((Node)yyVals[-2+yyTop]), true)));
}
break;
case 8:
- // line 303 "DefaultRubyParser.y"
+ // line 302 "DefaultRubyParser.y"
{
yyVal = ((Node)yyVals[0+yyTop]);
}
break;
case 9:
- // line 307 "DefaultRubyParser.y"
+ // line 306 "DefaultRubyParser.y"
{
lexer.setState(LexState.EXPR_FNAME);
}
break;
case 10:
- // line 309 "DefaultRubyParser.y"
+ // line 308 "DefaultRubyParser.y"
{
yyVal = new AliasNode(getPosition(((Token)yyVals[-3+yyTop])), (String) ((Token)yyVals[-2+yyTop]).getValue(), (String) ((Token)yyVals[0+yyTop]).getValue());
}
break;
case 11:
- // line 312 "DefaultRubyParser.y"
+ // line 311 "DefaultRubyParser.y"
{
yyVal = new VAliasNode(getPosition(((Token)yyVals[-2+yyTop])), (String) ((Token)yyVals[-1+yyTop]).getValue(), (String) ((Token)yyVals[0+yyTop]).getValue());
}
break;
case 12:
- // line 315 "DefaultRubyParser.y"
+ // line 314 "DefaultRubyParser.y"
{
yyVal = new VAliasNode(getPosition(((Token)yyVals[-2+yyTop])), (String) ((Token)yyVals[-1+yyTop]).getValue(), "$" + ((BackRefNode)yyVals[0+yyTop]).getType()); /* XXX
*/
}
break;
case 13:
- // line 318 "DefaultRubyParser.y"
+ // line 317 "DefaultRubyParser.y"
{
yyerror("can't make alias for the number variables");
}
break;
case 14:
- // line 321 "DefaultRubyParser.y"
+ // line 320 "DefaultRubyParser.y"
{
yyVal = ((Node)yyVals[0+yyTop]);
}
break;
case 15:
- // line 324 "DefaultRubyParser.y"
+ // line 323 "DefaultRubyParser.y"
{
yyVal = new IfNode(support.union(((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop])), support.getConditionNode(((Node)yyVals[0+yyTop])), ((Node)yyVals[-2+yyTop]), null);
}
break;
case 16:
- // line 327 "DefaultRubyParser.y"
+ // line 326 "DefaultRubyParser.y"
{
yyVal = new IfNode(support.union(((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop])), support.getConditionNode(((Node)yyVals[0+yyTop])), null, ((Node)yyVals[-2+yyTop]));
}
break;
case 17:
- // line 330 "DefaultRubyParser.y"
+ // line 329 "DefaultRubyParser.y"
{
if (((Node)yyVals[-2+yyTop]) != null && ((Node)yyVals[-2+yyTop]) instanceof BeginNode) {
yyVal = new WhileNode(getPosition(((Node)yyVals[-2+yyTop])), support.getConditionNode(((Node)yyVals[0+yyTop])), ((BeginNode)yyVals[-2+yyTop]).getBodyNode(), false);
@@ -1049,7 +1048,7 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 18:
- // line 337 "DefaultRubyParser.y"
+ // line 336 "DefaultRubyParser.y"
{
if (((Node)yyVals[-2+yyTop]) != null && ((Node)yyVals[-2+yyTop]) instanceof BeginNode) {
yyVal = new UntilNode(getPosition(((Node)yyVals[-2+yyTop])), support.getConditionNode(((Node)yyVals[0+yyTop])), ((BeginNode)yyVals[-2+yyTop]).getBodyNode());
@@ -1059,31 +1058,31 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 19:
- // line 344 "DefaultRubyParser.y"
+ // line 343 "DefaultRubyParser.y"
{
yyVal = new RescueNode(getPosition(((Node)yyVals[-2+yyTop])), ((Node)yyVals[-2+yyTop]), new RescueBodyNode(getPosition(((Node)yyVals[-2+yyTop])), null,((Node)yyVals[0+yyTop]), null), null);
}
break;
case 20:
- // line 347 "DefaultRubyParser.y"
+ // line 346 "DefaultRubyParser.y"
{
if (support.isInDef() || support.isInSingle()) {
yyerror("BEGIN in method");
}
- support.getLocalNames().push(new LocalNamesElement());
+ support.pushLocalScope();
}
break;
case 21:
- // line 352 "DefaultRubyParser.y"
+ // line 351 "DefaultRubyParser.y"
{
- support.getResult().addBeginNode(new ScopeNode(getPosition(((Token)yyVals[-4+yyTop]), true), ((LocalNamesElement) support.getLocalNames().peek()).getNamesArray(), ((Node)yyVals[-1+yyTop])));
- support.getLocalNames().pop();
+ support.getResult().addBeginNode(support.getCurrentScope(), ((Node)yyVals[-1+yyTop]));
+ support.popCurrentScope();
yyVal = null; /*XXX 0;
*/
}
break;
case 22:
- // line 357 "DefaultRubyParser.y"
+ // line 356 "DefaultRubyParser.y"
{
if (support.isInDef() || support.isInSingle()) {
yyerror("END in method; use at_exit");
@@ -1093,14 +1092,14 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 23:
- // line 364 "DefaultRubyParser.y"
+ // line 363 "DefaultRubyParser.y"
{
support.checkExpression(((Node)yyVals[0+yyTop]));
yyVal = support.node_assign(((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 24:
- // line 368 "DefaultRubyParser.y"
+ // line 367 "DefaultRubyParser.y"
{
support.checkExpression(((Node)yyVals[0+yyTop]));
if (((MultipleAsgnNode)yyVals[-2+yyTop]).getHeadNode() != null) {
@@ -1112,7 +1111,7 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 25:
- // line 377 "DefaultRubyParser.y"
+ // line 376 "DefaultRubyParser.y"
{
support.checkExpression(((Node)yyVals[0+yyTop]));
@@ -1131,44 +1130,44 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 26:
- // line 393 "DefaultRubyParser.y"
+ // line 392 "DefaultRubyParser.y"
{
yyVal = new OpElementAsgnNode(getPosition(((Node)yyVals[-5+yyTop])), ((Node)yyVals[-5+yyTop]), (String) ((Token)yyVals[-1+yyTop]).getValue(), ((Node)yyVals[-3+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 27:
- // line 397 "DefaultRubyParser.y"
+ // line 396 "DefaultRubyParser.y"
{
yyVal = new OpAsgnNode(getPosition(((Node)yyVals[-4+yyTop])), ((Node)yyVals[-4+yyTop]), ((Node)yyVals[0+yyTop]), (String) ((Token)yyVals[-2+yyTop]).getValue(), (String) ((Token)yyVals[-1+yyTop]).getValue());
}
break;
case 28:
- // line 400 "DefaultRubyParser.y"
+ // line 399 "DefaultRubyParser.y"
{
yyVal = new OpAsgnNode(getPosition(((Node)yyVals[-4+yyTop])), ((Node)yyVals[-4+yyTop]), ((Node)yyVals[0+yyTop]), (String) ((Token)yyVals[-2+yyTop]).getValue(), (String) ((Token)yyVals[-1+yyTop]).getValue());
}
break;
case 29:
- // line 403 "DefaultRubyParser.y"
+ // line 402 "DefaultRubyParser.y"
{
yyVal = new OpAsgnNode(getPosition(((Node)yyVals[-4+yyTop])), ((Node)yyVals[-4+yyTop]), ((Node)yyVals[0+yyTop]), (String) ((Token)yyVals[-2+yyTop]).getValue(), (String) ((Token)yyVals[-1+yyTop]).getValue());
}
break;
case 30:
- // line 406 "DefaultRubyParser.y"
+ // line 405 "DefaultRubyParser.y"
{
support.backrefAssignError(((Node)yyVals[-2+yyTop]));
}
break;
case 31:
- // line 409 "DefaultRubyParser.y"
+ // line 408 "DefaultRubyParser.y"
{
yyVal = support.node_assign(((Node)yyVals[-2+yyTop]), new SValueNode(getPosition(((Node)yyVals[-2+yyTop])), ((Node)yyVals[0+yyTop])));
}
break;
case 32:
- // line 412 "DefaultRubyParser.y"
+ // line 411 "DefaultRubyParser.y"
{
if (((MultipleAsgnNode)yyVals[-2+yyTop]).getHeadNode() != null) {
((MultipleAsgnNode)yyVals[-2+yyTop]).setValueNode(new ToAryNode(getPosition(((MultipleAsgnNode)yyVals[-2+yyTop])), ((Node)yyVals[0+yyTop])));
@@ -1179,93 +1178,93 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 33:
- // line 420 "DefaultRubyParser.y"
+ // line 419 "DefaultRubyParser.y"
{
((AssignableNode)yyVals[-2+yyTop]).setValueNode(((Node)yyVals[0+yyTop]));
yyVal = ((MultipleAsgnNode)yyVals[-2+yyTop]);
}
break;
case 36:
- // line 427 "DefaultRubyParser.y"
+ // line 426 "DefaultRubyParser.y"
{
yyVal = support.newAndNode(((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 37:
- // line 430 "DefaultRubyParser.y"
+ // line 429 "DefaultRubyParser.y"
{
yyVal = support.newOrNode(((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 38:
- // line 433 "DefaultRubyParser.y"
+ // line 432 "DefaultRubyParser.y"
{
yyVal = new NotNode(support.union(((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop])), support.getConditionNode(((Node)yyVals[0+yyTop])));
}
break;
case 39:
- // line 436 "DefaultRubyParser.y"
+ // line 435 "DefaultRubyParser.y"
{
yyVal = new NotNode(support.union(((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop])), support.getConditionNode(((Node)yyVals[0+yyTop])));
}
break;
case 41:
- // line 441 "DefaultRubyParser.y"
+ // line 440 "DefaultRubyParser.y"
{
support.checkExpression(((Node)yyVals[0+yyTop]));
}
break;
case 44:
- // line 447 "DefaultRubyParser.y"
+ // line 446 "DefaultRubyParser.y"
{
yyVal = new ReturnNode(support.union(((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop])), support.ret_args(((Node)yyVals[0+yyTop]), getPosition(((Token)yyVals[-1+yyTop]))));
}
break;
case 45:
- // line 450 "DefaultRubyParser.y"
+ // line 449 "DefaultRubyParser.y"
{
yyVal = new BreakNode(support.union(((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop])), support.ret_args(((Node)yyVals[0+yyTop]), getPosition(((Token)yyVals[-1+yyTop]))));
}
break;
case 46:
- // line 453 "DefaultRubyParser.y"
+ // line 452 "DefaultRubyParser.y"
{
yyVal = new NextNode(support.union(((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop])), support.ret_args(((Node)yyVals[0+yyTop]), getPosition(((Token)yyVals[-1+yyTop]))));
}
break;
case 48:
- // line 458 "DefaultRubyParser.y"
+ // line 457 "DefaultRubyParser.y"
{
yyVal = support.new_call(((Node)yyVals[-3+yyTop]), ((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 49:
- // line 461 "DefaultRubyParser.y"
+ // line 460 "DefaultRubyParser.y"
{
yyVal = support.new_call(((Node)yyVals[-3+yyTop]), ((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 50:
- // line 465 "DefaultRubyParser.y"
+ // line 464 "DefaultRubyParser.y"
{
- support.getBlockNames().push(new BlockNamesElement());
+ support.pushBlockScope();
}
break;
case 51:
- // line 467 "DefaultRubyParser.y"
+ // line 466 "DefaultRubyParser.y"
{
yyVal = new IterNode(getPosition(((Token)yyVals[-4+yyTop])), ((Node)yyVals[-2+yyTop]), ((Node)yyVals[-1+yyTop]), null);
- support.getBlockNames().pop();
+ support.popCurrentScope();
}
break;
case 52:
- // line 472 "DefaultRubyParser.y"
+ // line 471 "DefaultRubyParser.y"
{
yyVal = support.new_fcall(((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 53:
- // line 475 "DefaultRubyParser.y"
+ // line 474 "DefaultRubyParser.y"
{
yyVal = support.new_fcall(((Token)yyVals[-2+yyTop]), ((Node)yyVals[-1+yyTop]));
if (((IterNode)yyVals[0+yyTop]) != null) {
@@ -1278,14 +1277,14 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 54:
- // line 485 "DefaultRubyParser.y"
+ // line 484 "DefaultRubyParser.y"
{
yyVal = support.new_call(((Node)yyVals[-3+yyTop]), ((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop])); /*.setPosFrom($1);
*/
}
break;
case 55:
- // line 488 "DefaultRubyParser.y"
+ // line 487 "DefaultRubyParser.y"
{
yyVal = support.new_call(((Node)yyVals[-4+yyTop]), ((Token)yyVals[-2+yyTop]), ((Node)yyVals[-1+yyTop]));
if (((IterNode)yyVals[0+yyTop]) != null) {
@@ -1298,13 +1297,13 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 56:
- // line 498 "DefaultRubyParser.y"
+ // line 497 "DefaultRubyParser.y"
{
yyVal = support.new_call(((Node)yyVals[-3+yyTop]), ((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 57:
- // line 501 "DefaultRubyParser.y"
+ // line 500 "DefaultRubyParser.y"
{
yyVal = support.new_call(((Node)yyVals[-4+yyTop]), ((Token)yyVals[-2+yyTop]), ((Node)yyVals[-1+yyTop]));
if (((IterNode)yyVals[0+yyTop]) != null) {
@@ -1317,116 +1316,116 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 58:
- // line 511 "DefaultRubyParser.y"
+ // line 510 "DefaultRubyParser.y"
{
yyVal = support.new_super(((Node)yyVals[0+yyTop]), ((Token)yyVals[-1+yyTop])); /* .setPosFrom($2);
*/
}
break;
case 59:
- // line 514 "DefaultRubyParser.y"
+ // line 513 "DefaultRubyParser.y"
{
yyVal = support.new_yield(getPosition(((Token)yyVals[-1+yyTop])), ((Node)yyVals[0+yyTop]));
}
break;
case 61:
- // line 519 "DefaultRubyParser.y"
+ // line 518 "DefaultRubyParser.y"
{
yyVal = ((MultipleAsgnNode)yyVals[-1+yyTop]);
}
break;
case 63:
- // line 524 "DefaultRubyParser.y"
+ // line 523 "DefaultRubyParser.y"
{
yyVal = new MultipleAsgnNode(getPosition(((Token)yyVals[-2+yyTop])), new ArrayNode(getPosition(((Token)yyVals[-2+yyTop])), ((MultipleAsgnNode)yyVals[-1+yyTop])), null);
}
break;
case 64:
- // line 528 "DefaultRubyParser.y"
+ // line 527 "DefaultRubyParser.y"
{
yyVal = new MultipleAsgnNode(getPosition(((ListNode)yyVals[0+yyTop])), ((ListNode)yyVals[0+yyTop]), null);
}
break;
case 65:
- // line 531 "DefaultRubyParser.y"
+ // line 530 "DefaultRubyParser.y"
{
yyVal = new MultipleAsgnNode(getPosition(((ListNode)yyVals[-1+yyTop])), ((ListNode)yyVals[-1+yyTop]).add(((Node)yyVals[0+yyTop])), null);
}
break;
case 66:
- // line 534 "DefaultRubyParser.y"
+ // line 533 "DefaultRubyParser.y"
{
yyVal = new MultipleAsgnNode(getPosition(((ListNode)yyVals[-2+yyTop])), ((ListNode)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 67:
- // line 537 "DefaultRubyParser.y"
+ // line 536 "DefaultRubyParser.y"
{
yyVal = new MultipleAsgnNode(getPosition(((ListNode)yyVals[-1+yyTop])), ((ListNode)yyVals[-1+yyTop]), new StarNode(getPosition(null)));
}
break;
case 68:
- // line 540 "DefaultRubyParser.y"
+ // line 539 "DefaultRubyParser.y"
{
yyVal = new MultipleAsgnNode(getPosition(((Token)yyVals[-1+yyTop])), null, ((Node)yyVals[0+yyTop]));
}
break;
case 69:
- // line 543 "DefaultRubyParser.y"
+ // line 542 "DefaultRubyParser.y"
{
yyVal = new MultipleAsgnNode(getPosition(((Token)yyVals[0+yyTop])), null, new StarNode(getPosition(null)));
}
break;
case 71:
- // line 548 "DefaultRubyParser.y"
+ // line 547 "DefaultRubyParser.y"
{
yyVal = ((MultipleAsgnNode)yyVals[-1+yyTop]);
}
break;
case 72:
- // line 552 "DefaultRubyParser.y"
+ // line 551 "DefaultRubyParser.y"
{
yyVal = new ArrayNode(((Node)yyVals[-1+yyTop]).getPosition(), ((Node)yyVals[-1+yyTop]));
}
break;
case 73:
- // line 555 "DefaultRubyParser.y"
+ // line 554 "DefaultRubyParser.y"
{
yyVal = ((ListNode)yyVals[-2+yyTop]).add(((Node)yyVals[-1+yyTop]));
}
break;
case 74:
- // line 559 "DefaultRubyParser.y"
+ // line 558 "DefaultRubyParser.y"
{
yyVal = support.assignable(((Token)yyVals[0+yyTop]), null);
}
break;
case 75:
- // line 562 "DefaultRubyParser.y"
+ // line 561 "DefaultRubyParser.y"
{
yyVal = support.getElementAssignmentNode(((Node)yyVals[-3+yyTop]), ((Node)yyVals[-1+yyTop]));
}
break;
case 76:
- // line 565 "DefaultRubyParser.y"
+ // line 564 "DefaultRubyParser.y"
{
yyVal = support.getAttributeAssignmentNode(((Node)yyVals[-2+yyTop]), (String) ((Token)yyVals[0+yyTop]).getValue());
}
break;
case 77:
- // line 568 "DefaultRubyParser.y"
+ // line 567 "DefaultRubyParser.y"
{
yyVal = support.getAttributeAssignmentNode(((Node)yyVals[-2+yyTop]), (String) ((Token)yyVals[0+yyTop]).getValue());
}
break;
case 78:
- // line 571 "DefaultRubyParser.y"
+ // line 570 "DefaultRubyParser.y"
{
yyVal = support.getAttributeAssignmentNode(((Node)yyVals[-2+yyTop]), (String) ((Token)yyVals[0+yyTop]).getValue());
}
break;
case 79:
- // line 574 "DefaultRubyParser.y"
+ // line 573 "DefaultRubyParser.y"
{
if (support.isInDef() || support.isInSingle()) {
yyerror("dynamic constant assignment");
@@ -1436,7 +1435,7 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 80:
- // line 581 "DefaultRubyParser.y"
+ // line 580 "DefaultRubyParser.y"
{
if (support.isInDef() || support.isInSingle()) {
yyerror("dynamic constant assignment");
@@ -1448,43 +1447,43 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 81:
- // line 590 "DefaultRubyParser.y"
+ // line 589 "DefaultRubyParser.y"
{
support.backrefAssignError(((Node)yyVals[0+yyTop]));
}
break;
case 82:
- // line 594 "DefaultRubyParser.y"
+ // line 593 "DefaultRubyParser.y"
{
yyVal = support.assignable(((Token)yyVals[0+yyTop]), null);
}
break;
case 83:
- // line 597 "DefaultRubyParser.y"
+ // line 596 "DefaultRubyParser.y"
{
yyVal = support.getElementAssignmentNode(((Node)yyVals[-3+yyTop]), ((Node)yyVals[-1+yyTop]));
}
break;
case 84:
- // line 600 "DefaultRubyParser.y"
+ // line 599 "DefaultRubyParser.y"
{
yyVal = support.getAttributeAssignmentNode(((Node)yyVals[-2+yyTop]), (String) ((Token)yyVals[0+yyTop]).getValue());
}
break;
case 85:
- // line 603 "DefaultRubyParser.y"
+ // line 602 "DefaultRubyParser.y"
{
yyVal = support.getAttributeAssignmentNode(((Node)yyVals[-2+yyTop]), (String) ((Token)yyVals[0+yyTop]).getValue());
}
break;
case 86:
- // line 606 "DefaultRubyParser.y"
+ // line 605 "DefaultRubyParser.y"
{
yyVal = support.getAttributeAssignmentNode(((Node)yyVals[-2+yyTop]), (String) ((Token)yyVals[0+yyTop]).getValue());
}
break;
case 87:
- // line 609 "DefaultRubyParser.y"
+ // line 608 "DefaultRubyParser.y"
{
if (support.isInDef() || support.isInSingle()) {
yyerror("dynamic constant assignment");
@@ -1494,7 +1493,7 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 88:
- // line 616 "DefaultRubyParser.y"
+ // line 615 "DefaultRubyParser.y"
{
if (support.isInDef() || support.isInSingle()) {
yyerror("dynamic constant assignment");
@@ -1506,69 +1505,69 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 89:
- // line 625 "DefaultRubyParser.y"
+ // line 624 "DefaultRubyParser.y"
{
support.backrefAssignError(((Node)yyVals[0+yyTop]));
}
break;
case 90:
- // line 629 "DefaultRubyParser.y"
+ // line 628 "DefaultRubyParser.y"
{
yyerror("class/module name must be CONSTANT");
}
break;
case 92:
- // line 634 "DefaultRubyParser.y"
+ // line 633 "DefaultRubyParser.y"
{
yyVal = new Colon3Node(support.union(((Token)yyVals[-1+yyTop]), ((Token)yyVals[0+yyTop])), (String) ((Token)yyVals[0+yyTop]).getValue());
}
break;
case 93:
- // line 637 "DefaultRubyParser.y"
+ // line 636 "DefaultRubyParser.y"
{
yyVal = new Colon2Node(((Token)yyVals[0+yyTop]).getPosition(), null, (String) ((Token)yyVals[0+yyTop]).getValue());
}
break;
case 94:
- // line 640 "DefaultRubyParser.y"
+ // line 639 "DefaultRubyParser.y"
{
yyVal = new Colon2Node(support.union(((Node)yyVals[-2+yyTop]), ((Token)yyVals[0+yyTop])), ((Node)yyVals[-2+yyTop]), (String) ((Token)yyVals[0+yyTop]).getValue());
}
break;
case 98:
- // line 646 "DefaultRubyParser.y"
+ // line 645 "DefaultRubyParser.y"
{
lexer.setState(LexState.EXPR_END);
yyVal = ((Token)yyVals[0+yyTop]);
}
break;
case 99:
- // line 651 "DefaultRubyParser.y"
+ // line 650 "DefaultRubyParser.y"
{
lexer.setState(LexState.EXPR_END);
yyVal = yyVals[0+yyTop];
}
break;
case 102:
- // line 658 "DefaultRubyParser.y"
+ // line 657 "DefaultRubyParser.y"
{
yyVal = new UndefNode(getPosition(((Token)yyVals[0+yyTop])), (String) ((Token)yyVals[0+yyTop]).getValue());
}
break;
case 103:
- // line 661 "DefaultRubyParser.y"
+ // line 660 "DefaultRubyParser.y"
{
lexer.setState(LexState.EXPR_FNAME);
}
break;
case 104:
- // line 663 "DefaultRubyParser.y"
+ // line 662 "DefaultRubyParser.y"
{
yyVal = support.appendToBlock(((Node)yyVals[-3+yyTop]), new UndefNode(getPosition(((Node)yyVals[-3+yyTop])), (String) ((Token)yyVals[0+yyTop]).getValue()));
}
break;
case 172:
- // line 682 "DefaultRubyParser.y"
+ // line 681 "DefaultRubyParser.y"
{
yyVal = support.node_assign(((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop]));
/* FIXME: Consider fixing node_assign itself rather than single case
@@ -1577,14 +1576,14 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 173:
- // line 687 "DefaultRubyParser.y"
+ // line 686 "DefaultRubyParser.y"
{
ISourcePosition position = support.union(((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop]));
yyVal = support.node_assign(((Node)yyVals[-4+yyTop]), new RescueNode(position, ((Node)yyVals[-2+yyTop]), new RescueBodyNode(position, null, ((Node)yyVals[0+yyTop]), null), null));
}
break;
case 174:
- // line 691 "DefaultRubyParser.y"
+ // line 690 "DefaultRubyParser.y"
{
support.checkExpression(((Node)yyVals[0+yyTop]));
String name = ((INameNode)yyVals[-2+yyTop]).getName();
@@ -1603,113 +1602,113 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 175:
- // line 707 "DefaultRubyParser.y"
+ // line 706 "DefaultRubyParser.y"
{
yyVal = new OpElementAsgnNode(getPosition(((Node)yyVals[-5+yyTop])), ((Node)yyVals[-5+yyTop]), (String) ((Token)yyVals[-1+yyTop]).getValue(), ((Node)yyVals[-3+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 176:
- // line 710 "DefaultRubyParser.y"
+ // line 709 "DefaultRubyParser.y"
{
yyVal = new OpAsgnNode(getPosition(((Node)yyVals[-4+yyTop])), ((Node)yyVals[-4+yyTop]), ((Node)yyVals[0+yyTop]), (String) ((Token)yyVals[-2+yyTop]).getValue(), (String) ((Token)yyVals[-1+yyTop]).getValue());
}
break;
case 177:
- // line 713 "DefaultRubyParser.y"
+ // line 712 "DefaultRubyParser.y"
{
yyVal = new OpAsgnNode(getPosition(((Node)yyVals[-4+yyTop])), ((Node)yyVals[-4+yyTop]), ((Node)yyVals[0+yyTop]), (String) ((Token)yyVals[-2+yyTop]).getValue(), (String) ((Token)yyVals[-1+yyTop]).getValue());
}
break;
case 178:
- // line 716 "DefaultRubyParser.y"
+ // line 715 "DefaultRubyParser.y"
{
yyVal = new OpAsgnNode(getPosition(((Node)yyVals[-4+yyTop])), ((Node)yyVals[-4+yyTop]), ((Node)yyVals[0+yyTop]), (String) ((Token)yyVals[-2+yyTop]).getValue(), (String) ((Token)yyVals[-1+yyTop]).getValue());
}
break;
case 179:
- // line 719 "DefaultRubyParser.y"
+ // line 718 "DefaultRubyParser.y"
{
yyerror("constant re-assignment");
}
break;
case 180:
- // line 722 "DefaultRubyParser.y"
+ // line 721 "DefaultRubyParser.y"
{
yyerror("constant re-assignment");
}
break;
case 181:
- // line 725 "DefaultRubyParser.y"
+ // line 724 "DefaultRubyParser.y"
{
support.backrefAssignError(((Node)yyVals[-2+yyTop]));
}
break;
case 182:
- // line 728 "DefaultRubyParser.y"
+ // line 727 "DefaultRubyParser.y"
{
support.checkExpression(((Node)yyVals[-2+yyTop]));
support.checkExpression(((Node)yyVals[0+yyTop]));
yyVal = new DotNode(getPosition(((Node)yyVals[-2+yyTop])), ((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop]), false);
}
break;
case 183:
- // line 733 "DefaultRubyParser.y"
+ // line 732 "DefaultRubyParser.y"
{
support.checkExpression(((Node)yyVals[-2+yyTop]));
support.checkExpression(((Node)yyVals[0+yyTop]));
yyVal = new DotNode(getPosition(((Node)yyVals[-2+yyTop])), ((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop]), true);
}
break;
case 184:
- // line 738 "DefaultRubyParser.y"
+ // line 737 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "+", ((Node)yyVals[0+yyTop]));
}
break;
case 185:
- // line 741 "DefaultRubyParser.y"
+ // line 740 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "-", ((Node)yyVals[0+yyTop]));
}
break;
case 186:
- // line 744 "DefaultRubyParser.y"
+ // line 743 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "*", ((Node)yyVals[0+yyTop]));
}
break;
case 187:
- // line 747 "DefaultRubyParser.y"
+ // line 746 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "/", ((Node)yyVals[0+yyTop]));
}
break;
case 188:
- // line 750 "DefaultRubyParser.y"
+ // line 749 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "%", ((Node)yyVals[0+yyTop]));
}
break;
case 189:
- // line 753 "DefaultRubyParser.y"
+ // line 752 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "**", ((Node)yyVals[0+yyTop]));
}
break;
case 190:
- // line 756 "DefaultRubyParser.y"
+ // line 755 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "**", ((Node)yyVals[0+yyTop])), "-@");
}
break;
case 191:
- // line 759 "DefaultRubyParser.y"
+ // line 758 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "**", ((Node)yyVals[0+yyTop])), "-@");
}
break;
case 192:
- // line 762 "DefaultRubyParser.y"
+ // line 761 "DefaultRubyParser.y"
{
if (((Node)yyVals[0+yyTop]) != null && ((Node)yyVals[0+yyTop]) instanceof ILiteralNode) {
yyVal = ((Node)yyVals[0+yyTop]);
@@ -1719,480 +1718,480 @@ public Object yyparse (RubyYaccLexer yyLex) throws java.io.IOException, yyExcept
}
break;
case 193:
- // line 769 "DefaultRubyParser.y"
+ // line 768 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[0+yyTop]), "-@");
}
break;
case 194:
- // line 772 "DefaultRubyParser.y"
+ // line 771 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "|", ((Node)yyVals[0+yyTop]));
}
break;
case 195:
- // line 775 "DefaultRubyParser.y"
+ // line 774 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "^", ((Node)yyVals[0+yyTop]));
}
break;
case 196:
- // line 778 "DefaultRubyParser.y"
+ // line 777 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "&", ((Node)yyVals[0+yyTop]));
}
break;
case 197:
- // line 781 "DefaultRubyParser.y"
+ // line 780 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "<=>", ((Node)yyVals[0+yyTop]));
}
break;
case 198:
- // line 784 "DefaultRubyParser.y"
+ // line 783 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), ">", ((Node)yyVals[0+yyTop]));
}
break;
case 199:
- // line 787 "DefaultRubyParser.y"
+ // line 786 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), ">=", ((Node)yyVals[0+yyTop]));
}
break;
case 200:
- // line 790 "DefaultRubyParser.y"
+ // line 789 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "<", ((Node)yyVals[0+yyTop]));
}
break;
case 201:
- // line 793 "DefaultRubyParser.y"
+ // line 792 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "<=", ((Node)yyVals[0+yyTop]));
}
break;
case 202:
- // line 796 "DefaultRubyParser.y"
+ // line 795 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "==", ((Node)yyVals[0+yyTop]));
}
break;
case 203:
- // line 799 "DefaultRubyParser.y"
+ // line 798 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "===", ((Node)yyVals[0+yyTop]));
}
break;
case 204:
- // line 802 "DefaultRubyParser.y"
+ // line 801 "DefaultRubyParser.y"
{
yyVal = new NotNode(support.union(((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop])), support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "==", ((Node)yyVals[0+yyTop])));
}
break;
case 205:
- // line 805 "DefaultRubyParser.y"
+ // line 804 "DefaultRubyParser.y"
{
yyVal = support.getMatchNode(((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 206:
- // line 808 "DefaultRubyParser.y"
+ // line 807 "DefaultRubyParser.y"
{
yyVal = new NotNode(support.union(((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop])), support.getMatchNode(((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop])));
}
break;
case 207:
- // line 811 "DefaultRubyParser.y"
+ // line 810 "DefaultRubyParser.y"
{
yyVal = new NotNode(support.union(((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop])), support.getConditionNode(((Node)yyVals[0+yyTop])));
}
break;
case 208:
- // line 814 "DefaultRubyParser.y"
+ // line 813 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[0+yyTop]), "~");
}
break;
case 209:
- // line 817 "DefaultRubyParser.y"
+ // line 816 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), "<<", ((Node)yyVals[0+yyTop]));
}
break;
case 210:
- // line 820 "DefaultRubyParser.y"
+ // line 819 "DefaultRubyParser.y"
{
yyVal = support.getOperatorCallNode(((Node)yyVals[-2+yyTop]), ">>", ((Node)yyVals[0+yyTop]));
}
break;
case 211:
- // line 823 "DefaultRubyParser.y"
+ // line 822 "DefaultRubyParser.y"
{
yyVal = support.newAndNode(((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 212:
- // line 826 "DefaultRubyParser.y"
+ // line 825 "DefaultRubyParser.y"
{
yyVal = support.newOrNode(((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 213:
- // line 829 "DefaultRubyParser.y"
+ // line 828 "DefaultRubyParser.y"
{
yyVal = new DefinedNode(getPosition(((Token)yyVals[-2+yyTop])), ((Node)yyVals[0+yyTop]));
}
break;
case 214:
- // line 832 "DefaultRubyParser.y"
+ // line 831 "DefaultRubyParser.y"
{
yyVal = new IfNode(getPosition(((Node)yyVals[-4+yyTop])), support.getConditionNode(((Node)yyVals[-4+yyTop])), ((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 215:
- // line 835 "DefaultRubyParser.y"
+ // line 834 "DefaultRubyParser.y"
{
yyVal = ((Node)yyVals[0+yyTop]);