|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Rule
A Rule describes a context free grammar syntactic rule.
Grammar
,
Backus�Naur FormMethod Summary | |
---|---|
Rule |
and(java.lang.Object... matchers)
The method is(Object...) must be first called to be able to extend this rule definition |
Rule |
is(java.lang.Object... matchers)
This method allows to provide the definition of a context-free grammar rule. |
Rule |
isOr(java.lang.Object... matchers)
The method is(Object...) is just a utility method which prevents writing is(or()); |
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 |
or(java.lang.Object... matchers)
The method is(Object...) must be first called to be able to add a new alternative to this rule |
Rule |
orBefore(java.lang.Object... matchers)
The method is(Object...) must be first called to be able to add a new alternative to this rule. |
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 |
plug(java.lang.Object adapter)
Experimental |
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 |
Method Detail |
---|
Rule is(java.lang.Object... matchers)
override(Object...)
method must be used.
matchers
- the matchers that define the rule
Rule 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 rule
Rule or(java.lang.Object... matchers)
is(Object...)
must be first called to be able to add a new alternative to this rule
com.sonar.sslr.impl.matcher.GrammarFunctions.Standard#or(Object...)}
Rule and(java.lang.Object... matchers)
is(Object...)
must be first called to be able to extend this rule definition
com.sonar.sslr.impl.matcher.GrammarFunctions.Standard#and(Object...)}
Rule orBefore(java.lang.Object... matchers)
is(Object...)
must be first called to be able to add a new alternative to this rule. This alternative will be the
first one to be tested before testing previous ones.
com.sonar.sslr.impl.matcher.GrammarFunctions.Standard#or(Object...)}
Rule isOr(java.lang.Object... matchers)
is(Object...)
is just a utility method which prevents writing is(or());
#is(Object...)}
,
com.sonar.sslr.impl.matcher.GrammarFunctions.Standard#or(Object...)}
void skip()
void skipIf(AstNodeSkippingPolicy policy)
void skipIfOneChild()
void mock()
void plug(java.lang.Object adapter)
void recoveryRule()
RecognitionExceptionListener
injected into the Parser
are automatically
notified.
RecognitionExceptionListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |