Class Nonterminal
Provides factory methods to define nonterminals.
public static class Nonterminal
- Inheritance
-
Nonterminal
Methods
CreateUntyped(string)
Creates a nonterminal that does not produce a value and whose productions must be assigned at a later time.
public static Nonterminal CreateUntyped(string name)
Parameters
name
stringThe nonterminal's name.
Returns
- See Also
-
SetProductions(params ProductionBuilder[])
CreateUntyped(string, params ProductionBuilder[])
Creates a nonterminal that does not produce a value.
public static IGrammarSymbol CreateUntyped(string name, params ProductionBuilder[] productions)
Parameters
name
stringThe nonterminal's name.
productions
ProductionBuilder[]The nonterminal's productions, represented as ProductionBuilder objects that have not been
Extend
ed orFinish
ed.
Returns
Exceptions
- ArgumentException
productions
is empty.
CreateUntyped(string, params ImmutableArray<ProductionBuilder>)
Creates a nonterminal that does not produce a value.
public static IGrammarSymbol CreateUntyped(string name, params ImmutableArray<ProductionBuilder> productions)
Parameters
name
stringThe nonterminal's name.
productions
ImmutableArray<ProductionBuilder>The nonterminal's productions, represented as ProductionBuilder objects that have not been
Extend
ed orFinish
ed.
Returns
Exceptions
- ArgumentException
productions
is empty.
Create<T>(string)
Creates a nonterminal that produces a value, whose productions must be assigned at a later time.
public static Nonterminal<T> Create<T>(string name)
Parameters
name
stringThe nonterminal's name.
Returns
- Nonterminal<T>
Type Parameters
T
The type of values the nonterminal will produce.
- See Also
-
SetProductions(params IProduction<T>[])
Create<T>(string, params IProduction<T>[])
Creates a nonterminal that produces a value.
public static IGrammarSymbol<T> Create<T>(string name, params IProduction<T>[] productions)
Parameters
name
stringThe nonterminal's name.
productions
IProduction<T>[]The nonterminal's productions.
Returns
Type Parameters
T
The type of values the nonterminal will produce.
Exceptions
- ArgumentException
productions
is empty.
Create<T>(string, params ImmutableArray<IProduction<T>>)
Creates a nonterminal that produces a value.
public static IGrammarSymbol<T> Create<T>(string name, params ImmutableArray<IProduction<T>> productions)
Parameters
name
stringThe nonterminal's name.
productions
ImmutableArray<IProduction<T>>The nonterminal's productions.
Returns
Type Parameters
T
The type of values the nonterminal will produce.
Exceptions
- ArgumentException
productions
is empty.