Java Doc for Label.java in  » Parser » antlr-3.0.1 » org » antlr » analysis » 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.analysis 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.antlr.analysis.Label

Label
public class Label implements Comparable,Cloneable(Code)
A state machine transition label. A label can be either a simple label such as a token or character. A label can be a set of char or tokens. It can be an epsilon transition. It can be a semantic predicate (which assumes an epsilon transition) or a tree of predicates (in a DFA).


Field Summary
final public static  intDOWN
    
final public static  intEOF
    
final public static  intEOR_TOKEN_TYPE
     End of rule token type; imaginary token type used only for local, partial FOLLOW sets to indicate that the local FOLLOW hit the end of rule.
final public static  intEOT
     End of Token is like EOF for lexer rules.
final public static  intEPSILON
    
final public static  StringEPSILON_STR
    
final public static  intINVALID
    
final public static  intMAX_CHAR_VALUE
    
final public static  intMIN_ATOM_VALUE
     Anything at this value or larger can be considered a simple atom int for easy comparison during analysis only; faux labels are not used during parse time for real token types or char values.
final public static  intMIN_CHAR_VALUE
    
final public static  intMIN_TOKEN_TYPE
    
final public static  intNUM_FAUX_LABELS
     We have labels like EPSILON that are below 0; it's hard to store them in an array with negative index so use this constant as an index shift when accessing arrays based upon token type.
final public static  intSEMPRED
    
final public static  intSET
    
final public static  intUP
    
protected  intlabel
     The token type or character value; or, signifies special label.
protected  IntSetlabelSet
    
protected  SemanticContextsemanticContext
     A tree of semantic predicates from the grammar AST if label==SEMPRED.

Constructor Summary
public  Label(int label)
    
public  Label(GrammarAST predicateASTNode)
    
public  Label(SemanticContext semCtx)
    
public  Label(IntSet labelSet)
    

Method Summary
public  voidadd(Label a)
    
public  Objectclone()
    
public  intcompareTo(Object o)
    
public  booleanequals(Object o)
    
public  intgetAtom()
    
public  SemanticContextgetSemanticContext()
    
public  IntSetgetSet()
    
public  inthashCode()
    
public  booleanisAtom()
    
public  booleanisEpsilon()
    
public  booleanisSemanticPredicate()
    
public  booleanisSet()
    
public  booleanmatches(int atom)
    
public  booleanmatches(IntSet set)
    
public  booleanmatches(Label other)
    
public  voidsetSet(IntSet set)
    
public  StringtoString()
     Predicates are lists of AST nodes from the NFA created from the grammar, but the same predicate could be cut/paste into multiple places in the grammar.
public  StringtoString(Grammar g)
    

Field Detail
DOWN
final public static int DOWN(Code)



EOF
final public static int EOF(Code)



EOR_TOKEN_TYPE
final public static int EOR_TOKEN_TYPE(Code)
End of rule token type; imaginary token type used only for local, partial FOLLOW sets to indicate that the local FOLLOW hit the end of rule. During error recovery, the local FOLLOW of a token reference may go beyond the end of the rule and have to use FOLLOW(rule). I have to just shift the token types to 2..n rather than 1..n to accommodate this imaginary token in my bitsets. If I didn't use a bitset implementation for runtime sets, I wouldn't need this. EOF is another candidate for a run time token type for parsers. Follow sets are not computed for lexers so we do not have this issue.



EOT
final public static int EOT(Code)
End of Token is like EOF for lexer rules. It implies that no more characters are available and that NFA conversion should terminate for this path. For example A : 'a' 'b' | 'a' ; yields a DFA predictor: o-a->o-b->1 predict alt 1 | |-EOT->o predict alt 2 To generate code for EOT, treat it as the "default" path, which implies there is no way to mismatch a char for the state from which the EOT emanates.



EPSILON
final public static int EPSILON(Code)



EPSILON_STR
final public static String EPSILON_STR(Code)



INVALID
final public static int INVALID(Code)



MAX_CHAR_VALUE
final public static int MAX_CHAR_VALUE(Code)



MIN_ATOM_VALUE
final public static int MIN_ATOM_VALUE(Code)
Anything at this value or larger can be considered a simple atom int for easy comparison during analysis only; faux labels are not used during parse time for real token types or char values.



MIN_CHAR_VALUE
final public static int MIN_CHAR_VALUE(Code)



MIN_TOKEN_TYPE
final public static int MIN_TOKEN_TYPE(Code)
tokens and char range overlap; tokens are MIN_TOKEN_TYPE..n



NUM_FAUX_LABELS
final public static int NUM_FAUX_LABELS(Code)
We have labels like EPSILON that are below 0; it's hard to store them in an array with negative index so use this constant as an index shift when accessing arrays based upon token type. If real token type is i, then array index would be NUM_FAUX_LABELS + i.



SEMPRED
final public static int SEMPRED(Code)
label is a semantic predicate; implies label is epsilon also



SET
final public static int SET(Code)
label is a set of tokens or char



UP
final public static int UP(Code)



label
protected int label(Code)
The token type or character value; or, signifies special label.



labelSet
protected IntSet labelSet(Code)
A set of token types or character codes if label==SET



semanticContext
protected SemanticContext semanticContext(Code)
A tree of semantic predicates from the grammar AST if label==SEMPRED. In the NFA, labels will always be exactly one predicate, but the DFA may have to combine a bunch of them as it collects predicates from multiple NFA configurations into a single DFA state.




Constructor Detail
Label
public Label(int label)(Code)



Label
public Label(GrammarAST predicateASTNode)(Code)
Make a semantic predicate label



Label
public Label(SemanticContext semCtx)(Code)
Make a semantic predicates label



Label
public Label(IntSet labelSet)(Code)
Make a set label




Method Detail
add
public void add(Label a)(Code)



clone
public Object clone()(Code)



compareTo
public int compareTo(Object o)(Code)



equals
public boolean equals(Object o)(Code)



getAtom
public int getAtom()(Code)
return the single atom label or INVALID if not a single atom



getSemanticContext
public SemanticContext getSemanticContext()(Code)



getSet
public IntSet getSet()(Code)



hashCode
public int hashCode()(Code)



isAtom
public boolean isAtom()(Code)



isEpsilon
public boolean isEpsilon()(Code)



isSemanticPredicate
public boolean isSemanticPredicate()(Code)



isSet
public boolean isSet()(Code)



matches
public boolean matches(int atom)(Code)



matches
public boolean matches(IntSet set)(Code)



matches
public boolean matches(Label other)(Code)



setSet
public void setSet(IntSet set)(Code)



toString
public String toString()(Code)
Predicates are lists of AST nodes from the NFA created from the grammar, but the same predicate could be cut/paste into multiple places in the grammar. I must compare the text of all the predicates to truly answer whether {p1,p2} .equals {p1,p2}. Unfortunately, I cannot rely on the AST.equals() to work properly so I must do a brute force O(n^2) nested traversal of the Set doing a String compare. At this point, Labels are not compared for equals when they are predicates, but here's the code for future use.



toString
public String toString(Grammar g)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

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