Package org.sonar.sslr.grammar
Interface GrammarRuleBuilder
public interface GrammarRuleBuilder
This interface contains methods used to describe rule of grammar.
This interface is not intended to be implemented by clients.
- Since:
- 1.18
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionAllows to provide definition of a grammar rule.Convenience method equivalent to callingis(grammarBuilder.sequence(e, rest)).Allows to override definition of a grammar rule.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.voidIndicates that grammar rule should not lead to creation of AST node if it has exactly one child.
-
Method Details
-
is
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
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:
-
override
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
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:
-
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.
-