Class NfaState


  • class NfaState
    extends java.lang.Object
    The state of a Non-deterministic Finite Automaton.
    • 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
      • 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
      • epsilonMoves

        java.util.Vector<NfaState> epsilonMoves
      • stateName

        int stateName
      • kind

        int kind
      • inNextOf

        int inNextOf
      • isFinal

        boolean isFinal
      • closureDone

        private boolean closureDone
    • Constructor Detail

    • Method Detail

      • CreateClone

        private NfaState CreateClone()
      • InsertInOrder

        private static void InsertInOrder​(java.util.List<NfaState> v,
                                          NfaState s)
      • 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)
      • CreateEquivState

        private NfaState CreateEquivState​(java.util.List<NfaState> states)
      • 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)