com.sonar.sslr.api
Interface Rule

All Superinterfaces:
AstNodeType
All Known Subinterfaces:
LeftRecursiveRule

public interface Rule
extends AstNodeType

A Rule describes a grammar syntactic rule.

See Also:
Grammar, Backus�Naur Form

Method Summary
 Rule and(Object... matchers)
           
 Rule is(Object... matchers)
          This method allows the define the current rule as the sequence of the matchers passed as parameters, respecting the order of the given matchers.
 Rule isOr(Object... matchers)
           
 void mock()
           
 void mockUpperCase()
           
 Rule or(Object... matchers)
           
 Rule orBefore(Object... matchers)
           
 Rule override(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.
 Rule plug(Class adapterClass)
           
 void recoveryRule()
          A recovery rule notify RecognitionExceptionListener(s) of a parsing error before consuming bad tokens.
 Rule setListener(AstListener listener)
           
 Rule skip()
           
 Rule skipIf(AstNodeType policy)
           
 Rule skipIfOneChild()
           
 

Method Detail

is

Rule is(Object... matchers)
This method allows the define the current rule as the sequence of the matchers passed as parameters, respecting the order of the given matchers.

Note: this method can be called only once for a rule. If it is called more than once, an IllegalStateException will be thrown. If the rule definition really needs to be redefine, then the override(Object...) method must be used.

Parameters:
matchers - the matchers that define the rule
Returns:
the rule
See Also:
override(Object...)

override

Rule override(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. It can be used if the rule has to be redefined later (for instance in grammar extensions).

Parameters:
matchers - the matchers that define the rule
Returns:
the rule
See Also:
RuleImpl#override(Object...)

or

Rule or(Object... matchers)

and

Rule and(Object... matchers)

orBefore

Rule orBefore(Object... matchers)

isOr

Rule isOr(Object... matchers)

setListener

Rule setListener(AstListener listener)

skip

Rule skip()

skipIf

Rule skipIf(AstNodeType policy)

skipIfOneChild

Rule skipIfOneChild()

mockUpperCase

void mockUpperCase()

mock

void mock()

recoveryRule

void recoveryRule()
A recovery rule notify RecognitionExceptionListener(s) of a parsing error before consuming bad tokens.


plug

Rule plug(Class adapterClass)


Copyright © 2011 SonarSource. All Rights Reserved.