Class Matcher
Denotes a class that matches text using an incremental packrat parser
public class Matcher
- Inheritance
-
Matcher
- Inherited Members
Constructors
Matcher(params CommentRule[])
Creates a new instance
public Matcher(params CommentRule[] comments)
Parameters
comments
CommentRule[]the comment rules
Properties
TrailingComments
Gets a collection of comments found after the last rule application
public IEnumerable<RuleApplication> TrailingComments { get; }
Property Value
Methods
Apply(TextEdit)
Removes any memoization based on the given text edit and updates the memo table
public void Apply(TextEdit edit)
Parameters
edit
TextEditThe change in the input text
GetErrorsExactlyAt(ParsePosition)
Gets a collection of failed rule applications exactly at the given position
public IEnumerable<RuleApplication> GetErrorsExactlyAt(ParsePosition position)
Parameters
position
ParsePositionthe position
Returns
- IEnumerable<RuleApplication>
a collection of rule applications
IsWhiteSpaceTo(ParsePosition, ParsePosition)
Determines whether the input between the given position and the target position only consists of white space
public bool IsWhiteSpaceTo(ParsePosition position, ParsePosition targetPosition)
Parameters
position
ParsePositionthe start position
targetPosition
ParsePositionthe target position
Returns
- bool
true, if there is only white spaces between the given position and the target position, otherwise false
Match(ParseContext)
Matches the provided rule with the given parse context
public RuleApplication Match(ParseContext context)
Parameters
context
ParseContextThe context in which the text is parsed, including the current input
Returns
- RuleApplication
A rule application for the entire text
NextTokenPosition(ParsePosition)
Gets the position of the next token, starting from the given position
public ParsePosition NextTokenPosition(ParsePosition position)
Parameters
position
ParsePositionthe position where to look for the next token
Returns
- ParsePosition
the position of the next token position
Reset()
Resets the memoization table
public void Reset()