public final class ParseNodeConstructorRepository
extends java.lang.Object
This class takes a parser class as an argument and will look up all the
rules (methods returning a Rule. If a rule is further annotated with
GenerateNode, it will take the argument to this annotation and find
a suitable constructor.
The constructor must obey two criteria:
public,String (the text matched by the
node) and a List of ParseNodes (its children nodes).Furthermore, it will associate the found constructor with a rule label; it
is either the method name or, if the rule is further annotated with Label, then the value of this annotation.
It is illegal for two rules to have the same label: should that happen,
an IllegalStateException is thrown.
| Constructor and Description |
|---|
ParseNodeConstructorRepository(java.lang.Class<? extends com.github.fge.grappa.parsers.BaseParser<?>> parserClass)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.reflect.Constructor<? extends ParseNode> |
getNodeConstructor(java.lang.String ruleName)
Get the constructor for a given parse node class
|
public ParseNodeConstructorRepository(java.lang.Class<? extends com.github.fge.grappa.parsers.BaseParser<?>> parserClass)
parserClass - the parser classpublic java.lang.reflect.Constructor<? extends ParseNode> getNodeConstructor(java.lang.String ruleName)
ruleName - the name of the rulenull if not found