Package antlr.preprocessor
Class Grammar
- java.lang.Object
-
- antlr.preprocessor.Grammar
-
class Grammar extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanalreadyExpandedprotected ToolantlrToolprotected StringexportVocabprotected StringfileNameprotected Hierarchyhierprotected StringimportVocabprotected StringmemberActionprotected Stringnameprotected IndexedVectoroptionsprotected StringpreambleActionprotected booleanpredefinedprotected IndexedVectorrulesprotected booleanspecifiedVocabularyprotected StringsuperClassif not derived from another grammar, might still specify a non-ANTLR class to derive from like this "class T extends Parser(MyParserClass);"protected StringsuperGrammarprotected StringtokenSectionprotected Stringtype
-
Constructor Summary
Constructors Constructor Description Grammar(Tool tool, String name, String superGrammar, IndexedVector rules)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddOption(Option o)voidaddRule(Rule r)voidexpandInPlace()Copy all nonoverridden rules, vocabulary, and options into this grammar from supergrammar chain.StringgetFileName()StringgetName()IndexedVectorgetOptions()IndexedVectorgetRules()GrammargetSuperGrammar()StringgetSuperGrammarName()StringgetType()voidinherit(Option o, Grammar superG)voidinherit(Rule r, Grammar superG)voidinherit(String memberAction, Grammar superG)booleanisPredefined()voidsetFileName(String f)voidsetHierarchy(Hierarchy hier)voidsetMemberAction(String a)voidsetOptions(IndexedVector options)voidsetPreambleAction(String a)voidsetPredefined(boolean b)voidsetTokenSection(String tk)voidsetType(String t)StringtoString()
-
-
-
Field Detail
-
name
protected String name
-
fileName
protected String fileName
-
superGrammar
protected String superGrammar
-
type
protected String type
-
rules
protected IndexedVector rules
-
options
protected IndexedVector options
-
tokenSection
protected String tokenSection
-
preambleAction
protected String preambleAction
-
memberAction
protected String memberAction
-
hier
protected Hierarchy hier
-
predefined
protected boolean predefined
-
alreadyExpanded
protected boolean alreadyExpanded
-
specifiedVocabulary
protected boolean specifiedVocabulary
-
superClass
protected String superClass
if not derived from another grammar, might still specify a non-ANTLR class to derive from like this "class T extends Parser(MyParserClass);"
-
importVocab
protected String importVocab
-
exportVocab
protected String exportVocab
-
antlrTool
protected Tool antlrTool
-
-
Constructor Detail
-
Grammar
public Grammar(Tool tool, String name, String superGrammar, IndexedVector rules)
-
-
Method Detail
-
addOption
public void addOption(Option o)
-
addRule
public void addRule(Rule r)
-
expandInPlace
public void expandInPlace()
Copy all nonoverridden rules, vocabulary, and options into this grammar from supergrammar chain. The change is made in place; e.g., this grammar's vector of rules gets bigger. This has side-effects: all grammars on path to root of hierarchy are expanded also.
-
getFileName
public String getFileName()
-
getName
public String getName()
-
getOptions
public IndexedVector getOptions()
-
getRules
public IndexedVector getRules()
-
getSuperGrammar
public Grammar getSuperGrammar()
-
getSuperGrammarName
public String getSuperGrammarName()
-
getType
public String getType()
-
isPredefined
public boolean isPredefined()
-
setFileName
public void setFileName(String f)
-
setHierarchy
public void setHierarchy(Hierarchy hier)
-
setMemberAction
public void setMemberAction(String a)
-
setOptions
public void setOptions(IndexedVector options)
-
setPreambleAction
public void setPreambleAction(String a)
-
setPredefined
public void setPredefined(boolean b)
-
setTokenSection
public void setTokenSection(String tk)
-
setType
public void setType(String t)
-
-