In This Article

EbnfTerm Class

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

public abstract class EbnfTerm : IGrammarNode
Inheritance:
System.Object Object
Derived:
EbnfQuantifiableTerm EbnfQuantifier

Constructors

EbnfTerm()

protected EbnfTerm()

Properties

CompleteCallback

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

public ParserCallback CompleteCallback { get; set; }

Property Value

ParserCallback:

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

Remarks

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

ErrorCallback

Gets or sets the delegate that will be called when an error occurs while parsing the term.

public ParserErrorCallback ErrorCallback { get; set; }

Property Value

ParserErrorCallback:

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

Remarks

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

InitializeCallback

Gets or sets the delegate that will be called before the term is parsed.

public ParserCallback InitializeCallback { get; set; }

Property Value

ParserCallback:

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

Remarks

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

IsCompiled

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

public bool IsCompiled { get; }

Property Value

System.Boolean:

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

Label

Gets or sets the label to apply to this term that may be used when rewriting.

public virtual string Label { get; set; }

Property Value

System.String:

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

Remarks

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

MatchCondition

Gets the IMatchCondition to use for this term.

public IMatchCondition MatchCondition { get; }

Property Value

IMatchCondition:

The IMatchCondition to use for this term.

SuccessCallback

Gets or sets the delegate that will be called when the term is successfully parsed.

public ParserCallback SuccessCallback { get; set; }

Property Value

ParserCallback:

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

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

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

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 System.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

System.String:

A string containing the EBNF form of the term.

ToProduction()

Returns an EbnfProduction for this term.

public virtual EbnfProduction ToProduction()

Returns

EbnfProduction:

An EbnfProduction for this term.

Operators

Addition(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.

BitwiseOr(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.

GreaterThan(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.

LessThan(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

  • System.Object.ToString()
  • System.Object.Equals(System.Object)
  • System.Object.Equals(System.Object, System.Object)
  • System.Object.ReferenceEquals(System.Object, System.Object)
  • System.Object.GetHashCode()
  • System.Object.GetType()
  • System.Object.MemberwiseClone()