IRule
Description
- Derived from
- Extended by
-
IGrammarRule
Rule abstract
Base interface for classes that represent parser rules that match zero or more input tokens.
Public / Methods
CanMatch
Checks if it is possible that this rule will try to match the given rule in at the current parse position.
CollectReferencedRules
Collects all IGrammarRules that are referenced by this rule or any of its descendants.
Except
Returns a rule that matches the input only if this rule matches but the given exception rule does not.
List
Returns a rule that matches a non-empty list of elements (matched by this rule) that are delimited by the given rule.
Many
Returns a rule that matches this rule n
times, where n
lies in the range [minOccurs..maxOccurs]
.
Match
2 overloads
Tries to match the given input tokens.
When this method returns false
, the state of the given parser context will have remained unchanged.
Tries to match the given character.
This method is useful for matching single token rules.
Peek
Returns a rule that check if this rule matches the subsequent input, without updating the parser context.
ToGrammarAst
Transforms this rule into a AST grammar rule (according to RuleToSourceFlags.GrammarAst).
Public / Attributes
CanMatchEmpty
Can this rule match empty input?
This property will return true
iff this rule may return true
from Match1, without having incremented the current parse position (see ParserContext.Position), while not being at the end of input (see ParserContext.IsEof).
IsTerminal
Is this a terminal rule?
A terminal rule performs flat matching of the input characters, without any further rule recursion. This is not to be confused with RulePrecedence.Terminal, which indicates the precedence of rules in their grammar.
Extensions
ReplaceUnmatchedChars
Replaces all sequences of unmatched characters in the given string value with the specified replacement character.
Each character of value in is matched individually using IRule.Match2.