Package org.antlr.analysis
Class LL1Analyzer
java.lang.Object
org.antlr.analysis.LL1Analyzer
Created by IntelliJ IDEA.
User: parrt
Date: Dec 31, 2007
Time: 1:31:16 PM
To change this template use File | Settings | File Templates.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
0 if we hit end of rule and invoker should keep going (epsilon)static final int
1 if we found a nonautobacktracking predstatic final int
2 if we didn't find such a predUsed during LOOK to detect computation cycles -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected int
_detectConfoundingPredicates
(NFAState s, Rule enclosingRule, boolean chaseFollowTransitions) protected LookaheadSet
protected SemanticContext
_getPredicates
(NFAState s, NFAState altStartState) boolean
Is there a non-syn-pred predicate visible from s that is not in the rule enclosing s? This accounts for most predicate situations and lets ANTLR do a simple LL(1)+pred computation.From an NFA state, s, find the set of all labels reachable from s.getPredicates
(NFAState altStartState) Return predicate expression found via epsilon edges from s.
-
Field Details
-
DETECT_PRED_EOR
public static final int DETECT_PRED_EOR0 if we hit end of rule and invoker should keep going (epsilon)- See Also:
-
DETECT_PRED_FOUND
public static final int DETECT_PRED_FOUND1 if we found a nonautobacktracking pred- See Also:
-
DETECT_PRED_NOT_FOUND
public static final int DETECT_PRED_NOT_FOUND2 if we didn't find such a pred- See Also:
-
grammar
-
lookBusy
Used during LOOK to detect computation cycles -
FIRSTCache
-
FOLLOWCache
-
-
Constructor Details
-
LL1Analyzer
-
-
Method Details
-
FIRST
From an NFA state, s, find the set of all labels reachable from s. Used to compute follow sets for error recovery. Never computes a FOLLOW operation. FIRST stops at end of rules, returning EOR, unless invoked from another rule. I.e., routine properly handles a : b A ; where b is nullable. We record with EOR_TOKEN_TYPE if we hit the end of a rule so we can know at runtime (when these sets are used) to start walking up the follow chain to compute the real, correct follow set (as opposed to the FOLLOW, which is a superset). This routine will only be used on parser and tree parser grammars. -
FOLLOW
-
LOOK
-
_FIRST
-
detectConfoundingPredicates
Is there a non-syn-pred predicate visible from s that is not in the rule enclosing s? This accounts for most predicate situations and lets ANTLR do a simple LL(1)+pred computation. TODO: what about gated vs regular preds? -
_detectConfoundingPredicates
-
getPredicates
Return predicate expression found via epsilon edges from s. Do not look into other rules for now. Do something simple. Include backtracking synpreds. -
_getPredicates
-