Class NodeUtils


  • public class NodeUtils
    extends java.lang.Object
    Utilities for dealing with the AST node structure.
    Version:
    $Id$
    • Constructor Summary

      Constructors 
      Constructor Description
      NodeUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void fixIndentation​(SimpleNode parent, java.lang.String parentIndentation)
      Fix children indentation in structured space gobbling mode.
      static java.lang.StringBuilder getSpecialText​(Parser parser, Token t)
      Collect all the <SPECIAL_TOKEN>s that are carried along with a token.
      static java.lang.String tokenLiteral​(Parser parser, Token t)
      complete node literal
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NodeUtils

        public NodeUtils()
    • Method Detail

      • getSpecialText

        public static java.lang.StringBuilder getSpecialText​(Parser parser,
                                                             Token t)
        Collect all the <SPECIAL_TOKEN>s that are carried along with a token. Special tokens do not participate in parsing but can still trigger certain lexical actions. In some cases you may want to retrieve these special tokens, this is simply a way to extract them.
        Parameters:
        t - the Token
        Returns:
        StrBuilder with the special tokens.
        Since:
        2.0.0
      • tokenLiteral

        public static java.lang.String tokenLiteral​(Parser parser,
                                                    Token t)
        complete node literal
        Parameters:
        t -
        Returns:
        A node literal.
      • fixIndentation

        public static void fixIndentation​(SimpleNode parent,
                                          java.lang.String parentIndentation)
        Fix children indentation in structured space gobbling mode.
        Parameters:
        parent -
        parentIndentation -