PerCederberg.Grammatica.Runtime
Class RegExpMatcher
System.Object
|
+--TokenMatcher
|
+--RegExpMatcher
in Tokenizer.cs
- internal class RegExpMatcher
- extends TokenMatcher
A token pattern matcher for complex regular expressions. This
class only supports regular expression tokens and must be
complemented with another matcher for string tokens.
Internally it uses the Grammatica RE package for high
performance or the native java.util.regex package for maximum
compatibility.
|
Constructor Summary |
RegExpMatcher( bool ignoreCase )
Creates a new regular expression token matcher. |
|
Method Summary |
override void |
AddPattern( TokenPattern pattern )
Adds a regular expression token pattern to this matcher. |
override void |
Match( ReaderBuffer buffer, TokenMatch match )
Searches for matching token patterns at the start of the
input stream. |
RegExpMatcher
public RegExpMatcher( bool ignoreCase );
- Creates a new regular expression token matcher.
- Parameters:
ignoreCase - the character case ignore flag
AddPattern
public override void AddPattern( TokenPattern pattern );
- Adds a regular expression token pattern to this matcher.
- Parameters:
pattern - the pattern to add
- Throws:
Exception - if the pattern couldn't be added to the matcher
Match
public override void Match( ReaderBuffer buffer, TokenMatch match );
- Searches for matching token patterns at the start of the
input stream. If a match is found, the token match object
is updated.
- Parameters:
buffer - the input buffer to check
match - the token match to update
- Throws:
IOException - if an I/O error occurred