In This Article

EbnfProduction Class

Represents an EBNF production, which consists of an EbnfTerm-based pattern expression and a ITreeConstructionNode-based tree constructor.

public sealed class EbnfProduction : EbnfQuantifiableTerm, IGrammarNode
Inheritance:
System.Object EbnfTerm EbnfQuantifiableTerm Object

Constructors

EbnfProduction(EbnfTerm)

Initializes a new instance of the EbnfProduction class.

public EbnfProduction(EbnfTerm patternExpression)
Parameter Type Description
patternExpression EbnfTerm

The EbnfTerm that is the pattern expression.

EbnfProduction(EbnfTerm, ITreeConstructionNode)

Initializes a new instance of the EbnfProduction class.

public EbnfProduction(EbnfTerm patternExpression, ITreeConstructionNode treeConstructor)
Parameter Type Description
patternExpression EbnfTerm

The EbnfTerm that is the pattern expression.

treeConstructor ITreeConstructionNode

The ITreeConstructionNode that specifies how to rewrite the parse results.

Properties

PatternExpression

Gets or sets the EbnfTerm that is the pattern expression.

public EbnfTerm PatternExpression { get; set; }

Property Value

EbnfTerm:

The EbnfTerm that is the pattern expression.

Remarks

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

TreeConstructor

Gets or sets the ITreeConstructionNode that specifies how to construct the syntax tree results.

public ITreeConstructionNode TreeConstructor { get; set; }

Property Value

ITreeConstructionNode:

The ITreeConstructionNode that specifies how to construct the syntax tree results.

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 EbnfProduction OnComplete(ParserCallback callback)
Parameter Type Description
callback ParserCallback

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

Returns

EbnfProduction:

The modified term.

OnError(ParserErrorCallback)

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

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

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

Returns

EbnfProduction:

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 EbnfProduction OnErrorContinue()

Returns

EbnfProduction:

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 EbnfProduction OnErrorIgnore()

Returns

EbnfProduction:

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 EbnfProduction OnErrorNoReport()

Returns

EbnfProduction:

The modified term.

OnInitialize(ParserCallback)

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

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

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

Returns

EbnfProduction:

The modified term.

OnSuccess(ParserCallback)

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

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

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

Returns

EbnfProduction:

The modified term.

ToProduction()

Returns an EbnfProduction for this term.

public override EbnfProduction ToProduction()

Returns

EbnfProduction:

An EbnfProduction for this term.

ToString()

Returns a String that represents the current Object.

public override string ToString()

Returns

System.String:

A String that represents the current Object.

Operators

BitwiseOr(EbnfProduction, EbnfProduction)

Implements an OR operator between EbnfProduction and EbnfProduction.

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

A EbnfProduction to compare.

right EbnfProduction

A EbnfProduction to compare.

Returns

EbnfAlternation:

The EbnfAlternation that was created.

Implicit(EbnfAlternation to EbnfProduction)

Implements an implicit type conversion operator from EbnfAlternation.

public static implicit operator EbnfProduction(EbnfAlternation term)
Parameter Type Description
term EbnfAlternation

A EbnfAlternation to convert.

Returns

EbnfProduction:

The EbnfProduction that was created.

Implicit(EbnfConcatenation to EbnfProduction)

Implements an implicit type conversion operator from EbnfConcatenation.

public static implicit operator EbnfProduction(EbnfConcatenation term)
Parameter Type Description
term EbnfConcatenation

A EbnfConcatenation to convert.

Returns

EbnfProduction:

The EbnfProduction that was created.

Implicit(EbnfNonTerminal to EbnfProduction)

Implements an implicit type conversion operator from EbnfNonTerminal.

public static implicit operator EbnfProduction(EbnfNonTerminal term)
Parameter Type Description
term EbnfNonTerminal

A EbnfNonTerminal to convert.

Returns

EbnfProduction:

The EbnfProduction that was created.

Implicit(EbnfQuantifier to EbnfProduction)

Implements an implicit type conversion operator from EbnfQuantifier.

public static implicit operator EbnfProduction(EbnfQuantifier term)
Parameter Type Description
term EbnfQuantifier

A EbnfQuantifier to convert.

Returns

EbnfProduction:

The EbnfProduction that was created.

Implicit(EbnfTerminal to EbnfProduction)

Implements an implicit type conversion operator from EbnfTerminal.

public static implicit operator EbnfProduction(EbnfTerminal term)
Parameter Type Description
term EbnfTerminal

A EbnfTerminal to convert.

Returns

EbnfProduction:

The EbnfProduction that was created.

Inherited Members