Package org.javacc.parser
Class NfaState
- java.lang.Object
-
- org.javacc.parser.NfaState
-
class NfaState extends java.lang.ObjectThe state of a Non-deterministic Finite Automaton.
-
-
Field Summary
Fields Modifier and Type Field Description private long[]asciiMoves(package private) char[]charMovesprivate booleanclosureDoneprivate int[]compositeStatesprivate java.util.Set<NfaState>compositeStateSetprivate NfaState[]epsilonMoveArray(package private) java.util.Vector<NfaState>epsilonMovesprivate java.lang.StringepsilonMovesStringprivate intid(package private) intinNextOfprivate booleanisComposite(package private) booleanisFinal(package private) intkindprivate intkindToPrintprivate LexerContextlexerContextprivate intlexStateprivate intlookingForprivate charmatchSingleChar(package private) NfaStatenextprivate intonlyCharprivate char[]rangeMoves(package private) intstateNameprivate intusefulEpsilonMoves
-
Constructor Summary
Constructors Constructor Description NfaState(LexerContext lexerContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidAddASCIIMove(char c)(package private) voidAddChar(char c)private static intAddCompositeStateSet(java.lang.String stateSetString, LexerContext lexerContext, boolean starts)(package private) voidAddMove(NfaState newState)(package private) voidAddRange(char left, char right)(package private) static intAddStartStateSet(java.lang.String stateSetString, LexerContext lexerContext)(package private) static voidBuildTokenizerData(TokenizerData tokenizerData, LexerContext lexerContext)private booleanCanMoveUsingChar(char c)(package private) static voidComputeClosures(LexerContext lexerContext)private NfaStateCreateClone()private NfaStateCreateEquivState(java.util.List<NfaState> states)private static intElemOccurs(int elem, int[] arr)private voidEpsilonClosure()This function computes the closure and also updates the kind so that any time there is a move to this state, it can go on epsilon to a new state in the epsilon moves that might have a lower kind of token number for the same length.private static booleanEqualCharArr(char[] arr1, char[] arr2)private static char[]ExpandCharArr(char[] oldArr, int incr)(package private) voidGenerateCode()(package private) intGenerateInitMoves()private voidGenerateNextStatesCode()private java.lang.StringGetEpsilonMovesString()private NfaStateGetEquivalentRunTimeState()(package private) static NfaStategetNfaState(int index, LexerContext lexerContext)(package private) static java.lang.StringGetStateSetString(java.util.List<NfaState> states, LexerContext lexerContext)private booleanHasTransitions()private static voidInsertInOrder(java.util.List<NfaState> v, NfaState s)private static booleanIntersect(java.lang.String set1, java.lang.String set2, LexerContext lexerContext)private voidMergeMoves(NfaState other)private intMoveFrom(char c, java.util.List<NfaState> newStates)(package private) static intMoveFromSet(char c, java.util.List<NfaState> states, java.util.List<NfaState> newStates)private voidOptimizeEpsilonMoves(boolean optReqd, LexerContext lexerContext)(package private) static voidUpdateNfaData(int maxState, int startStateName, int lexicalStateIndex, int matchAnyCharKind, LexerContext lexerContext)private booleanUsefulState()
-
-
-
Field Detail
-
asciiMoves
private final long[] asciiMoves
-
rangeMoves
private char[] rangeMoves
-
epsilonMovesString
private java.lang.String epsilonMovesString
-
epsilonMoveArray
private NfaState[] epsilonMoveArray
-
id
private final int id
-
lexerContext
private final LexerContext lexerContext
-
lookingFor
private int lookingFor
-
usefulEpsilonMoves
private int usefulEpsilonMoves
-
lexState
private int lexState
-
kindToPrint
private int kindToPrint
-
isComposite
private boolean isComposite
-
compositeStates
private int[] compositeStates
-
compositeStateSet
private final java.util.Set<NfaState> compositeStateSet
-
onlyChar
private int onlyChar
-
matchSingleChar
private char matchSingleChar
-
charMoves
char[] charMoves
-
next
NfaState next
-
epsilonMoves
java.util.Vector<NfaState> epsilonMoves
-
stateName
int stateName
-
kind
int kind
-
inNextOf
int inNextOf
-
isFinal
boolean isFinal
-
closureDone
private boolean closureDone
-
-
Constructor Detail
-
NfaState
public NfaState(LexerContext lexerContext)
-
-
Method Detail
-
CreateClone
private NfaState CreateClone()
-
ExpandCharArr
private static char[] ExpandCharArr(char[] oldArr, int incr)
-
AddMove
void AddMove(NfaState newState)
-
AddASCIIMove
private final void AddASCIIMove(char c)
-
AddChar
void AddChar(char c)
-
AddRange
void AddRange(char left, char right)
-
EqualCharArr
private static boolean EqualCharArr(char[] arr1, char[] arr2)
-
EpsilonClosure
private void EpsilonClosure()
This function computes the closure and also updates the kind so that any time there is a move to this state, it can go on epsilon to a new state in the epsilon moves that might have a lower kind of token number for the same length.
-
UsefulState
private boolean UsefulState()
-
HasTransitions
private boolean HasTransitions()
-
MergeMoves
private void MergeMoves(NfaState other)
-
GetEquivalentRunTimeState
private NfaState GetEquivalentRunTimeState()
-
GenerateCode
void GenerateCode()
-
ComputeClosures
static void ComputeClosures(LexerContext lexerContext)
-
OptimizeEpsilonMoves
private void OptimizeEpsilonMoves(boolean optReqd, LexerContext lexerContext)
-
GenerateNextStatesCode
private void GenerateNextStatesCode()
-
GetEpsilonMovesString
private java.lang.String GetEpsilonMovesString()
-
CanMoveUsingChar
private final boolean CanMoveUsingChar(char c)
-
MoveFrom
private int MoveFrom(char c, java.util.List<NfaState> newStates)
-
MoveFromSet
static int MoveFromSet(char c, java.util.List<NfaState> states, java.util.List<NfaState> newStates)
-
AddStartStateSet
static int AddStartStateSet(java.lang.String stateSetString, LexerContext lexerContext)
-
AddCompositeStateSet
private static int AddCompositeStateSet(java.lang.String stateSetString, LexerContext lexerContext, boolean starts)
-
GenerateInitMoves
int GenerateInitMoves()
-
GetStateSetString
static java.lang.String GetStateSetString(java.util.List<NfaState> states, LexerContext lexerContext)
-
ElemOccurs
private static int ElemOccurs(int elem, int[] arr)
-
Intersect
private static boolean Intersect(java.lang.String set1, java.lang.String set2, LexerContext lexerContext)
-
UpdateNfaData
static void UpdateNfaData(int maxState, int startStateName, int lexicalStateIndex, int matchAnyCharKind, LexerContext lexerContext)
-
BuildTokenizerData
static void BuildTokenizerData(TokenizerData tokenizerData, LexerContext lexerContext)
-
getNfaState
static NfaState getNfaState(int index, LexerContext lexerContext)
-
-