Matcher
A matcher check the sequence of characters in a string to build a special kind of token. But sometimes you don't want to build tokens but you wanna seperate them or ignore phrases. This can be done by implementing an IgnoreMatcher. The ignore matcher advances the lexer to a certain position without building a token.
The lexer provides several default methods for ignoring characters or matching specific kinds of tokens with various configuration options. Here is a list of all methods:The lexer provides several default methods for ignoring characters or matching specific kinds of tokens with various configuration options. Here is a list of all methods:
Method | Description | Example |
---|---|---|
AddSymbols | Add Symbols like punctuators or operators | lexer.AddSymbols(":", ".") |
AddKeywords | Add keywords to be recognized by syntax highligthing. Keywords will be treated as symbols. | lexer.AddKeywords("let", "mut") |
Only symbols that are not recoginition symbols of parselets have to be explicitly added to the lexer.
Last updated