public final class NFA
extends java.lang.Object
Contains algorithms RegExp → NFA and NFA → DFA.
Constructor and Description |
---|
NFA(int numInput,
int estSize)
Constructor for NFA.
|
NFA(int numInput,
LexScan scanner,
RegExps regExps,
Macros macros,
CharClasses classes)
Construct new NFA.
|
Modifier and Type | Method and Description |
---|---|
void |
addEpsilonTransition(int start,
int dest)
addEpsilonTransition.
|
void |
addRegExp(int regExpNum)
Add a regexp to this NFA.
|
void |
addStandaloneRule()
Add a standalone rule that has minimum priority, fires a transition on all single input
characters and has a "print yytext" action.
|
void |
addTransition(int start,
int input,
int dest)
addTransition.
|
java.lang.String |
dotFormat()
dotFormat.
|
void |
dumpTable()
dumpTable.
|
DFA |
getDFA()
Returns an DFA that accepts the same language as this NFA.
|
jflex.IntPair |
insertNFA(RegExp regExp)
Constructs an NFA for regExp such that the NFA has
|
int |
numEntryStates()
numEntryStates.
|
java.lang.String |
toString()
toString.
|
void |
writeDot(java.io.File file)
writeDot.
|
public NFA(int numInput, int estSize)
public NFA(int numInput, LexScan scanner, RegExps regExps, Macros macros, CharClasses classes)
Assumes that lookahead cases and numbers are already resolved in RegExps.
numInput
- a int.scanner
- a LexScan
object.regExps
- a RegExps
object.macros
- a Macros
object.classes
- a CharClasses
object.RegExps.checkLookAheads()
public int numEntryStates()
public void addStandaloneRule()
public void addRegExp(int regExpNum)
regExpNum
- the number of the regexp to add.public void addTransition(int start, int input, int dest)
start
- a int.input
- a int.dest
- a int.public void addEpsilonTransition(int start, int dest)
start
- a int.dest
- a int.public DFA getDFA()
DFA
object.public void dumpTable()
public java.lang.String toString()
toString
in class java.lang.Object
String
object.public void writeDot(java.io.File file)
file
- a File
object.public java.lang.String dotFormat()
String
object.public jflex.IntPair insertNFA(RegExp regExp)
exactly one start state, exactly one end state, no transitions leading out of the end state no transitions leading into the start state
regExp
- the regular expression to construct the NFA forCopyright © 1998–2019. All rights reserved.