public interface GrammarRuleBuilder
This interface is not intended to be implemented by clients.
LexerlessGrammarBuilder.rule(GrammarRuleKey),
LexerfulGrammarBuilder.rule(GrammarRuleKey)| Modifier and Type | Method and Description |
|---|---|
GrammarRuleBuilder |
is(Object e)
Allows to provide definition of a grammar rule.
|
GrammarRuleBuilder |
is(Object e,
Object... rest)
Convenience method equivalent to calling
is(grammarBuilder.sequence(e, rest)). |
GrammarRuleBuilder |
override(Object e)
Allows to override definition of a grammar rule.
|
GrammarRuleBuilder |
override(Object e,
Object... rest)
Convenience method equivalent to calling
override(grammarBuilder.sequence(e, rest)). |
void |
recoveryRule()
Deprecated.
in 1.19, no difference between usual grammar rule and "recovery rule" - both will be presented in AST and so can be handled via AST visitor.
|
void |
skip()
Indicates that grammar rule should not lead to creation of AST node - its children should be attached directly to its parent.
|
void |
skipIfOneChild()
Indicates that grammar rule should not lead to creation of AST node if it has exactly one child.
|
GrammarRuleBuilder is(Object e)
Note: this method can be called only once for a rule. If it is called more than once, an GrammarException will be thrown.
e - expression of grammarGrammarException - if definition has been already doneIllegalArgumentException - if given argument is not a parsing expressionGrammarRuleBuilder is(Object e, Object... rest)
is(grammarBuilder.sequence(e, rest)).e - expression of grammarrest - rest of expressionsGrammarException - if definition has been already doneIllegalArgumentException - if any of given arguments is not a parsing expressionis(Object)GrammarRuleBuilder override(Object e)
This method has the same effect as is(Object), except that it can be called more than once to redefine a rule from scratch.
e - expression of grammarIllegalArgumentException - if given argument is not a parsing expressionGrammarRuleBuilder override(Object e, Object... rest)
override(grammarBuilder.sequence(e, rest)).e - expression of grammarrest - rest of expressionsIllegalArgumentException - if any of given arguments is not a parsing expressionoverride(Object)void skip()
void skipIfOneChild()
@Deprecated void recoveryRule()
UnsupportedOperationException - alwaysCopyright © 2009–2018 SonarSource. All rights reserved.