|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sonar.sslr.impl.matcher.RuleDefinition
public class RuleDefinition
This class is not intended to be instantiated or subclassed by clients.
| Constructor Summary | |
|---|---|
RuleDefinition(GrammarRuleKey ruleKey)
|
|
RuleDefinition(String name)
|
|
| Method Summary | |
|---|---|
Instruction[] |
compile(CompilationHandler compiler)
Compiles this expression into a sequence of instructions. |
void |
enableMemoization()
|
ParsingExpression |
getExpression()
|
String |
getName()
|
AstNodeType |
getRealAstNodeType()
|
GrammarRuleKey |
getRuleKey()
|
boolean |
hasToBeSkippedFromAst(AstNode node)
Some AstNode can be pretty useless and makes a global AST less readable. |
RuleDefinition |
is(Object... e)
Allows to provide definition of a 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. |
RuleDefinition |
override(Object... e)
Allows to override definition of a grammar rule. |
void |
recoveryRule()
|
void |
setExpression(ParsingExpression expression)
|
boolean |
shouldMemoize()
|
void |
skip()
Indicates that grammar rule should not lead to creation of AST node - its children should be attached directly to its parent. |
void |
skipIf(AstNodeSkippingPolicy astNodeSkipPolicy)
Defines policy of creation of AST node for this rule. |
void |
skipIfOneChild()
Indicates that grammar rule should not lead to creation of AST node if it has exactly one child. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public RuleDefinition(String name)
public RuleDefinition(GrammarRuleKey ruleKey)
| Method Detail |
|---|
public String getName()
public RuleDefinition is(Object... e)
RuleNote: this method can be called only once for a rule. If it is called more than once, an IllegalStateException will be thrown.
is in interface Rulee - expression of grammar that defines this rule
public RuleDefinition override(Object... e)
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.
override in interface Rulee - expression of grammar that defines this rule
public void mock()
Rule
mock in interface Rulepublic void skip()
Rule
skip in interface Rulepublic void skipIf(AstNodeSkippingPolicy astNodeSkipPolicy)
Rule
skipIf in interface Rulepublic void skipIfOneChild()
Rule
skipIfOneChild in interface Rulepublic void recoveryRule()
recoveryRule in interface Rulepublic boolean hasToBeSkippedFromAst(AstNode node)
AstNodeSkippingPolicy
hasToBeSkippedFromAst in interface AstNodeSkippingPolicynode - the node that should or not be removed from the AST
public AstNodeType getRealAstNodeType()
public GrammarRuleKey getRuleKey()
getRuleKey in interface CompilableGrammarRulepublic ParsingExpression getExpression()
getExpression in interface CompilableGrammarRulepublic void setExpression(ParsingExpression expression)
setExpression in interface CompilableGrammarRulepublic Instruction[] compile(CompilationHandler compiler)
ParsingExpression
compile in interface ParsingExpressionpublic String toString()
toString in class Objectpublic boolean shouldMemoize()
shouldMemoize in interface MemoParsingExpressionpublic void enableMemoization()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||