public class FASerializer extends Object
Modifier and Type | Field and Description |
---|---|
protected Grammar |
grammar |
protected Set<State> |
markedStates
To prevent infinite recursion when walking state machines, record
which states we've visited.
|
protected int |
stateCounter
Each state we walk will get a new state number for serialization
purposes.
|
protected Map<State,Integer> |
stateNumberTranslator
Rather than add a new instance variable to NFA and DFA just for
serializing machines, map old state numbers to new state numbers
by a State object → Integer new state number HashMap.
|
Constructor and Description |
---|
FASerializer(Grammar grammar)
This aspect is associated with a grammar; used to get token names
|
Modifier and Type | Method and Description |
---|---|
String |
serialize(State s) |
String |
serialize(State s,
boolean renumber)
Return a string representation of a state machine.
|
protected void |
walkFANormalizingStateNumbers(State s)
In stateNumberTranslator, get a map from State to new, normalized
state number.
|
protected void |
walkSerializingFA(List<String> lines,
State s) |
protected Set<State> markedStates
protected int stateCounter
protected Map<State,Integer> stateNumberTranslator
protected Grammar grammar
public FASerializer(Grammar grammar)
public String serialize(State s, boolean renumber)
protected void walkFANormalizingStateNumbers(State s)
Copyright © 1992–2015 ANTLR. All rights reserved.