Java Doc for LLkAnalyzer.java in  » Database-ORM » toplink » persistence » antlr » 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 » Database ORM » toplink » persistence.antlr 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   persistence.antlr.LLkAnalyzer

LLkAnalyzer
public class LLkAnalyzer implements LLkGrammarAnalyzer(Code)
A linear-approximate LL(k) grammar analzyer. All lookahead elements are sets of token types.
author:
   Terence Parr, John Lilley
See Also:   persistence.antlr.Grammar
See Also:   persistence.antlr.Lookahead


Field Summary
public  booleanDEBUG_ANALYZER
    
 CharFormattercharFormatter
    
protected  Grammargrammar
    
protected  booleanlexicalAnalysis
    
protected  Tooltool
    

Constructor Summary
public  LLkAnalyzer(Tool tool_)
    

Method Summary
public  LookaheadFOLLOW(int k, RuleEndElement end)
     Compute the lookahead set of whatever follows references to the rule associated witht the FOLLOW block.
protected  booleanaltUsesWildcardDefault(Alternative alt)
     Return true if someone used the '.' wildcard default idiom. Either #(.
public  booleandeterministic(AlternativeBlock blk)
     Is this block of alternatives LL(k)? Fill in alternative cache for this block.
public  booleandeterministic(OneOrMoreBlock blk)
     Is (...)+ block LL(1)? Fill in alternative cache for this block.
public  booleandeterministic(ZeroOrMoreBlock blk)
     Is (...)* block LL(1)? Fill in alternative cache for this block.
public  booleandeterministicImpliedPath(BlockWithImpliedExitPath blk)
    
public  Lookaheadlook(int k, ActionElement action)
    
public  Lookaheadlook(int k, AlternativeBlock blk)
    
public  Lookaheadlook(int k, BlockEndElement end)
     Compute what follows this place-holder node and possibly what begins the associated loop unless the node is locked.

if we hit the end of a loop, we have to include what tokens can begin the loop as well.

public  Lookaheadlook(int k, CharLiteralElement atom)
     Return this char as the lookahead if k=1.

### Doesn't work for ( 'a' 'b' | 'a' ~'b' ) yet!!!

If the atom has the not flag on, then create the set complement of the tokenType which is the set of all characters referenced in the grammar with this char turned off. Also remove characters from the set that are currently allocated for predicting previous alternatives.

public  Lookaheadlook(int k, CharRangeElement r)
    
public  Lookaheadlook(int k, GrammarAtom atom)
    
public  Lookaheadlook(int k, OneOrMoreBlock blk)
     The lookahead of a (...)+ block is the combined lookahead of all alternatives and, if an empty path is found, the lookahead of what follows the block.
public  Lookaheadlook(int k, RuleBlock blk)
     Combine the lookahead computed for each alternative. Lock the node so that no other computation may come back on itself--infinite loop.
public  Lookaheadlook(int k, RuleEndElement end)
     If not locked or noFOLLOW set, compute FOLLOW of a rule.

TJP says 8/12/99: not true anymore: Lexical rules never compute follow.

public  Lookaheadlook(int k, RuleRefElement rr)
     Compute the lookahead contributed by a rule reference.

When computing ruleref lookahead, we don't want the FOLLOW computation done if an empty path exists for the rule. The FOLLOW is too loose of a set...we want only to include the "local" FOLLOW or what can follow this particular ref to the node.

public  Lookaheadlook(int k, StringLiteralElement atom)
    
public  Lookaheadlook(int k, SynPredBlock blk)
     The lookahead of a (...)=> block is the lookahead of what follows the block.
public  Lookaheadlook(int k, TokenRangeElement r)
    
public  Lookaheadlook(int k, TreeElement t)
    
public  Lookaheadlook(int k, WildcardElement wc)
    
public  Lookaheadlook(int k, ZeroOrMoreBlock blk)
     The (...)* element is the combined lookahead of the alternatives and what can follow the loop.
public  Lookaheadlook(int k, String rule)
     Compute the combined lookahead for all productions of a rule. If the lookahead returns with epsilon, at least one epsilon path exists (one that consumes no tokens).
public static  booleanlookaheadEquivForApproxAndFullAnalysis(Lookahead[] bset, int k)
     If the first k-1 sets are singleton sets, the appoximate lookahead analysis is equivalent to full lookahead analysis.
public  voidsetGrammar(Grammar g)
    
public  booleansubruleCanBeInverted(AlternativeBlock blk, boolean forLexer)
    

Field Detail
DEBUG_ANALYZER
public boolean DEBUG_ANALYZER(Code)



charFormatter
CharFormatter charFormatter(Code)



grammar
protected Grammar grammar(Code)



lexicalAnalysis
protected boolean lexicalAnalysis(Code)



tool
protected Tool tool(Code)




Constructor Detail
LLkAnalyzer
public LLkAnalyzer(Tool tool_)(Code)
Create an LLk analyzer




Method Detail
FOLLOW
public Lookahead FOLLOW(int k, RuleEndElement end)(Code)
Compute the lookahead set of whatever follows references to the rule associated witht the FOLLOW block.



altUsesWildcardDefault
protected boolean altUsesWildcardDefault(Alternative alt)(Code)
Return true if someone used the '.' wildcard default idiom. Either #(. children) or '.' as an alt by itself.



deterministic
public boolean deterministic(AlternativeBlock blk)(Code)
Is this block of alternatives LL(k)? Fill in alternative cache for this block. true if the block is deterministic



deterministic
public boolean deterministic(OneOrMoreBlock blk)(Code)
Is (...)+ block LL(1)? Fill in alternative cache for this block. true if the block is deterministic



deterministic
public boolean deterministic(ZeroOrMoreBlock blk)(Code)
Is (...)* block LL(1)? Fill in alternative cache for this block. true if the block is deterministic



deterministicImpliedPath
public boolean deterministicImpliedPath(BlockWithImpliedExitPath blk)(Code)
Is this (...)* or (...)+ block LL(k)? true if the block is deterministic



look
public Lookahead look(int k, ActionElement action)(Code)
Actions are ignored



look
public Lookahead look(int k, AlternativeBlock blk)(Code)
Combine the lookahead computed for each alternative



look
public Lookahead look(int k, BlockEndElement end)(Code)
Compute what follows this place-holder node and possibly what begins the associated loop unless the node is locked.

if we hit the end of a loop, we have to include what tokens can begin the loop as well. If the start node is locked, then we simply found an empty path through this subrule while analyzing it. If the start node is not locked, then this node was hit during a FOLLOW operation and the FIRST of this block must be included in that lookahead computation.




look
public Lookahead look(int k, CharLiteralElement atom)(Code)
Return this char as the lookahead if k=1.

### Doesn't work for ( 'a' 'b' | 'a' ~'b' ) yet!!!

If the atom has the not flag on, then create the set complement of the tokenType which is the set of all characters referenced in the grammar with this char turned off. Also remove characters from the set that are currently allocated for predicting previous alternatives. This avoids ambiguity messages and is more properly what is meant. ( 'a' | ~'a' ) implies that the ~'a' is the "else" clause.

NOTE: we do NOT include exit path in the exclusion set. E.g., ( 'a' | ~'a' )* 'b' should exit upon seeing a 'b' during the loop.




look
public Lookahead look(int k, CharRangeElement r)(Code)



look
public Lookahead look(int k, GrammarAtom atom)(Code)



look
public Lookahead look(int k, OneOrMoreBlock blk)(Code)
The lookahead of a (...)+ block is the combined lookahead of all alternatives and, if an empty path is found, the lookahead of what follows the block.



look
public Lookahead look(int k, RuleBlock blk)(Code)
Combine the lookahead computed for each alternative. Lock the node so that no other computation may come back on itself--infinite loop. This also implies infinite left-recursion in the grammar (or an error in this algorithm ;)).



look
public Lookahead look(int k, RuleEndElement end)(Code)
If not locked or noFOLLOW set, compute FOLLOW of a rule.

TJP says 8/12/99: not true anymore: Lexical rules never compute follow. They set epsilon and the code generator gens code to check for any character. The code generator must remove the tokens used to predict any previous alts in the same block.

When the last node of a rule is reached and noFOLLOW, it implies that a "local" FOLLOW will be computed after this call. I.e.,

 a : b A;
 b : B | ;
 c : b C;
 
Here, when computing the look of rule b from rule a, we want only {B,EPSILON_TYPE} so that look(b A) will be {B,A} not {B,A,C}.

if the end block is not locked and the FOLLOW is wanted, the algorithm must compute the lookahead of what follows references to this rule. If end block is locked, FOLLOW will return an empty set with a cycle to the rule associated with this end block.




look
public Lookahead look(int k, RuleRefElement rr)(Code)
Compute the lookahead contributed by a rule reference.

When computing ruleref lookahead, we don't want the FOLLOW computation done if an empty path exists for the rule. The FOLLOW is too loose of a set...we want only to include the "local" FOLLOW or what can follow this particular ref to the node. In other words, we use context information to reduce the complexity of the analysis and strengthen the parser. The noFOLLOW flag is used as a means of restricting the FOLLOW to a "local" FOLLOW. This variable is orthogonal to the lock variable that prevents infinite recursion. noFOLLOW does not care about what k is.




look
public Lookahead look(int k, StringLiteralElement atom)(Code)



look
public Lookahead look(int k, SynPredBlock blk)(Code)
The lookahead of a (...)=> block is the lookahead of what follows the block. By definition, the syntactic predicate block defies static analysis (you want to try it out at run-time). The LOOK of (a)=>A B is A for LL(1) ### is this even called?



look
public Lookahead look(int k, TokenRangeElement r)(Code)



look
public Lookahead look(int k, TreeElement t)(Code)



look
public Lookahead look(int k, WildcardElement wc)(Code)



look
public Lookahead look(int k, ZeroOrMoreBlock blk)(Code)
The (...)* element is the combined lookahead of the alternatives and what can follow the loop.



look
public Lookahead look(int k, String rule)(Code)
Compute the combined lookahead for all productions of a rule. If the lookahead returns with epsilon, at least one epsilon path exists (one that consumes no tokens). The noFOLLOW flag being set for this endruleblk, indicates that the a rule ref invoked this rule. Currently only look(RuleRef) calls this. There is no need for the code generator to call this.



lookaheadEquivForApproxAndFullAnalysis
public static boolean lookaheadEquivForApproxAndFullAnalysis(Lookahead[] bset, int k)(Code)
If the first k-1 sets are singleton sets, the appoximate lookahead analysis is equivalent to full lookahead analysis.



setGrammar
public void setGrammar(Grammar g)(Code)
Set the grammar for the analyzer



subruleCanBeInverted
public boolean subruleCanBeInverted(AlternativeBlock blk, boolean forLexer)(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.