|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sonar.sslr.internal.grammar.MutableParsingRule
public class MutableParsingRule
| Constructor Summary | |
|---|---|
MutableParsingRule(GrammarRuleKey ruleKey)
|
|
MutableParsingRule(String name)
|
|
| Method Summary | |
|---|---|
Instruction[] |
compile(CompilationHandler compiler)
Compiles this expression into a sequence of instructions. |
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. |
Rule |
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. |
Rule |
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 policy)
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 MutableParsingRule(String name)
public MutableParsingRule(GrammarRuleKey ruleKey)
| Method Detail |
|---|
public String getName()
public AstNodeType getRealAstNodeType()
public GrammarRuleKey getRuleKey()
getRuleKey in interface CompilableGrammarRulepublic ParsingExpression getExpression()
getExpression in interface CompilableGrammarRulepublic Rule 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 Rule 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 setExpression(ParsingExpression expression)
setExpression in interface CompilableGrammarRulepublic void skip()
Rule
skip in interface Rulepublic void skipIfOneChild()
Rule
skipIfOneChild in interface Rulepublic void skipIf(AstNodeSkippingPolicy policy)
Rule
skipIf 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 Instruction[] compile(CompilationHandler compiler)
ParsingExpression
compile in interface ParsingExpressionpublic String toString()
toString in class Objectpublic boolean shouldMemoize()
shouldMemoize in interface MemoParsingExpression
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||