Class Lexer<TLexerState>
General lexer. It produces tokens from given text.
Inheritance
System.Object
Lexer<TLexerState>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: SpiceSharpParser.Lexers
Assembly: SpiceSharpParser.dll
Syntax
public class Lexer<TLexerState>
where TLexerState : LexerState
Type Parameters
Name | Description |
---|---|
TLexerState | Type of lexer state. |
Constructors
| Improve this Doc View SourceLexer(LexerGrammar<TLexerState>)
Initializes a new instance of the Lexer<TLexerState> class.
Declaration
public Lexer(LexerGrammar<TLexerState> grammar)
Parameters
Type | Name | Description |
---|---|---|
LexerGrammar<TLexerState> | grammar | Lexer grammar. |
Properties
| Improve this Doc View SourceGrammar
Gets lexer grammar.
Declaration
protected LexerGrammar<TLexerState> Grammar { get; }
Property Value
Type | Description |
---|---|
LexerGrammar<TLexerState> |
Methods
| Improve this Doc View SourceGetTokens(String, TLexerState)
Gets tokens for grammar.
Declaration
public LexerResult GetTokens(string text, TLexerState state = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | A text for which tokens will be returned. |
TLexerState | state | A state for lexer. |
Returns
Type | Description |
---|---|
LexerResult | An enumerable of tokens. |