public static final class Grammar.Builder extends Object
Grammar
, where rules can be
added incrementally, and which takes care of collecting
problem reports along the wayaddRule(GrammarRule)
Modifier and Type | Field and Description |
---|---|
Reporter |
reporter
Problems reported when building this grammar
|
Constructor and Description |
---|
Builder(List<Option> options,
List<Located<String>> imports,
Extent header,
Extent footer)
Returns a new builder with the given options, imports, header and footer
|
Modifier and Type | Method and Description |
---|---|
Grammar.Builder |
addRule(GrammarRule rule) |
Grammar.Builder |
addToken(TokenDecl decl) |
Grammar |
build() |
public final Reporter reporter
public Grammar.Builder addToken(TokenDecl decl)
decl
- public Grammar.Builder addRule(GrammarRule rule)
rule
- rule
added to the set of rulespublic Grammar build()
Grammar.IllFormedException
- if the described grammar
is not well-formed