PerCederberg.Grammatica.Parser
Class Automaton
System.Object
|
+--Automaton
in Tokenizer.cs
- class Automaton
- extends System.Object
A deterministic finite automaton. This is a simple automaton
for character sequences. It cannot handle character set state
transitions, but only supports single character transitions.
Constructor Summary |
Automaton()
Creates a new empty automaton. |
Method Summary |
void |
AddMatch( string str, object value )
Adds a string match to this automaton. |
object |
MatchFrom( StringTokenMatcher m, string str, int pos )
Checks if the automaton matches the tokenizer buffer from
the specified position. |
Automaton
public Automaton();
- Creates a new empty automaton.
AddMatch
public void AddMatch( string str, object value );
- Adds a string match to this automaton. New states and
transitions will be added to extend this automaton to
support the specified string.
- Parameters:
str
- the string to match
value
- the match value
MatchFrom
public object MatchFrom( StringTokenMatcher m, string str, int pos );
- Checks if the automaton matches the tokenizer buffer from
the specified position. This method will set the end of
buffer flag in the specified token matcher if the end of
buffer is reached.
- Parameters:
m
- the string token matcher
str
- the string to match
pos
- the starting position
- Returns:
- the match value, or
null if no match is found