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.
protected var accept:Array
protected var decisionNumber:int
description:String
[read-only]Implementation
public function get description():String
protected var eof:Array
protected var eot:Array
public var error:Function
A hook for debugging interface
protected var max:Array
protected var min:Array
protected var recognizer:BaseRecognizer
Which recognizer encloses this DFA? Needed to check backtracking
protected var special:Array
public var specialStateTransition:Function
protected var transition:Array
public function DFA(recognizer:BaseRecognizer, decisionNumber:int, description:String, eot:Array, eof:Array, min:Array, max:Array, accept:Array, special:Array, transition:Array, specialStateTransitionFunction:Function = null, errorFunction:Function = null)
Parameters
| recognizer:BaseRecognizer |
|
| decisionNumber:int |
|
| description:String |
|
| eot:Array |
|
| eof:Array |
|
| min:Array |
|
| max:Array |
|
| accept:Array |
|
| special:Array |
|
| transition:Array |
|
| specialStateTransitionFunction:Function (default = null )
|
|
| errorFunction:Function (default = null )
|
protected function noViableAlt(s:int, input:IntStream):void
Parameters
public function predict(input:IntStream):int
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.
Parameters
Returns
public static function unpackEncodedString(encodedString:String, unsigned:Boolean = false):Array
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. :(
Parameters
| encodedString:String |
|
| unsigned:Boolean (default = false )
|
Returns
public static const debug:Boolean = false