In This Article

EbnfTerm Class

Represents the abstract base class for a term within an EBNF production.

public abstract class EbnfTerm
Inheritance:
object object
Derived:
EbnfQuantifiableTerm EbnfQuantifier

Constructors

EbnfTerm()

Initializes an instance of the class.

protected EbnfTerm()

Properties

CompleteCallback

The delegate that will be called after the term is parsed, regardless of success or failure.

public ParserCallback? CompleteCallback { get; set; }

Property Value

ParserCallback

Remarks

Once the grammar has been compiled, the setter of this property will throw an exception if called.

ErrorCallback

The delegate that will be called when an error occurs while parsing the term.

public ParserErrorCallback? ErrorCallback { get; set; }

Property Value

ParserErrorCallback

Remarks

Once the grammar has been compiled, the setter of this property will throw an exception if called.

InitializeCallback

The delegate that will be called before the term is parsed.

public ParserCallback? InitializeCallback { get; set; }

Property Value

ParserCallback

Remarks

Once the grammar has been compiled, the setter of this property will throw an exception if called.

IsCompiled

Indicates whether the grammar and its elements are compiled, via a call to its Compile() method.

public bool IsCompiled { get; }

Property Value

bool:

true if the grammar and its elements are compiled; otherwise, false.

Label

The label to apply to this term that may be used when rewriting.

public virtual string? Label { get; set; }

Property Value

string

Remarks

Once the grammar has been compiled, the setter of this property will throw an exception if called.

MatchCondition

The IMatchCondition to use for this term.

public IMatchCondition? MatchCondition { get; }

Property Value

IMatchCondition

SuccessCallback

The delegate that will be called when the term is successfully parsed.

public ParserCallback? SuccessCallback { get; set; }

Property Value

ParserCallback

Remarks

Once the grammar has been compiled, the setter of this property will throw an exception if called.

Methods

OnComplete(ParserCallback)

Sets the delegate that will be called after the term is parsed, regardless of success or failure.

public EbnfTerm OnComplete(ParserCallback callback)
Parameter Type Description
callback ParserCallback

Returns

EbnfTerm:

The modified term.

OnError(ParserErrorCallback)

Sets the delegate that will be called when an error occurs while parsing the term.

public EbnfTerm OnError(ParserErrorCallback callback)
Parameter Type Description
callback ParserErrorCallback

The delegate that will be called when an error occurs while parsing the term.

Returns

EbnfTerm:

The modified term.

OnErrorContinue()

Marks that if an error occurs while parsing the term, the error will be reported but parsing will continue on.

public EbnfTerm OnErrorContinue()

Returns

EbnfTerm:

The modified term.

OnErrorIgnore()

Marks that if an error occurs while parsing the term, no error will be reported and parsing will continue on.

public EbnfTerm OnErrorIgnore()

Returns

EbnfTerm:

The modified term.

OnErrorNoReport()

Marks that if an error occurs while parsing the term, no error will be reported and parsing will return a match failure.

public EbnfTerm OnErrorNoReport()

Returns

EbnfTerm:

The modified term.

OnInitialize(ParserCallback)

Sets the delegate that will be called before the term is parsed.

public EbnfTerm OnInitialize(ParserCallback callback)
Parameter Type Description
callback ParserCallback

The delegate that will be called before the term is parsed.

Returns

EbnfTerm:

The modified term.

OnSuccess(ParserCallback)

Sets the delegate that will be called when the term is successfully parsed.

public EbnfTerm OnSuccess(ParserCallback callback)
Parameter Type Description
callback ParserCallback

The delegate that will be called when the term is successfully parsed.

Returns

EbnfTerm:

The modified term.

SetLabel(string)

Sets the Label for the term.

public virtual EbnfTerm SetLabel(string newLabel)
Parameter Type Description
newLabel string

The Label for the term.

Returns

EbnfTerm:

The modified term.

ToEbnfString()

Outputs the contents of the term in EBNF form.

public string ToEbnfString()

Returns

string:

A string containing the EBNF form of the term.

ToProduction()

Returns an EbnfProduction for this term.

public virtual EbnfProduction ToProduction()

Returns

EbnfProduction

Operators

operator +(EbnfTerm, EbnfTerm)

Implements a concatenation operator between EbnfTerm and EbnfTerm.

public static EbnfConcatenation operator +(EbnfTerm left, EbnfTerm right)
Parameter Type Description
left EbnfTerm

A EbnfTerm to compare.

right EbnfTerm

A EbnfTerm to compare.

Returns

EbnfConcatenation:

The EbnfConcatenation that was created.

operator |(EbnfTerm, EbnfTerm)

Implements an OR operator between EbnfTerm and EbnfTerm.

public static EbnfAlternation operator |(EbnfTerm left, EbnfTerm right)
Parameter Type Description
left EbnfTerm

A EbnfTerm to compare.

right EbnfTerm

A EbnfTerm to compare.

Returns

EbnfAlternation:

The EbnfAlternation that was created.

operator >(EbnfTerm, ITreeConstructionNode?)

Implements a greater-than operator between EbnfTerm and ITreeConstructionNode.

public static EbnfProduction operator >(EbnfTerm term, ITreeConstructionNode? treeConstructor)
Parameter Type Description
term EbnfTerm

A EbnfTerm.

treeConstructor ITreeConstructionNode

A ITreeConstructionNode.

Returns

EbnfProduction:

The EbnfProduction that was created.

operator <(EbnfTerm, ITreeConstructionNode?)

Implements a less-than operator between EbnfTerm and ITreeConstructionNode.

public static EbnfProduction operator <(EbnfTerm term, ITreeConstructionNode? treeConstructor)
Parameter Type Description
term EbnfTerm

A EbnfTerm.

treeConstructor ITreeConstructionNode

A ITreeConstructionNode.

Returns

EbnfProduction:

The EbnfProduction that was created.

Inherited Members

Extension Methods