Table of Contents

Class Grammar

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

Denotes an abstract grammar

public abstract class Grammar
Inheritance
Grammar
Derived
Inherited Members

Properties

CommentRules

Gets an array of comment rules used by this grammar

public CommentRule[] CommentRules { get; }

Property Value

CommentRule[]

ExecutableActions

Dictionary of executable actions. The key is the action identifier, and the value is the action executor.

public Dictionary<string, ActionInfo> ExecutableActions { get; }

Property Value

Dictionary<string, ActionInfo>

Keywords

Gets the keywords used in the grammar

public ICollection<LiteralRule> Keywords { get; }

Property Value

ICollection<LiteralRule>

LanguageId

Gets the language id for this grammar

public abstract string LanguageId { get; }

Property Value

string

Root

Gets the root rule

public Rule Root { get; }

Property Value

Rule

Rules

Gets a collection of all rules in this grammar

public virtual IEnumerable<Rule> Rules { get; }

Property Value

IEnumerable<Rule>

TokenModifiers

Gets an array of token modifiers used by this grammar

public string[] TokenModifiers { get; }

Property Value

string[]

TokenTypes

Gets an array of token types used by this grammar

public string[] TokenTypes { get; }

Property Value

string[]

Methods

CompletionTriggerCharacters()

Retrieves an array of characters that can trigger completion suggestions.

public virtual string[] CompletionTriggerCharacters()

Returns

string[]

An array of strings representing the trigger characters. By default, this method returns array only containing periods (.)

CreateCustomRules()

Create custom rules that are not resolvable by type

protected abstract IEnumerable<Rule> CreateCustomRules()

Returns

IEnumerable<Rule>

a collection of custom rules

CreateKeywordRule(string)

Creates the keyword rule for the given keyword

protected virtual LiteralRule CreateKeywordRule(string keyword)

Parameters

keyword string

the keyword

Returns

LiteralRule

A literal rule that represents matching the provided keyword

CreateParseContext()

Creates a parsing context for this grammar

protected virtual ParseContext CreateParseContext()

Returns

ParseContext

a parsing context for the current grammar

CreateParser()

Create a parser for this grammar

public Parser CreateParser()

Returns

Parser

a parser configured for this grammar

CreateTypedRules()

Create the typed rules as a dictionary

protected abstract IDictionary<Type, Rule> CreateTypedRules()

Returns

IDictionary<Type, Rule>

a dictionary of rules by type

GetRootRule(GrammarContext)

Gets the root rule

protected abstract Rule GetRootRule(GrammarContext context)

Parameters

context GrammarContext

a context to resolve the root rule

Returns

Rule

the root rule for this grammar

GetRule<T>()

Gets the rule with the given rule type

public T GetRule<T>() where T : Rule

Returns

T

the rule with the provided type, if it exists and registered for this type

Type Parameters

T

the type of the rule

GetSymbolKindForType(Type)

Retrieves the SymbolKind for a given type or one of its supertypes.

public SymbolKind GetSymbolKindForType(Type type)

Parameters

type Type

The type for which the corresponding SymbolKind is being searched.

Returns

SymbolKind

The matching SymbolKind if the type or one of its supertypes is found in _symbolKinds.
If no matching entry is found, String is returned.

Exceptions

ArgumentNullException

Thrown if type is null.

Initialize()

Initializes the current grammar

public void Initialize()