Class ForInLoop

    • Constructor Detail

      • ForInLoop

        public ForInLoop()
      • ForInLoop

        public ForInLoop​(int pos)
      • ForInLoop

        public ForInLoop​(int pos,
                         int len)
    • Method Detail

      • getIterator

        public AstNode getIterator()
        Returns loop iterator expression
      • setIterator

        public void setIterator​(AstNode iterator)
        Sets loop iterator expression: the part before the "in" keyword. Also sets its parent to this node.
        Throws:
        IllegalArgumentException - if iterator is null
      • getIteratedObject

        public AstNode getIteratedObject()
        Returns object being iterated over
      • setIteratedObject

        public void setIteratedObject​(AstNode object)
        Sets object being iterated over, and sets its parent to this node.
        Throws:
        IllegalArgumentException - if object is null
      • isForEach

        public boolean isForEach()
        Returns whether the loop is a for-each loop
      • setIsForEach

        public void setIsForEach​(boolean isForEach)
        Sets whether the loop is a for-each loop
      • getInPosition

        public int getInPosition()
        Returns position of "in" keyword
      • setInPosition

        public void setInPosition​(int inPosition)
        Sets position of "in" keyword
        Parameters:
        inPosition - position of "in" keyword, or -1 if not present (e.g. in presence of a syntax error)
      • getEachPosition

        public int getEachPosition()
        Returns position of "each" keyword
      • setEachPosition

        public void setEachPosition​(int eachPosition)
        Sets position of "each" keyword
        Parameters:
        eachPosition - position of "each" keyword, or -1 if not present.
      • toSource

        public String toSource​(int depth)
        Description copied from class: AstNode
        Emits source code for this node. Callee is responsible for calling this function recursively on children, incrementing indent as appropriate.

        Note: if the parser was in error-recovery mode, some AST nodes may have null children that are expected to be non-null when no errors are present. In this situation, the behavior of the toSource method is undefined: toSource implementations may assume that the AST node is error-free, since it is intended to be invoked only at runtime after a successful parse.

        Overrides:
        toSource in class Scope
        Parameters:
        depth - the current recursion depth, typically beginning at 0 when called on the root node.
      • visit

        public void visit​(NodeVisitor v)
        Visits this node, the iterator, the iterated object, and the body.
        Overrides:
        visit in class Scope
        Parameters:
        v - the object to call with this node and its children