Table of Contents

Class ElementRule<TElement>

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

Denotes a rule that is used to create elements

public abstract class ElementRule<TElement> : SequenceRule

Type Parameters

TElement

the type of elements to create

Inheritance
ElementRule<TElement>
Derived
Inherited Members

Properties

CodeActions

Gets the list of code actions for this rule.

protected virtual IEnumerable<CodeActionInfo<TElement>> CodeActions { get; }

Property Value

IEnumerable<CodeActionInfo<TElement>>

CodeLenses

Gets the list of code lenses for this rule.

protected virtual IEnumerable<CodeLensInfo<TElement>> CodeLenses { get; }

Property Value

IEnumerable<CodeLensInfo<TElement>>

IsDefinition

True, if the application of this rule denotes a definition

public override bool IsDefinition { get; }

Property Value

bool

Methods

CanSynthesize(object, ParseContext, SynthesisPlan)

Determines whether the current rule can synthesize rule applications for the given semantic element

public override bool CanSynthesize(object semanticElement, ParseContext context, SynthesisPlan synthesisPlan)

Parameters

semanticElement object

the semantic element

context ParseContext

the context in which the rule is synthesized

synthesisPlan SynthesisPlan

the plan of the synthesis

Returns

bool

true, if a rule application can be synthesized, otherwise false

CreateElement(IEnumerable<RuleApplication>)

Creates an element

protected virtual TElement CreateElement(IEnumerable<RuleApplication> inner)

Parameters

inner IEnumerable<RuleApplication>

the inner rule applications

Returns

TElement

an instance of the model element type

CreateRuleApplication(ParsePosition, List<RuleApplication>, ParsePositionDelta, ParsePositionDelta)

Creates a rule application for a success

protected override RuleApplication CreateRuleApplication(ParsePosition currentPosition, List<RuleApplication> inner, ParsePositionDelta length, ParsePositionDelta examined)

Parameters

currentPosition ParsePosition

the current parser position

inner List<RuleApplication>

the inner list of rule applications

length ParsePositionDelta

the length of the match

examined ParsePositionDelta

the amount of text examined

Returns

RuleApplication

a new rule application

GetHoverText(RuleApplication, Parser, ParsePosition)

Retrieves the hover text for a symbol at a given position in the document, if available.

public override string GetHoverText(RuleApplication ruleApplication, Parser document, ParsePosition position)

Parameters

ruleApplication RuleApplication

The rule application context that is used to process the document.

document Parser

The document being parsed.

position ParsePosition

The position in the document where the hover text is requested.

Returns

string

A string containing the hover text, or null if no matching symbol or hover text is found.

GetReferenceString(TElement, ParseContext)

Gets the printed reference for the given object

protected virtual string GetReferenceString(TElement reference, ParseContext context)

Parameters

reference TElement

the referenced object

context ParseContext

the parse context

Returns

string

a string representation

OnActivate(RuleApplication, ParseContext)

Gets called when a rule application is activated

protected override void OnActivate(RuleApplication application, ParseContext context)

Parameters

application RuleApplication

the rule application that is activated

context ParseContext

the context in which the rule application is activated

OnDeactivate(RuleApplication, ParseContext)

Gets called when a rule application is deactivated

protected override void OnDeactivate(RuleApplication application, ParseContext context)

Parameters

application RuleApplication

the rule application that is deactivated

context ParseContext

the context in which the rule application is deactivated

RegisterSymbolKind(Dictionary<Type, SymbolKind>)

Registers the correct symbol kind for the reference type if any.

public override void RegisterSymbolKind(Dictionary<Type, SymbolKind> _symbolKinds)

Parameters

_symbolKinds Dictionary<Type, SymbolKind>

Synthesize(object, ParsePosition, ParseContext)

Synthesizes a rule application for the given semantic element

public override RuleApplication Synthesize(object semanticElement, ParsePosition position, ParseContext context)

Parameters

semanticElement object
position ParsePosition

the parse position at which the element should be synthesized

context ParseContext

the parse context

Returns

RuleApplication

a rule application

Validate(TElement, RuleApplication, ParseContext)

Validates the given semantic element

protected virtual void Validate(TElement element, RuleApplication ruleApplication, ParseContext context)

Parameters

element TElement

the element that should be validated

ruleApplication RuleApplication

the rule application in the context of which validation is performed

context ParseContext

the context in which validation is performed