Show / Hide Table of Contents

Class LexerTokenRule<TLexerState>

The lexer token rule class. It defines how and when a token will be generated for given regular expression pattern.

Inheritance
System.Object
LexerRegexRule
LexerTokenRule<TLexerState>
Inherited Members
LexerRegexRule.IgnoreCase
LexerRegexRule.Name
LexerRegexRule.RegularExpressionPattern
LexerRegexRule.RegularExpression
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 LexerTokenRule<TLexerState> : LexerRegexRule where TLexerState : LexerState
Type Parameters
Name Description
TLexerState

Type of lexer state.

Constructors

| Improve this Doc View Source

LexerTokenRule(Int32, String, String, Func<TLexerState, String, LexerRuleReturnDecision>, Func<TLexerState, String, LexerRuleUseDecision>, Boolean, Boolean)

Initializes a new instance of the LexerTokenRule<TLexerState> class.

Declaration
public LexerTokenRule(int tokenType, string ruleName, string regularExpressionPattern, Func<TLexerState, string, LexerRuleReturnDecision> returnDecisionProvider = null, Func<TLexerState, string, LexerRuleUseDecision> useDecisionProvider = null, bool ignoreCase = true, bool topRule = false)
Parameters
Type Name Description
System.Int32 tokenType

Token type.

System.String ruleName

Rule name.

System.String regularExpressionPattern

A token rule pattern.

System.Func<TLexerState, System.String, LexerRuleReturnDecision> returnDecisionProvider

A token rule return decision provider.

System.Func<TLexerState, System.String, LexerRuleUseDecision> useDecisionProvider

A token rule use decision provider.

System.Boolean ignoreCase

Ignore case.

System.Boolean topRule

Is most important rule.

Properties

| Improve this Doc View Source

ReturnDecisionProvider

Gets the provider that tells whether the rule should be returned.

Declaration
public Func<TLexerState, string, LexerRuleReturnDecision> ReturnDecisionProvider { get; }
Property Value
Type Description
System.Func<TLexerState, System.String, LexerRuleReturnDecision>
| Improve this Doc View Source

TokenType

Gets the type of a generated token.

Declaration
public int TokenType { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

TopRule

Gets the value indicating whether rule is most important.

Declaration
public bool TopRule { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

UseDecisionProvider

Gets the provider that tells whether the rule should be used.

Declaration
public Func<TLexerState, string, LexerRuleUseDecision> UseDecisionProvider { get; }
Property Value
Type Description
System.Func<TLexerState, System.String, LexerRuleUseDecision>

Methods

| Improve this Doc View Source

CanUse(TLexerState, String)

Returns true if the rule is active or should be skipped.

Declaration
public bool CanUse(TLexerState lexerState, string lexem)
Parameters
Type Name Description
TLexerState lexerState

The current lexer state.

System.String lexem

A lexem value.

Returns
Type Description
System.Boolean

True if the lexer token rule is active or should be skipped.

| Improve this Doc View Source

Clone()

Clones the rule.

Declaration
public override LexerRegexRule Clone()
Returns
Type Description
LexerRegexRule

A clone of rule.

Overrides
LexerRegexRule.Clone()
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX