Class Loop

All Implemented Interfaces:
Comparable<AstNode>, Iterable<Node>
Direct Known Subclasses:
DoLoop, ForInLoop, ForLoop, WhileLoop

public abstract class Loop extends Scope
Abstract base type for loops.
  • Field Details

    • body

      protected AstNode body
    • lp

      protected int lp
    • rp

      protected int rp
  • Constructor Details

    • Loop

      public Loop()
    • Loop

      public Loop(int pos)
    • Loop

      public Loop(int pos, int len)
  • Method Details

    • getBody

      public AstNode getBody()
      Returns loop body
    • setBody

      public void setBody(AstNode body)
      Sets loop body. Sets the parent of the body to this loop node, and updates its offset to be relative. Extends the length of this node to include the body.
    • getLp

      public int getLp()
      Returns left paren position, -1 if missing
    • setLp

      public void setLp(int lp)
      Sets left paren position
    • getRp

      public int getRp()
      Returns right paren position, -1 if missing
    • setRp

      public void setRp(int rp)
      Sets right paren position
    • setParens

      public void setParens(int lp, int rp)
      Sets both paren positions