org.antlr.runtime.DFA Class Reference

Collaboration diagram for org.antlr.runtime.DFA:

Collaboration graph
[legend]

List of all members.

Public Member Functions

int predict (IntStream input) throws RecognitionException
int specialStateTransition (int s, IntStream input) throws NoViableAltException
String getDescription ()

Static Public Member Functions

static short[] unpackEncodedString (String encodedString)
static char[] unpackEncodedStringToUnsignedChars (String encodedString)

Static Public Attributes

static final boolean debug = false

Protected Member Functions

void noViableAlt (int s, IntStream input) throws NoViableAltException
void error (NoViableAltException nvae)

Protected Attributes

short[] eot
short[] eof
char[] min
char[] max
short[] accept
short[] special
short[][] transition
int decisionNumber
BaseRecognizer recognizer


Detailed Description

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.

Definition at line 41 of file DFA.java.


Member Function Documentation

int org.antlr.runtime.DFA.predict ( IntStream  input  )  throws RecognitionException

From the input stream, predict what alternative will succeed using this DFA (representing the covering regular approximation to the underlying CFL). Return an alternative number 1..n. Throw an exception upon error.

Definition at line 62 of file DFA.java.

void org.antlr.runtime.DFA.noViableAlt ( int  s,
IntStream  input 
) throws NoViableAltException [protected]

Definition at line 153 of file DFA.java.

void org.antlr.runtime.DFA.error ( NoViableAltException  nvae  )  [protected]

A hook for debugging interface

Definition at line 168 of file DFA.java.

int org.antlr.runtime.DFA.specialStateTransition ( int  s,
IntStream  input 
) throws NoViableAltException

Definition at line 170 of file DFA.java.

String org.antlr.runtime.DFA.getDescription (  ) 

Definition at line 176 of file DFA.java.

static short [] org.antlr.runtime.DFA.unpackEncodedString ( String  encodedString  )  [static]

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}. We do this to avoid static short[] which generates so much init code that the class won't compile. :(

Definition at line 185 of file DFA.java.

static char [] org.antlr.runtime.DFA.unpackEncodedStringToUnsignedChars ( String  encodedString  )  [static]

Hideous duplication of code, but I need different typed arrays out :(

Definition at line 205 of file DFA.java.


Member Data Documentation

short [] org.antlr.runtime.DFA.eot [protected]

Definition at line 42 of file DFA.java.

short [] org.antlr.runtime.DFA.eof [protected]

Definition at line 43 of file DFA.java.

char [] org.antlr.runtime.DFA.min [protected]

Definition at line 44 of file DFA.java.

char [] org.antlr.runtime.DFA.max [protected]

Definition at line 45 of file DFA.java.

short [] org.antlr.runtime.DFA.accept [protected]

Definition at line 46 of file DFA.java.

short [] org.antlr.runtime.DFA.special [protected]

Definition at line 47 of file DFA.java.

short [][] org.antlr.runtime.DFA.transition [protected]

Definition at line 48 of file DFA.java.

Definition at line 50 of file DFA.java.

Which recognizer encloses this DFA? Needed to check backtracking

Definition at line 53 of file DFA.java.

final boolean org.antlr.runtime.DFA.debug = false [static]

Definition at line 55 of file DFA.java.


The documentation for this class was generated from the following file:

Generated on Tue Jul 19 11:42:02 2011 for ANTLR API by  doxygen 1.5.5