Package jflex

Class RegExps


  • public class RegExps
    extends java.lang.Object
    Stores all rules of the specification for later access in RegExp -> NFA
    Version:
    JFlex 1.7.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.util.List<Action> actions
      the action of a regexp
      (package private) java.util.List<java.lang.Boolean> BOL
      flag if it is a BOL regexp
      (package private) int gen_look_count
      Count of many general lookahead expressions there are.
      (package private) java.util.List<java.lang.Integer> lines
      the spec line in which a regexp is used
      (package private) java.util.List<RegExp> look
      the lookahead expression
      (package private) java.util.List<java.lang.Integer> look_entry
      the forward DFA entry point of the lookahead expression
      (package private) java.util.List<RegExp> regExps
      the regexp
      (package private) java.util.List<java.util.List<java.lang.Integer>> states
      the lexical states in wich the regexp is used
    • Constructor Summary

      Constructors 
      Constructor Description
      RegExps()
      Constructor for RegExps.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addStates​(int regNum, java.util.List<java.lang.Integer> newStates)
      addStates.
      void checkActions()
      checkActions.
      void checkLookAheads()
      checkLookAheads.
      Action getAction​(int num)
      getAction.
      int getLine​(int num)
      getLine.
      RegExp getLookAhead​(int num)
      getLookAhead.
      int getLookEntry​(int num)
      getLookEntry.
      int getNum()
      getNum.
      RegExp getRegExp​(int num)
      getRegExp.
      java.util.List<java.lang.Integer> getStates​(int num)
      Getter for the field states.
      int insert​(int line, java.util.List<java.lang.Integer> stateList, RegExp regExp, Action action, java.lang.Boolean isBOL, RegExp lookAhead)
      insert.
      int insert​(java.util.List<java.lang.Integer> stateList, Action action)
      insert.
      boolean isBOL​(int num)
      isBOL.
      boolean isEOF​(int num)
      isEOF.
      private void lookAheadCase​(int regExpNum)
      Determine which case of lookahead expression regExpNum points to (if any).
      int NFASize​(Macros macros)
      NFASize.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • lines

        java.util.List<java.lang.Integer> lines
        the spec line in which a regexp is used
      • states

        java.util.List<java.util.List<java.lang.Integer>> states
        the lexical states in wich the regexp is used
      • regExps

        java.util.List<RegExp> regExps
        the regexp
      • actions

        java.util.List<Action> actions
        the action of a regexp
      • BOL

        java.util.List<java.lang.Boolean> BOL
        flag if it is a BOL regexp
      • look

        java.util.List<RegExp> look
        the lookahead expression
      • look_entry

        java.util.List<java.lang.Integer> look_entry
        the forward DFA entry point of the lookahead expression
      • gen_look_count

        int gen_look_count
        Count of many general lookahead expressions there are. Need 2*gen_look_count additional DFA entry points.
    • Constructor Detail

      • RegExps

        public RegExps()
        Constructor for RegExps.
    • Method Detail

      • insert

        public int insert​(int line,
                          java.util.List<java.lang.Integer> stateList,
                          RegExp regExp,
                          Action action,
                          java.lang.Boolean isBOL,
                          RegExp lookAhead)
        insert.
        Parameters:
        line - a int.
        stateList - a List object.
        regExp - a RegExp object.
        action - a Action object.
        isBOL - a Boolean object.
        lookAhead - a RegExp object.
        Returns:
        a int.
      • insert

        public int insert​(java.util.List<java.lang.Integer> stateList,
                          Action action)
        insert.
        Parameters:
        stateList - a List object.
        action - a Action object.
        Returns:
        a int.
      • addStates

        public void addStates​(int regNum,
                              java.util.List<java.lang.Integer> newStates)
        addStates.
        Parameters:
        regNum - a int.
        newStates - a List object.
      • getNum

        public int getNum()
        getNum.
        Returns:
        a int.
      • isBOL

        public boolean isBOL​(int num)
        isBOL.
        Parameters:
        num - a int.
        Returns:
        a boolean.
      • getLookAhead

        public RegExp getLookAhead​(int num)
        getLookAhead.
        Parameters:
        num - a int.
        Returns:
        a RegExp object.
      • isEOF

        public boolean isEOF​(int num)
        isEOF.
        Parameters:
        num - a int.
        Returns:
        a boolean.
      • getStates

        public java.util.List<java.lang.Integer> getStates​(int num)
        Getter for the field states.
        Parameters:
        num - a int.
        Returns:
        a List object.
      • getRegExp

        public RegExp getRegExp​(int num)
        getRegExp.
        Parameters:
        num - a int.
        Returns:
        a RegExp object.
      • getLine

        public int getLine​(int num)
        getLine.
        Parameters:
        num - a int.
        Returns:
        a int.
      • getLookEntry

        public int getLookEntry​(int num)
        getLookEntry.
        Parameters:
        num - a int.
        Returns:
        a int.
      • checkActions

        public void checkActions()
        checkActions.
      • getAction

        public Action getAction​(int num)
        getAction.
        Parameters:
        num - a int.
        Returns:
        a Action object.
      • NFASize

        public int NFASize​(Macros macros)
        NFASize.
        Parameters:
        macros - a Macros object.
        Returns:
        a int.
      • checkLookAheads

        public void checkLookAheads()
        checkLookAheads.
      • lookAheadCase

        private void lookAheadCase​(int regExpNum)
        Determine which case of lookahead expression regExpNum points to (if any). Set case data in corresponding action. Increment count of general lookahead expressions for entry points of the two additional DFAs. Register DFA entry point in RegExps

        Needs to be run before adding any regexps/rules to be able to reserve the correct amount of space of lookahead DFA entry points.

        Parameters:
        regExpNum - the number of the regexp in RegExps.