DFA Class

Namespace: Stimulsoft.Data.Expressions.Antlr.Runtime

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.

Constructors

Constructor Description
constructor()  

constructor()

Methods

Method Returns Description
debugRecognitionException void  
error void A hook for debugging interface
noViableAlt void  
predict number 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.
specialStateTransitionDefault static number  
unpackEncodedString static number[] 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. :(
unpackEncodedStringToUnsignedChars static string[] Hideous duplication of code, but I need different typed arrays out :(

Method Details

debugRecognitionException

debugRecognitionException(ex: RecognitionException): void

Parameters

  • ex (RecognitionException)

error

error(nvae: NoViableAltException): void

A hook for debugging interface

Parameters

  • nvae (NoViableAltException)

noViableAlt

noViableAlt(s: number, input: IIntStream): void

Parameters


predict

predict(input: IIntStream): number

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 number


specialStateTransitionDefault static

specialStateTransitionDefault(dfa: DFA, s: number, input: IIntStream): number

Parameters

Returns number


unpackEncodedString static

unpackEncodedString(encodedString: string): number[]

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)

Returns number[]


unpackEncodedStringToUnsignedChars static

unpackEncodedStringToUnsignedChars(encodedString: string): string[]

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

Parameters

  • encodedString (string)

Returns string[]

Fields

Field Type Description
accept number[]  
debug any  
decisionNumber number  
description any  
eof number[]  
eot number[]  
max string[]  
min string[]  
recognizer BaseRecognizer Which recognizer encloses this DFA? Needed to check backtracking
s any  
s any  
s any  
special number[]  
transition number[][]