public interface Rule extends AstNodeType
Grammar
Modifier and Type | Method and Description |
---|---|
Rule |
is(java.lang.Object... matchers)
This method allows to provide the definition of a context-free grammar rule.
|
void |
mock()
Utility method used for unit testing in order to dynamically replace the definition of the rule to match as soon as a token whose value
equals the name of the rule is encountered
|
Rule |
override(java.lang.Object... matchers)
This method has the same effect as
RuleImpl#is(Object...) , except that it can be called more than once to redefine a rule from
scratch. |
void |
recoveryRule()
A rule should be flagged as being a "Recovery" rule if it's responsibility is to consume
some bad tokens in order to recover from a parsing error.
|
void |
skip()
Remove this node from the AST and attached its children directly to its parent
|
void |
skipIf(AstNodeSkippingPolicy policy)
Remove this node from the AST according to a provided policy
|
void |
skipIfOneChild()
Remove this node from the AST if it has exactly 1 child
|
Rule is(java.lang.Object... matchers)
override(Object...)
method must be used.matchers
- the matchers that define the ruleRule override(java.lang.Object... matchers)
RuleImpl#is(Object...)
, except that it can be called more than once to redefine a rule from
scratch. It can be used if the rule has to be redefined later (for instance in a grammar extension).matchers
- the matchers that define the rulevoid skip()
void skipIf(AstNodeSkippingPolicy policy)
void skipIfOneChild()
void mock()
void recoveryRule()
RecognitionExceptionListener
injected into the Parser
are automatically
notified.RecognitionExceptionListener
Copyright © 2012 SonarSource. All Rights Reserved.