Package org.sonar.sslr.grammar
Interface GrammarRuleBuilder
-
public interface GrammarRuleBuilderThis interface contains methods used to describe rule of grammar.This interface is not intended to be implemented by clients.
- Since:
- 1.18
- See Also:
LexerlessGrammarBuilder.rule(GrammarRuleKey),LexerfulGrammarBuilder.rule(GrammarRuleKey)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description GrammarRuleBuilderis(Object e)Allows to provide definition of a grammar rule.GrammarRuleBuilderis(Object e, Object... rest)Convenience method equivalent to callingis(grammarBuilder.sequence(e, rest)).GrammarRuleBuilderoverride(Object e)Allows to override definition of a grammar rule.GrammarRuleBuilderoverride(Object e, Object... rest)Convenience method equivalent to callingoverride(grammarBuilder.sequence(e, rest)).voidskip()Indicates that grammar rule should not lead to creation of AST node - its children should be attached directly to its parent.voidskipIfOneChild()Indicates that grammar rule should not lead to creation of AST node if it has exactly one child.
-
-
-
Method Detail
-
is
GrammarRuleBuilder is(Object e)
Allows to provide definition of a grammar rule.Note: this method can be called only once for a rule. If it is called more than once, an GrammarException will be thrown.
- Parameters:
e- expression of grammar- Returns:
- this (for method chaining)
- Throws:
GrammarException- if definition has been already doneIllegalArgumentException- if given argument is not a parsing expression
-
is
GrammarRuleBuilder is(Object e, Object... rest)
Convenience method equivalent to callingis(grammarBuilder.sequence(e, rest)).- Parameters:
e- expression of grammarrest- rest of expressions- Returns:
- this (for method chaining)
- Throws:
GrammarException- if definition has been already doneIllegalArgumentException- if any of given arguments is not a parsing expression- See Also:
is(Object)
-
override
GrammarRuleBuilder override(Object e)
Allows to override definition of a grammar rule.This method has the same effect as
is(Object), except that it can be called more than once to redefine a rule from scratch.- Parameters:
e- expression of grammar- Returns:
- this (for method chaining)
- Throws:
IllegalArgumentException- if given argument is not a parsing expression
-
override
GrammarRuleBuilder override(Object e, Object... rest)
Convenience method equivalent to callingoverride(grammarBuilder.sequence(e, rest)).- Parameters:
e- expression of grammarrest- rest of expressions- Returns:
- this (for method chaining)
- Throws:
IllegalArgumentException- if any of given arguments is not a parsing expression- See Also:
override(Object)
-
skip
void skip()
Indicates that grammar rule should not lead to creation of AST node - its children should be attached directly to its parent.
-
skipIfOneChild
void skipIfOneChild()
Indicates that grammar rule should not lead to creation of AST node if it has exactly one child.
-
-