|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.antlr.runtime.DFA
public class DFA
A DFA implemented as a set of transition tables. Any state that has a semantic predicate edge is special; those states are generated with if-then-else structures in a specialStateTransition() which is generated by cyclicDFA template. There are at most 32767 states (16-bit signed short). Could get away with byte sometimes but would have to generate different types and the simulation code too. For a point of reference, the Java lexer's Tokens rule DFA has 326 states roughly.
Field Summary | |
---|---|
protected short[] |
accept
|
static boolean |
debug
|
protected int |
decisionNumber
|
protected short[] |
eof
|
protected short[] |
eot
|
protected char[] |
max
|
protected char[] |
min
|
protected BaseRecognizer |
recognizer
Which recognizer encloses this DFA? Needed to check backtracking |
protected short[] |
special
|
protected short[][] |
transition
|
Constructor Summary | |
---|---|
DFA()
|
Method Summary | |
---|---|
protected void |
error(NoViableAltException nvae)
A hook for debugging interface |
java.lang.String |
getDescription()
|
protected void |
noViableAlt(int s,
IntStream input)
|
int |
predict(IntStream input)
From the input stream, predict what alternative will succeed using this DFA (representing the covering regular approximation to the underlying CFL). |
int |
specialStateTransition(int s,
IntStream input)
|
static short[] |
unpackEncodedString(java.lang.String encodedString)
Given a String that has a run-length-encoding of some unsigned shorts like "\1\2\3\9", convert to short[] {2,9,9,9}. |
static char[] |
unpackEncodedStringToUnsignedChars(java.lang.String encodedString)
Hideous duplication of code, but I need different typed arrays out :( |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected short[] eot
protected short[] eof
protected char[] min
protected char[] max
protected short[] accept
protected short[] special
protected short[][] transition
protected int decisionNumber
protected BaseRecognizer recognizer
public static final boolean debug
Constructor Detail |
---|
public DFA()
Method Detail |
---|
public int predict(IntStream input) throws RecognitionException
RecognitionException
protected void noViableAlt(int s, IntStream input) throws NoViableAltException
NoViableAltException
protected void error(NoViableAltException nvae)
public int specialStateTransition(int s, IntStream input) throws NoViableAltException
NoViableAltException
public java.lang.String getDescription()
public static short[] unpackEncodedString(java.lang.String encodedString)
public static char[] unpackEncodedStringToUnsignedChars(java.lang.String encodedString)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |