Table of Contents

Class LiteralRuleApplication

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

Denotes a rule application that matches a given literal string

public class LiteralRuleApplication : RuleApplication
Inheritance
LiteralRuleApplication
Inherited Members

Constructors

LiteralRuleApplication(Rule, string, ParsePositionDelta)

Creates a new instance

public LiteralRuleApplication(Rule rule, string literal, ParsePositionDelta examinedTo)

Parameters

rule Rule

the rule

literal string

the matched literal

examinedTo ParsePositionDelta

LiteralRuleApplication(Rule, string, ParsePositionDelta, ParsePositionDelta)

Creates a new instance

public LiteralRuleApplication(Rule rule, string literal, ParsePositionDelta length, ParsePositionDelta examinedTo)

Parameters

rule Rule

the rule

literal string

the matched literal

length ParsePositionDelta

the length (use in case of multiline literals)

examinedTo ParsePositionDelta

Properties

Literal

Gets the matched literal

public string Literal { get; }

Property Value

string

SemanticElement

Gets the semantic element of the rule application

public override object SemanticElement { get; }

Property Value

object

Methods

ApplyTo(RuleApplication, ParseContext)

Applies the structure of the current rule application to the given other rule application

public override RuleApplication ApplyTo(RuleApplication other, ParseContext context)

Parameters

other RuleApplication

the rule application to which the rule should be applied

context ParseContext

the parse context

Returns

RuleApplication

the merged rule application

GetFirstInnerLiteral()

Calculates the first literal within this rule application

public override LiteralRuleApplication GetFirstInnerLiteral()

Returns

LiteralRuleApplication

the first literal rule application or null

GetLastInnerLiteral()

Calculates the last literal within this rule application

public override LiteralRuleApplication GetLastInnerLiteral()

Returns

LiteralRuleApplication

the last literal rule application or null

GetLiteralAt(ParsePosition)

Gets the literal at the given position

public override RuleApplication GetLiteralAt(ParsePosition position)

Parameters

position ParsePosition

the position

Returns

RuleApplication

the literal rule application or null, if there is no literal there

GetValue(ParseContext)

Gets the parsed newPosition under the given context

public override object GetValue(ParseContext context)

Parameters

context ParseContext

the parse context

Returns

object

the parsed newPosition

IterateLiterals(Action<LiteralRuleApplication>)

Iterate over all literals

public override void IterateLiterals(Action<LiteralRuleApplication> action)

Parameters

action Action<LiteralRuleApplication>

the action that should be performed for all literals

IterateLiterals<T>(Action<LiteralRuleApplication, T>, T)

Iterate over all literals

public override void IterateLiterals<T>(Action<LiteralRuleApplication, T> action, T parameter)

Parameters

action Action<LiteralRuleApplication, T>

the action that should be performed for all literals

parameter T

the parameter

Type Parameters

T

the parameter type

OnMigrate(string, string, ParseContext)

Gets called when the rule application is migrated

protected virtual void OnMigrate(string oldValue, string newValue, ParseContext context)

Parameters

oldValue string

the old literal

newValue string

the new literal

context ParseContext

the parse context

Write(PrettyPrintWriter, ParseContext)

Writes the given rule application to the provided text writer

public override void Write(PrettyPrintWriter writer, ParseContext context)

Parameters

writer PrettyPrintWriter

the writer to which the rule application should be written

context ParseContext

the parse context