public class ParserGrammar extends Grammar
A grammar is a list of rules. Each rule defines a non-terminal symbol as a sequence of zero or more symbols (terminal or nonterminal).
A grammar can be used to create a parser for that grammar. The ParserGrammar is derived from
a SourceGrammar
. The ParserGrammar is immutable.
Modifier and Type | Field and Description |
---|---|
boolean |
usesRegex |
logcategory
Modifier and Type | Method and Description |
---|---|
java.util.Set<Symbol> |
getFirst(Symbol symbol) |
java.util.Set<Symbol> |
getFollow(Symbol symbol) |
HygieneReport |
getHygieneReport()
Get a hygiene report for this compiled grammar.
|
GearleyParser |
getParser(ParserOptions options)
Get a parser for this grammar.
|
ParserOptions |
getParserOptions() |
NonterminalSymbol |
getSeed() |
boolean |
isNullable(Symbol symbol)
Is a symbol nullable?
|
getMetadataProperies, getMetadataProperty, getRules, getRulesBySymbol, getRulesForSymbol, getSymbols
public NonterminalSymbol getSeed()
public ParserOptions getParserOptions()
public GearleyParser getParser(ParserOptions options)
Returns a parser that will parse an input against the rules that define this grammar.
options
- the parser options.public boolean isNullable(Symbol symbol)
isNullable
in class Grammar
symbol
- the symboljava.lang.UnsupportedOperationException
- if the grammar is openpublic HygieneReport getHygieneReport()