com.sonar.sslr.api
Class Grammar

java.lang.Object
  extended by com.sonar.sslr.api.Grammar
Direct Known Subclasses:
AcuCobolExtension, CicsGrammar, CobolGrammar, DB2Grammar, GcosExtension, HpExtension, LexerlessGrammar, MicrofocusExtension

public abstract class Grammar
extends Object

Use LexerfulGrammarBuilder to create instances of this class.

This class is not intended to be instantiated or subclassed by clients.


Constructor Summary
Grammar()
           
 
Method Summary
static List<Field> getAllRuleFields(Class grammarClass)
          Find all direct and indirect rule fields declared in the given Grammar class.
abstract  Rule getRootRule()
          Each Grammar has always an entry point whose name is usually by convention the "Computation Unit".
static List<Field> getRuleFields(Class grammarClass)
          Find all the direct rule fields declared in the given Grammar class.
 Rule rule(GrammarRuleKey ruleKey)
          Allows to obtain an instance of grammar rule, which was constructed by LexerlessGrammarBuilder and LexerfulGrammarBuilder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Grammar

public Grammar()
Method Detail

getRuleFields

public static List<Field> getRuleFields(Class grammarClass)
Find all the direct rule fields declared in the given Grammar class. Inherited rule fields are not returned.

Parameters:
grammarClass - the class of the Grammar for which rule fields must be found
Returns:
the rule fields declared in this class, excluding the inherited ones
See Also:
getAllRuleFields

getAllRuleFields

public static List<Field> getAllRuleFields(Class grammarClass)
Find all direct and indirect rule fields declared in the given Grammar class. Inherited rule fields are also returned.

Parameters:
grammarClass - the class of the Grammar for which rule fields must be found
Returns:
the rule fields declared in this class, as well as the inherited ones
See Also:
getRuleFields

rule

public Rule rule(GrammarRuleKey ruleKey)
Allows to obtain an instance of grammar rule, which was constructed by LexerlessGrammarBuilder and LexerfulGrammarBuilder.

Since:
1.18

getRootRule

public abstract Rule getRootRule()
Each Grammar has always an entry point whose name is usually by convention the "Computation Unit".

Returns:
the entry point of this Grammar


Copyright © 2009-2014 SonarSource. All Rights Reserved.