Package quickparse.grammar.symbol
Class ConstructSymbol
java.lang.Object
quickparse.grammar.symbol.Symbol
quickparse.grammar.symbol.ConstructSymbol
public class ConstructSymbol extends Symbol
Defines the symbol used in grammars to represent a syntactical construct.
For example, given the grammatical rule
A and B are syntactical constructs that can be represented by this class.
For example, given the grammatical rule
A -> '(' B ')'A and B are syntactical constructs that can be represented by this class.
-
Nested Class Summary
Nested classes/interfaces inherited from class quickparse.grammar.symbol.Symbol
Symbol.ConstructAction, Symbol.ConstructFunction<R,C>, Symbol.Function<R,C>, Symbol.TokenAction, Symbol.TokenFunction<R,C> -
Method Summary
Modifier and Type Method Description <R, C> Raccept(C context, Symbol.Function<R,C> symbolFunction)Solves the subclass of this symbol (ConstructSymbolorTokenSymboland computes the givenSymbol.Functionbooleanequals(java.lang.Object obj)static ConstructSymbolget(java.lang.String symbol)Gets a newConstructSymbolinstance for the given string.
This method uses the Flyweight design pattern by GoF to cache already created instances.java.lang.StringgetName()The name of the symbolinthashCode()java.lang.StringtoString()Methods inherited from class quickparse.grammar.symbol.Symbol
ifConstruct, ifConstruct, ifToken, ifToken
-
Method Details
-
get
Gets a newConstructSymbolinstance for the given string.
This method uses the Flyweight design pattern by GoF to cache already created instances.- Parameters:
symbol- the symbol to wrap into theConstructSymbolinstance- Returns:
- a
ConstructSymbolinstance
-
getName
public java.lang.String getName()Description copied from class:SymbolThe name of the symbol -
accept
Description copied from class:SymbolSolves the subclass of this symbol (ConstructSymbolorTokenSymboland computes the givenSymbol.Function- Specified by:
acceptin classSymbol- Type Parameters:
R- the return type of the functionC- the context type for the function- Parameters:
context- the context used for computationsymbolFunction- the function that must be computed on this symbol- Returns:
- the return value returned by computing the
Symbol.Function
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-