Package snap.parse

Class ParseNode

java.lang.Object
snap.parse.ParseNode

public class ParseNode extends Object
A parse node.
  • Constructor Details

    • ParseNode

      public ParseNode()
  • Method Details

    • init

      public void init(Parser aParser, ParseRule aRule, ParseToken aStartToken, ParseToken anEndToken)
      Creates a new parse node
    • getParser

      public Parser getParser()
      Returns the parser.
    • getRule

      public ParseRule getRule()
      Returns the rule.
    • getId

      public String getId()
      Returns the id of the node's rule: either the name or pattern or null.
    • getName

      public String getName()
      Returns the rule name.
    • getPattern

      public String getPattern()
      Returns the rule pattern.
    • getStartToken

      public ParseToken getStartToken()
      Returns the start token for this node.
    • getEndToken

      public ParseToken getEndToken()
      Returns the end token for this node.
    • getStart

      public int getStart()
      Returns the match start.
    • getEnd

      public int getEnd()
      Returns the match end.
    • getLength

      public int getLength()
      Returns the match length.
    • getLineIndex

      public int getLineIndex()
      Returns the line index.
    • getString

      public String getString()
      Returns the match string.
    • createString

      protected String createString()
      Creates the match string.
    • getCustomNode

      public Object getCustomNode()
      Returns the custom node created by parser or rule handler, should there be one.
    • setCustomNode

      public void setCustomNode(Object anObj)
      Sets the custom node created by parser or rule handler, should there be one.
    • getCustomNode

      public <T> T getCustomNode(Class<T> aClass)
      Returns the custom node as the given class type.
    • toString

      public String toString()
      Returns a string representation of node.
      Overrides:
      toString in class Object