About 228 results: "List<Object> repo:w4x/boolangstudio"
Page 4 of 12
Filter Results
Sources
Languages
Filter Results
Try Search On


















trees.html in boolangstudio https://github.com/w4x/boolangstudio.git | 958 lines | HTML
  1. </p>
  2. <pre>String s = parser.getAST().toStringList();</pre> <h2><a name="_bb11"></a><a name="AST Factories">AST Factories</a></h2>
  3. <p>
  4. 	The parser is pretty straightforward except that you have to add the options to tell ANTLR what node types you want to create for which token matched on the input stream. &nbsp; The <font face="Courier New">tokens</font> section lists the operators with element option AST appended to their definitions.&nbsp; This tells ANTLR to build <font face="Courier New">PLUSNode</font> objects for any <font face="Courier New">PLUS</font> tokens seen on the input stream, for example.&nbsp; For demonstration purposes, <font face="Courier New">INT</font> is not included in the <font face="Courier New">tokens</font> section--the specific token references is suffixed with the element option to specify that nodes created from that <font face="Courier New">INT</font> should be of type <font face="Courier New">INTNode</font> (of course, the effect is the same as there is only that one reference to <font face="Courier New">INT</font>).
  5. <p>
  6. 	Loops will generally be used to build up lists of subtree. For example, if you want a list of polynomial assignments to produce a sibling list of <tt>ASSIGN</tt> subtrees, then the following rule you would normally split into two rules.
  7.     public void addChild(AST node);</tt></pre> <pre>    /** Are two nodes exactly equal? */
  8.     public boolean equals(AST t);</pre> <pre>    /** Are two lists of nodes/subtrees exactly
  9.      *  equal in structure and content? */
  10.     public boolean equalsList(AST t);</pre> <pre>    /** Are two lists of nodes/subtrees
  11.      */
  12.     public boolean equalsListPartial(AST t);</pre> <pre>    /** Are two nodes/subtrees exactly equal? */
  13.     public void initialize(Token t);</pre> <pre>    /** Convert node to printable form */
  14.     public String toString();</pre> <pre>    /** Treat 'this' as list (i.e.,
  15.      */
  16.     public String toStringList();</pre> <pre>    /** Treat 'this' as tree root


Back to Top