Table of Contents

Class Matcher

Namespace
NMF.AnyText
Assembly
NMF.AnyText.Core.dll

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

IEnumerable<RuleApplication>

Methods

Apply(TextEdit)

Removes any memoization based on the given text edit and updates the memo table

public void Apply(TextEdit edit)

Parameters

edit TextEdit

The 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 ParsePosition

the 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 ParsePosition

the start position

targetPosition ParsePosition

the 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 ParseContext

The 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 ParsePosition

the 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()