antlr.preprocessor

Class Grammar

class Grammar extends Object

Field Summary
protected booleanalreadyExpanded
protected ToolantlrTool
protected StringexportVocab
protected StringfileName
protected Hierarchyhier
protected StringimportVocab
protected StringmemberAction
protected Stringname
protected IndexedVectoroptions
protected StringpreambleAction
protected booleanpredefined
protected IndexedVectorrules
protected booleanspecifiedVocabulary
protected StringsuperClass
if not derived from another grammar, might still specify a non-ANTLR class to derive from like this "class T extends Parser(MyParserClass);"
protected StringsuperGrammar
protected StringtokenSection
protected Stringtype
Constructor Summary
Grammar(Tool tool, String name, String superGrammar, IndexedVector rules)
Method Summary
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

alreadyExpanded

protected boolean alreadyExpanded

antlrTool

protected Tool antlrTool

exportVocab

protected String exportVocab

fileName

protected String fileName

hier

protected Hierarchy hier

importVocab

protected String importVocab

memberAction

protected String memberAction

name

protected String name

options

protected IndexedVector options

preambleAction

protected String preambleAction

predefined

protected boolean predefined

rules

protected IndexedVector rules

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);"

superGrammar

protected String superGrammar

tokenSection

protected String tokenSection

type

protected String type

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()

inherit

public void inherit(Option o, Grammar superG)

inherit

public void inherit(Rule r, Grammar superG)

inherit

public void inherit(String memberAction, Grammar superG)

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)

toString

public String toString()