Table of Contents

Class ModelElementRule<TElement>

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

Denotes a rule that is used to create model elements

public class ModelElementRule<TElement> : ElementRule<TElement> where TElement : IModelElement

Type Parameters

TElement

the type of elements to create

Inheritance
ElementRule<TElement>
ModelElementRule<TElement>
Derived
Inherited Members

Methods

GetReferenceString(TElement, ParseContext)

Gets the printed reference for the given object

protected override string GetReferenceString(TElement reference, ParseContext context)

Parameters

reference TElement

the referenced object

context ParseContext

the parse context

Returns

string

a string representation

Validate(Func<TElement, string>, DiagnosticSeverity)

Instructs the rule to validate elements using the given validator method, revalidating after every parse run

protected void Validate(Func<TElement, string> validator, DiagnosticSeverity severity = DiagnosticSeverity.Error)

Parameters

validator Func<TElement, string>

a function to validate elements

severity DiagnosticSeverity

the severity of errors

Validate(TElement, RuleApplication, ParseContext)

Validates the given semantic element

protected override 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

ValidateIncrementally(Expression<Func<TElement, string>>, DiagnosticSeverity)

Instructs the rule to validate elements using the given validator method incrementally

protected void ValidateIncrementally(Expression<Func<TElement, string>> validatorExpression, DiagnosticSeverity severity = DiagnosticSeverity.Error)

Parameters

validatorExpression Expression<Func<TElement, string>>

a function to validate elements

severity DiagnosticSeverity

the severity of errors