Package jflex.core
Class RegExps
- java.lang.Object
-
- jflex.core.RegExps
-
public class RegExps extends java.lang.Object
Stores all rules of the specification for later access in the RegExp to NFA conversion.- Version:
- JFlex 1.8.2
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<Action>
actions
the action of a regexpprivate java.util.List<java.lang.Boolean>
BOL
flag if it is a BOL regexp(package private) int
gen_look_count
Count of how many general lookahead expressions there are.private java.util.List<java.lang.Integer>
lines
the spec line in which a regexp is usedprivate java.util.List<RegExp>
look
the lookahead expressionprivate java.util.List<java.lang.Integer>
look_entry
the forward DFA entry point of the lookahead expressionprivate java.util.List<RegExp>
regExps
the regexpprivate java.util.List<java.util.List<java.lang.Integer>>
states
the lexical states in which 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.void
dump()
Print the list of regExps to Out.dumpAction
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 fieldstates
.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).void
makeCCLs(CharClasses classes, boolean caseless)
Make character class partitions for all classes mentioned in the spec.int
NFASize(Macros macros)
NFASize.void
normalise(Macros m)
Normalise all character class expressions in regexp and lookahead rules.
-
-
-
Field Detail
-
lines
private final java.util.List<java.lang.Integer> lines
the spec line in which a regexp is used
-
states
private final java.util.List<java.util.List<java.lang.Integer>> states
the lexical states in which the regexp is used
-
regExps
private java.util.List<RegExp> regExps
the regexp
-
actions
private final java.util.List<Action> actions
the action of a regexp
-
BOL
private final java.util.List<java.lang.Boolean> BOL
flag if it is a BOL regexp
-
look
private java.util.List<RegExp> look
the lookahead expression
-
look_entry
private final 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 how many general lookahead expressions there are. Need 2*gen_look_count additional DFA entry points.
-
-
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.
-
insert
public int insert(java.util.List<java.lang.Integer> stateList, Action action)
insert.- Parameters:
stateList
- aList
object.action
- aAction
object.- Returns:
- a int.
-
addStates
public void addStates(int regNum, java.util.List<java.lang.Integer> newStates)
addStates.- Parameters:
regNum
- a int.newStates
- aList
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 fieldstates
.- 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
- aMacros
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 RegExpsNeeds 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.
-
normalise
public void normalise(Macros m)
Normalise all character class expressions in regexp and lookahead rules.
-
dump
public void dump()
Print the list of regExps to Out.dump
-
makeCCLs
public void makeCCLs(CharClasses classes, boolean caseless)
Make character class partitions for all classes mentioned in the spec.Assumes that single characters and strings have already been handled.
Assumes normalised expressions.
-
-