antlr.preprocessor

Class Grammar


(package private) class Grammar
extends Object

Field Summary

protected boolean
alreadyExpanded
protected Tool
antlrTool
protected String
exportVocab
protected String
fileName
protected Hierarchy
hier
protected String
importVocab
protected String
memberAction
protected String
name
protected IndexedVector
options
protected String
preambleAction
protected boolean
predefined
protected IndexedVector
rules
protected boolean
specifiedVocabulary
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);"
protected String
superGrammar
protected String
tokenSection
protected String
type

Constructor Summary

Grammar(Tool tool, String name, String superGrammar, IndexedVector rules)

Method Summary

void
addOption(Option o)
void
addRule(Rule r)
void
expandInPlace()
Copy all nonoverridden rules, vocabulary, and options into this grammar from supergrammar chain.
String
getFileName()
String
getName()
IndexedVector
getOptions()
IndexedVector
getRules()
Grammar
getSuperGrammar()
String
getSuperGrammarName()
String
getType()
void
inherit(String memberAction, Grammar superG)
void
inherit(Option o, Grammar superG)
void
inherit(Rule r, Grammar superG)
boolean
isPredefined()
void
setFileName(String f)
void
setHierarchy(Hierarchy hier)
void
setMemberAction(String a)
void
setOptions(IndexedVector options)
void
setPreambleAction(String a)
void
setPredefined(boolean b)
void
setTokenSection(String tk)
void
setType(String t)
String
toString()

Field Details

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 Details

Grammar

public Grammar(Tool tool,
               String name,
               String superGrammar,
               IndexedVector rules)

Method Details

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(String memberAction,
                    Grammar superG)


inherit

public void inherit(Option o,
                    Grammar superG)


inherit

public void inherit(Rule r,
                    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()