public class NFAContext extends Object
Modifier and Type | Field | Description |
---|---|---|
protected int |
cachedHashCode |
Computing the hashCode is very expensive and closureBusy()
uses it to track when it's seen a state|ctx before to avoid
infinite loops.
|
NFAState |
invokingState |
The NFA state that invoked another rule's start state is recorded
on the rule invocation context stack.
|
static int |
MAX_SAME_RULE_INVOCATIONS_PER_NFA_CONFIG_STACK |
This is similar to Bermudez's m constant in his LAR(m) where
you bound the stack so your states don't explode.
|
NFAContext |
parent |
Constructor | Description |
---|---|
NFAContext(NFAContext parent,
NFAState invokingState) |
Modifier and Type | Method | Description |
---|---|---|
boolean |
conflictsWith(NFAContext other) |
Two contexts conflict() if they are equals() or one is a stack suffix
of the other.
|
boolean |
equals(Object o) |
Two contexts are equals() if both have
same call stack; walk upwards to the root.
|
int |
hashCode() |
|
boolean |
isEmpty() |
A context is empty if there is no parent; meaning nobody pushed
anything on the call stack.
|
int |
recursionDepthEmanatingFromState(int state) |
Given an NFA state number, how many times has the NFA-to-DFA
conversion pushed that state on the stack? In other words,
the NFA state must be a rule invocation state and this method
tells you how many times you've been to this state.
|
protected boolean |
suffix(NFAContext other) |
[$] suffix any context
[21 $] suffix [21 12 $]
[21 12 $] suffix [21 $]
[21 18 $] suffix [21 18 12 9 $]
[21 18 12 9 $] suffix [21 18 $]
[21 12 $] not suffix [21 9 $]
Example "[21 $] suffix [21 12 $]" means: rule r invoked current rule
from state 21.
|
String |
toString() |
public static int MAX_SAME_RULE_INVOCATIONS_PER_NFA_CONFIG_STACK
public NFAContext parent
public NFAState invokingState
protected int cachedHashCode
public NFAContext(NFAContext parent, NFAState invokingState)
public boolean equals(Object o)
public boolean conflictsWith(NFAContext other)
protected boolean suffix(NFAContext other)
public int recursionDepthEmanatingFromState(int state)
public boolean isEmpty()
Copyright © 1992–2019 ANTLR. All rights reserved.