com.sonar.sslr.api
Interface Rule

All Superinterfaces:
AstNodeType
All Known Subinterfaces:
CompilableGrammarRule
All Known Implementing Classes:
MutableParsingRule, RuleDefinition

public interface Rule
extends AstNodeType

This interface is not intended to be implemented by clients.


Method Summary
 Rule is(Object... e)
          Deprecated. in 1.19, use GrammarRuleBuilder.is(Object) instead.
 void mock()
          Deprecated. in 1.18, use override(Object...) instead.
 Rule override(Object... e)
          Deprecated. in 1.19, use GrammarRuleBuilder.override(Object) instead.
 void recoveryRule()
          Deprecated. in 1.19, no difference between usual grammar rule and "recovery rule" - both will be presented in AST and so can be handled via AST visitor.
 void skip()
          Deprecated. in 1.19, use GrammarRuleBuilder.skip() instead.
 void skipIf(AstNodeSkippingPolicy policy)
          Deprecated. in 1.19
 void skipIfOneChild()
          Deprecated. in 1.19, use GrammarRuleBuilder.skipIfOneChild() instead.
 

Method Detail

is

@Deprecated
Rule is(Object... e)
Deprecated. in 1.19, use GrammarRuleBuilder.is(Object) instead.

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 IllegalStateException will be thrown.

Parameters:
e - expression of grammar that defines this rule
Returns:
this (for method chaining)
Throws:
IllegalStateException - if definition has been already done
IllegalArgumentException - if any of given arguments is not a parsing expression

override

@Deprecated
Rule override(Object... e)
Deprecated. in 1.19, use GrammarRuleBuilder.override(Object) instead.

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 that defines this rule
Returns:
this (for method chaining)
Throws:
IllegalArgumentException - if any of given arguments is not a parsing expression

skip

@Deprecated
void skip()
Deprecated. in 1.19, use GrammarRuleBuilder.skip() instead.

Indicates that grammar rule should not lead to creation of AST node - its children should be attached directly to its parent.


skipIf

@Deprecated
void skipIf(AstNodeSkippingPolicy policy)
Deprecated. in 1.19

Defines policy of creation of AST node for this rule.


skipIfOneChild

@Deprecated
void skipIfOneChild()
Deprecated. in 1.19, use GrammarRuleBuilder.skipIfOneChild() instead.

Indicates that grammar rule should not lead to creation of AST node if it has exactly one child.


mock

@Deprecated
void mock()
Deprecated. in 1.18, use override(Object...) instead.

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.


recoveryRule

@Deprecated
void recoveryRule()
Deprecated. in 1.19, no difference between usual grammar rule and "recovery rule" - both will be presented in AST and so can be handled via AST visitor.



Copyright © 2009-2014 SonarSource. All Rights Reserved.