类 LL1Analyzer
- java.lang.Object
-
- org.antlr.analysis.LL1Analyzer
-
public class LL1Analyzer extends java.lang.Object
Created by IntelliJ IDEA. User: parrt Date: Dec 31, 2007 Time: 1:31:16 PM To change this template use File | Settings | File Templates.
-
-
字段概要
字段 修饰符和类型 字段 说明 static int
DETECT_PRED_EOR
0 if we hit end of rule and invoker should keep going (epsilon)static int
DETECT_PRED_FOUND
1 if we found a nonautobacktracking predstatic int
DETECT_PRED_NOT_FOUND
2 if we didn't find such a predjava.util.Map<NFAState,LookaheadSet>
FIRSTCache
java.util.Map<Rule,LookaheadSet>
FOLLOWCache
Grammar
grammar
protected java.util.Set<NFAState>
lookBusy
Used during LOOK to detect computation cycles
-
构造器概要
构造器 构造器 说明 LL1Analyzer(Grammar grammar)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected int
_detectConfoundingPredicates(NFAState s, Rule enclosingRule, boolean chaseFollowTransitions)
protected LookaheadSet
_FIRST(NFAState s, boolean chaseFollowTransitions)
protected SemanticContext
_getPredicates(NFAState s, NFAState altStartState)
boolean
detectConfoundingPredicates(NFAState s)
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.LookaheadSet
FIRST(NFAState s)
From an NFA state, s, find the set of all labels reachable from s.LookaheadSet
FOLLOW(Rule r)
SemanticContext
getPredicates(NFAState altStartState)
Return predicate expression found via epsilon edges from s.LookaheadSet
LOOK(NFAState s)
-
-
-
字段详细资料
-
DETECT_PRED_EOR
public static final int DETECT_PRED_EOR
0 if we hit end of rule and invoker should keep going (epsilon)- 另请参阅:
- 常量字段值
-
DETECT_PRED_FOUND
public static final int DETECT_PRED_FOUND
1 if we found a nonautobacktracking pred- 另请参阅:
- 常量字段值
-
DETECT_PRED_NOT_FOUND
public static final int DETECT_PRED_NOT_FOUND
2 if we didn't find such a pred- 另请参阅:
- 常量字段值
-
grammar
public Grammar grammar
-
lookBusy
protected java.util.Set<NFAState> lookBusy
Used during LOOK to detect computation cycles
-
FIRSTCache
public java.util.Map<NFAState,LookaheadSet> FIRSTCache
-
FOLLOWCache
public java.util.Map<Rule,LookaheadSet> FOLLOWCache
-
-
构造器详细资料
-
LL1Analyzer
public LL1Analyzer(Grammar grammar)
-
-
方法详细资料
-
FIRST
public LookaheadSet FIRST(NFAState s)
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
public LookaheadSet FOLLOW(Rule r)
-
LOOK
public LookaheadSet LOOK(NFAState s)
-
_FIRST
protected LookaheadSet _FIRST(NFAState s, boolean chaseFollowTransitions)
-
detectConfoundingPredicates
public boolean detectConfoundingPredicates(NFAState s)
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
protected int _detectConfoundingPredicates(NFAState s, Rule enclosingRule, boolean chaseFollowTransitions)
-
getPredicates
public SemanticContext getPredicates(NFAState altStartState)
Return predicate expression found via epsilon edges from s. Do not look into other rules for now. Do something simple. Include backtracking synpreds.
-
_getPredicates
protected SemanticContext _getPredicates(NFAState s, NFAState altStartState)
-
-