Java Doc for GrammarAST.java in  » Parser » antlr-3.0.1 » org » antlr » tool » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Parser » antlr 3.0.1 » org.antlr.tool 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.antlr.tool.GrammarAST

GrammarAST
public class GrammarAST extends BaseAST (Code)
Grammars are first converted to ASTs using this class and then are converted to NFAs via a tree walker. The reader may notice that I have made a very non-OO decision in this class to track variables for many different kinds of nodes. It wastes space for nodes that don't need the values and OO principles cry out for a new class type for each kind of node in my tree. I am doing this on purpose for a variety of reasons. I don't like using the type system for different node types; it yields too many damn class files which I hate. Perhaps if I put them all in one file. Most importantly though I hate all the type casting that would have to go on. I would have all sorts of extra work to do. Ick. Anyway, I'm doing all this on purpose, not out of ignorance. ;)


Field Summary
public  intID
    
public  NFAStateNFAStartState
    
public  NFAStateNFATreeDownState
     This is used for TREE_BEGIN nodes to point into the NFA.
public  StringTemplatecode
     if this is a TOKEN_REF or RULE_REF node, this is the code StringTemplate generated for this node.
static  intcount
    
final public static  MapdefaultBlockOptions
    
protected  StringenclosingRule
    
public  NFAStatefollowingNFAState
     Rule ref nodes, token refs, set, and NOT set refs need to track their location in the generated NFA so that local FOLLOW sets can be computed during code gen for automatic error recovery.
final public static  SetlegalBlockOptions
    
public  DFAlookaheadDFA
    
protected  Mapoptions
    
public  intouterAltNum
     if this is an ACTION node, this is the outermost enclosing alt num in rule.
public  Set<GrammarAST>rewriteRefsDeep
    
public  Set<GrammarAST>rewriteRefsShallow
     If this is a BLOCK node for a rewrite rule, track referenced elements here.
public  intruleStartTokenIndex
     If this is a RULE node then track rule's start, stop tokens' index.
public  intruleStopTokenIndex
    
protected  IntSetsetValue
    
public  Tokentoken
    

Constructor Summary
public  GrammarAST()
    
public  GrammarAST(int t, String txt)
    

Method Summary
public static  GrammarASTdup(AST t)
    
public static  GrammarASTdupListNoActions(GrammarAST t, GrammarAST parent)
     Duplicate tree including siblings of root.
public static  GrammarASTdupTreeNoActions(GrammarAST t, GrammarAST parent)
     Duplicate a tree, assuming this is a root node of a tree-- duplicate that node and what's below; ignore siblings of root node.
public  booleanequals(AST ast)
     Make nodes unique based upon Token so we can add them to a Set; if not a GrammarAST, check type.
public  GrammarASTfindFirstType(int ttype)
     Return a reference to the first node (depth-first) that has token type ttype.
public  GrammarASTgetChild(int i)
    
public  GrammarAST[]getChildrenAsArray()
    
public  intgetColumn()
    
public  StringgetEnclosingRule()
    
public  GrammarASTgetFirstChildWithType(int ttype)
    
public  GrammarASTgetLastChild()
    
public  GrammarASTgetLastSibling()
    
public  intgetLine()
    
public  DFAgetLookaheadDFA()
    
public  NFAStategetNFAStartState()
    
public  ObjectgetOption(String key)
    
public  MapgetOptions()
    
public  IntSetgetSetValue()
    
public  StringgetText()
    
public  TokengetToken()
    
public  intgetType()
    
public  booleanhasSameListStructure(AST t)
    
public  booleanhasSameTreeStructure(AST t)
    
public  voidinitialize(int i, String s)
    
public  voidinitialize(AST ast)
    
public  voidinitialize(Token token)
    
public static  voidmain(String[] args)
    
public  voidsetColumn(int col)
    
public  voidsetEnclosingRule(String rule)
    
public  voidsetLine(int line)
    
public  voidsetLookaheadDFA(DFA lookaheadDFA)
    
public  voidsetNFAStartState(NFAState nfaStartState)
    
public  StringsetOption(Grammar grammar, String key, Object value)
     Save the option key/value pair and process it; return the key or null if invalid option.
public  voidsetOptions(Grammar grammar, Map options)
    
public  voidsetSetValue(IntSet setValue)
    
public  voidsetText(String text)
    
public  voidsetType(int type)
    

Field Detail
ID
public int ID(Code)



NFAStartState
public NFAState NFAStartState(Code)
What NFA start state was built from this node?



NFATreeDownState
public NFAState NFATreeDownState(Code)
This is used for TREE_BEGIN nodes to point into the NFA. TREE_BEGINs point at left edge of DOWN for LOOK computation purposes (Nullable tree child list needs special code gen when matching).



code
public StringTemplate code(Code)
if this is a TOKEN_REF or RULE_REF node, this is the code StringTemplate generated for this node. We need to update it later to add a label if someone does $tokenref or $ruleref in an action.



count
static int count(Code)



defaultBlockOptions
final public static Map defaultBlockOptions(Code)
What are the default options for a subrule?



enclosingRule
protected String enclosingRule(Code)



followingNFAState
public NFAState followingNFAState(Code)
Rule ref nodes, token refs, set, and NOT set refs need to track their location in the generated NFA so that local FOLLOW sets can be computed during code gen for automatic error recovery.



legalBlockOptions
final public static Set legalBlockOptions(Code)



lookaheadDFA
public DFA lookaheadDFA(Code)
If this is a decision node, what is the lookahead DFA?



options
protected Map options(Code)
If this is a BLOCK node, track options here



outerAltNum
public int outerAltNum(Code)
if this is an ACTION node, this is the outermost enclosing alt num in rule. For actions, define.g sets these (used to be codegen.g). We need these set so we can examine actions early, before code gen, for refs to rule predefined properties and rule labels. For most part define.g sets outerAltNum, but codegen.g does the ones for %foo(a={$ID.text}) type refs as the {$ID...} is not seen as an action until code gen pulls apart.



rewriteRefsDeep
public Set<GrammarAST> rewriteRefsDeep(Code)



rewriteRefsShallow
public Set<GrammarAST> rewriteRefsShallow(Code)
If this is a BLOCK node for a rewrite rule, track referenced elements here. Don't track elements in nested subrules.



ruleStartTokenIndex
public int ruleStartTokenIndex(Code)
If this is a RULE node then track rule's start, stop tokens' index.



ruleStopTokenIndex
public int ruleStopTokenIndex(Code)



setValue
protected IntSet setValue(Code)
If this is a SET node, what are the elements?



token
public Token token(Code)
This AST node was created from what token?




Constructor Detail
GrammarAST
public GrammarAST()(Code)



GrammarAST
public GrammarAST(int t, String txt)(Code)




Method Detail
dup
public static GrammarAST dup(AST t)(Code)



dupListNoActions
public static GrammarAST dupListNoActions(GrammarAST t, GrammarAST parent)(Code)
Duplicate tree including siblings of root.



dupTreeNoActions
public static GrammarAST dupTreeNoActions(GrammarAST t, GrammarAST parent)(Code)
Duplicate a tree, assuming this is a root node of a tree-- duplicate that node and what's below; ignore siblings of root node.



equals
public boolean equals(AST ast)(Code)
Make nodes unique based upon Token so we can add them to a Set; if not a GrammarAST, check type.



findFirstType
public GrammarAST findFirstType(int ttype)(Code)
Return a reference to the first node (depth-first) that has token type ttype. Assume 'this' is a root node; don't visit siblings of root. Return null if no node found with ttype.



getChild
public GrammarAST getChild(int i)(Code)
Get the ith child from 0



getChildrenAsArray
public GrammarAST[] getChildrenAsArray()(Code)



getColumn
public int getColumn()(Code)



getEnclosingRule
public String getEnclosingRule()(Code)



getFirstChildWithType
public GrammarAST getFirstChildWithType(int ttype)(Code)



getLastChild
public GrammarAST getLastChild()(Code)



getLastSibling
public GrammarAST getLastSibling()(Code)



getLine
public int getLine()(Code)



getLookaheadDFA
public DFA getLookaheadDFA()(Code)



getNFAStartState
public NFAState getNFAStartState()(Code)



getOption
public Object getOption(String key)(Code)



getOptions
public Map getOptions()(Code)



getSetValue
public IntSet getSetValue()(Code)



getText
public String getText()(Code)



getToken
public Token getToken()(Code)



getType
public int getType()(Code)



hasSameListStructure
public boolean hasSameListStructure(AST t)(Code)



hasSameTreeStructure
public boolean hasSameTreeStructure(AST t)(Code)
See if tree has exact token types and structure; no text



initialize
public void initialize(int i, String s)(Code)



initialize
public void initialize(AST ast)(Code)



initialize
public void initialize(Token token)(Code)



main
public static void main(String[] args)(Code)



setColumn
public void setColumn(int col)(Code)



setEnclosingRule
public void setEnclosingRule(String rule)(Code)



setLine
public void setLine(int line)(Code)



setLookaheadDFA
public void setLookaheadDFA(DFA lookaheadDFA)(Code)



setNFAStartState
public void setNFAStartState(NFAState nfaStartState)(Code)



setOption
public String setOption(Grammar grammar, String key, Object value)(Code)
Save the option key/value pair and process it; return the key or null if invalid option.



setOptions
public void setOptions(Grammar grammar, Map options)(Code)



setSetValue
public void setSetValue(IntSet setValue)(Code)



setText
public void setText(String text)(Code)



setType
public void setType(int type)(Code)



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.