antlr
Class MakeGrammar

java.lang.Object
  |
  +--antlr.DefineGrammarSymbols
        |
        +--antlr.MakeGrammar
All Implemented Interfaces:
ANTLRGrammarParseBehavior

public class MakeGrammar
extends DefineGrammarSymbols

Untamed:


Field Summary
protected  Stack blocks
           
(package private)  ExceptionSpec currentExceptionSpec
           
protected  boolean grammarError
           
protected  RuleRefElement lastRuleRef
           
protected  int nested
           
protected  RuleBlock ruleBlock
           
protected  RuleEndElement ruleEnd
           
 
Fields inherited from class antlr.DefineGrammarSymbols
analyzer, args, DEFAULT_TOKENMANAGER_NAME, grammar, grammars, headerActions, language, numLexers, numParsers, numTreeParsers, thePreambleAction, tokenManagers, tool
 
Constructor Summary
MakeGrammar(Tool tool_, String[] args_, LLkAnalyzer analyzer_)
          Enabled:
 
Method Summary
 void abortGrammar()
          Enabled: Abort the processing of a grammar (due to syntax errors)
protected  void addElementToCurrentAlt(AlternativeElement e)
           
 void beginAlt(boolean doAutoGen_)
          Enabled:
 void beginChildList()
          Enabled:
 void beginExceptionGroup()
          Enabled: Add an exception group to a rule (currently a no-op)
 void beginExceptionSpec(Token label)
          Enabled: Add an exception spec to an exception group or rule block
 void beginSubRule(Token label, int line, boolean not)
          Enabled:
 void beginTree(int line)
          Enabled:
 BlockContext context()
          Enabled:
static RuleBlock createNextTokenRule(Grammar g, Vector lexRules, String rname)
          Enabled: Used to build nextToken() for the lexer.
private  AlternativeBlock createOptionalRuleRef(String rule, int line)
          Return block as if they had typed: "( rule )?"
 void defineRuleName(Token r, String access, boolean ruleAutoGen, String docComment)
          Enabled:
 void endAlt()
          Enabled:
 void endChildList()
          Enabled:
 void endExceptionGroup()
          Enabled:
 void endExceptionSpec()
          Enabled:
 void endGrammar()
          Enabled: Called at the end of processing a grammar
 void endRule(String rule)
          Enabled:
 void endSubRule()
          Enabled:
 void endTree()
          Enabled:
 void hasError()
          Enabled: Remember that a major error occured in the grammar
private  void labelElement(AlternativeElement el, Token label)
           
 void noAutoGenSubRule()
          Enabled:
 void oneOrMoreSubRule()
          Enabled:
 void optionalSubRule()
          Enabled:
 void refAction(Token action)
          Enabled:
 void refArgAction(Token action)
          Enabled:
 void refCharLiteral(Token lit, Token label, boolean inverted, int autoGenType, boolean lastInRule)
          Enabled:
 void refCharRange(Token t1, Token t2, Token label, int autoGenType, boolean lastInRule)
          Enabled:
 void refElementOption(Token option, Token value)
          Enabled:
 void refExceptionHandler(Token exTypeAndName, Token action)
          Enabled: Add an exception handler to an exception spec
 void refInitAction(Token action)
          Enabled:
 void refMemberAction(Token act)
          Enabled:
 void refPreambleAction(Token act)
          Enabled:
 void refReturnAction(Token returnAction)
          Enabled:
 void refRule(Token idAssign, Token r, Token label, Token args, int autoGenType)
          Enabled:
 void refSemPred(Token pred)
          Enabled:
 void refStringLiteral(Token lit, Token label, int autoGenType, boolean lastInRule)
          Enabled:
 void refToken(Token idAssign, Token t, Token label, Token args, boolean inverted, int autoGenType, boolean lastInRule)
          Enabled:
 void refTokenRange(Token t1, Token t2, Token label, int autoGenType, boolean lastInRule)
          Enabled:
 void refTokensSpecElementOption(Token tok, Token option, Token value)
          Enabled:
 void refTreeSpecifier(Token treeSpec)
          Enabled:
 void refWildcard(Token t, Token label, int autoGenType)
          Enabled:
 void reset()
          Enabled: Get ready to process a new grammar
 void setArgOfRuleRef(Token argAction)
          Enabled:
static void setBlock(AlternativeBlock b, AlternativeBlock src)
          Enabled:
 void setRuleOption(Token key, Token value)
          Enabled:
 void setSubruleOption(Token key, Token value)
          Enabled:
 void setUserExceptions(String thr)
          Enabled:
 void synPred()
          Enabled:
 void zeroOrMoreSubRule()
          Enabled:
 
Methods inherited from class antlr.DefineGrammarSymbols
_refStringLiteral, _refToken, defineToken, endOptions, getHeaderAction, noASTSubRule, refHeaderAction, setCharVocabulary, setFileOption, setGrammarOption, startLexer, startParser, startTreeWalker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

blocks

protected Stack blocks

lastRuleRef

protected RuleRefElement lastRuleRef

ruleEnd

protected RuleEndElement ruleEnd

ruleBlock

protected RuleBlock ruleBlock

nested

protected int nested

grammarError

protected boolean grammarError

currentExceptionSpec

ExceptionSpec currentExceptionSpec
Constructor Detail

MakeGrammar

public MakeGrammar(Tool tool_,
                   String[] args_,
                   LLkAnalyzer analyzer_)
Enabled:

Method Detail

abortGrammar

public void abortGrammar()
Enabled: Abort the processing of a grammar (due to syntax errors)

Specified by:
abortGrammar in interface ANTLRGrammarParseBehavior
Overrides:
abortGrammar in class DefineGrammarSymbols

addElementToCurrentAlt

protected void addElementToCurrentAlt(AlternativeElement e)

beginAlt

public void beginAlt(boolean doAutoGen_)
Enabled:

Specified by:
beginAlt in interface ANTLRGrammarParseBehavior
Overrides:
beginAlt in class DefineGrammarSymbols

beginChildList

public void beginChildList()
Enabled:

Specified by:
beginChildList in interface ANTLRGrammarParseBehavior
Overrides:
beginChildList in class DefineGrammarSymbols

beginExceptionGroup

public void beginExceptionGroup()
Enabled: Add an exception group to a rule (currently a no-op)

Specified by:
beginExceptionGroup in interface ANTLRGrammarParseBehavior
Overrides:
beginExceptionGroup in class DefineGrammarSymbols

beginExceptionSpec

public void beginExceptionSpec(Token label)
Enabled: Add an exception spec to an exception group or rule block

Specified by:
beginExceptionSpec in interface ANTLRGrammarParseBehavior
Overrides:
beginExceptionSpec in class DefineGrammarSymbols

beginSubRule

public void beginSubRule(Token label,
                         int line,
                         boolean not)
Enabled:

Specified by:
beginSubRule in interface ANTLRGrammarParseBehavior
Overrides:
beginSubRule in class DefineGrammarSymbols

beginTree

public void beginTree(int line)
               throws SemanticException
Enabled:

Specified by:
beginTree in interface ANTLRGrammarParseBehavior
Overrides:
beginTree in class DefineGrammarSymbols
SemanticException

context

public BlockContext context()
Enabled:


createNextTokenRule

public static RuleBlock createNextTokenRule(Grammar g,
                                            Vector lexRules,
                                            String rname)
Enabled: Used to build nextToken() for the lexer. This builds a rule which has every "public" rule in the given Vector of rules as it's alternate. Each rule ref generates a Token object.

Parameters:
g - The Grammar that is being processed
lexRules - A vector of lexer rules that will be used to create an alternate block.
rname - The name of the resulting rule.

createOptionalRuleRef

private AlternativeBlock createOptionalRuleRef(String rule,
                                               int line)
Return block as if they had typed: "( rule )?"


defineRuleName

public void defineRuleName(Token r,
                           String access,
                           boolean ruleAutoGen,
                           String docComment)
                    throws SemanticException
Enabled:

Specified by:
defineRuleName in interface ANTLRGrammarParseBehavior
Overrides:
defineRuleName in class DefineGrammarSymbols
SemanticException

endAlt

public void endAlt()
Enabled:

Specified by:
endAlt in interface ANTLRGrammarParseBehavior
Overrides:
endAlt in class DefineGrammarSymbols

endChildList

public void endChildList()
Enabled:

Specified by:
endChildList in interface ANTLRGrammarParseBehavior
Overrides:
endChildList in class DefineGrammarSymbols

endExceptionGroup

public void endExceptionGroup()
Enabled:

Specified by:
endExceptionGroup in interface ANTLRGrammarParseBehavior
Overrides:
endExceptionGroup in class DefineGrammarSymbols

endExceptionSpec

public void endExceptionSpec()
Enabled:

Specified by:
endExceptionSpec in interface ANTLRGrammarParseBehavior
Overrides:
endExceptionSpec in class DefineGrammarSymbols

endGrammar

public void endGrammar()
Enabled: Called at the end of processing a grammar

Specified by:
endGrammar in interface ANTLRGrammarParseBehavior
Overrides:
endGrammar in class DefineGrammarSymbols

endRule

public void endRule(String rule)
Enabled:

Specified by:
endRule in interface ANTLRGrammarParseBehavior
Overrides:
endRule in class DefineGrammarSymbols

endSubRule

public void endSubRule()
Enabled:

Specified by:
endSubRule in interface ANTLRGrammarParseBehavior
Overrides:
endSubRule in class DefineGrammarSymbols

endTree

public void endTree()
Enabled:

Specified by:
endTree in interface ANTLRGrammarParseBehavior
Overrides:
endTree in class DefineGrammarSymbols

hasError

public void hasError()
Enabled: Remember that a major error occured in the grammar

Specified by:
hasError in interface ANTLRGrammarParseBehavior
Overrides:
hasError in class DefineGrammarSymbols

labelElement

private void labelElement(AlternativeElement el,
                          Token label)

noAutoGenSubRule

public void noAutoGenSubRule()
Enabled:


oneOrMoreSubRule

public void oneOrMoreSubRule()
Enabled:

Specified by:
oneOrMoreSubRule in interface ANTLRGrammarParseBehavior
Overrides:
oneOrMoreSubRule in class DefineGrammarSymbols

optionalSubRule

public void optionalSubRule()
Enabled:

Specified by:
optionalSubRule in interface ANTLRGrammarParseBehavior
Overrides:
optionalSubRule in class DefineGrammarSymbols

refAction

public void refAction(Token action)
Enabled:

Specified by:
refAction in interface ANTLRGrammarParseBehavior
Overrides:
refAction in class DefineGrammarSymbols

setUserExceptions

public void setUserExceptions(String thr)
Enabled:

Specified by:
setUserExceptions in interface ANTLRGrammarParseBehavior
Overrides:
setUserExceptions in class DefineGrammarSymbols

refArgAction

public void refArgAction(Token action)
Enabled:

Specified by:
refArgAction in interface ANTLRGrammarParseBehavior
Overrides:
refArgAction in class DefineGrammarSymbols

refCharLiteral

public void refCharLiteral(Token lit,
                           Token label,
                           boolean inverted,
                           int autoGenType,
                           boolean lastInRule)
Enabled:

Specified by:
refCharLiteral in interface ANTLRGrammarParseBehavior
Overrides:
refCharLiteral in class DefineGrammarSymbols

refCharRange

public void refCharRange(Token t1,
                         Token t2,
                         Token label,
                         int autoGenType,
                         boolean lastInRule)
Enabled:

Specified by:
refCharRange in interface ANTLRGrammarParseBehavior
Overrides:
refCharRange in class DefineGrammarSymbols

refTokensSpecElementOption

public void refTokensSpecElementOption(Token tok,
                                       Token option,
                                       Token value)
Enabled:

Specified by:
refTokensSpecElementOption in interface ANTLRGrammarParseBehavior
Overrides:
refTokensSpecElementOption in class DefineGrammarSymbols

refElementOption

public void refElementOption(Token option,
                             Token value)
Enabled:

Specified by:
refElementOption in interface ANTLRGrammarParseBehavior
Overrides:
refElementOption in class DefineGrammarSymbols

refExceptionHandler

public void refExceptionHandler(Token exTypeAndName,
                                Token action)
Enabled: Add an exception handler to an exception spec

Specified by:
refExceptionHandler in interface ANTLRGrammarParseBehavior
Overrides:
refExceptionHandler in class DefineGrammarSymbols

refInitAction

public void refInitAction(Token action)
Enabled:

Specified by:
refInitAction in interface ANTLRGrammarParseBehavior
Overrides:
refInitAction in class DefineGrammarSymbols

refMemberAction

public void refMemberAction(Token act)
Enabled:

Specified by:
refMemberAction in interface ANTLRGrammarParseBehavior
Overrides:
refMemberAction in class DefineGrammarSymbols

refPreambleAction

public void refPreambleAction(Token act)
Enabled:

Specified by:
refPreambleAction in interface ANTLRGrammarParseBehavior
Overrides:
refPreambleAction in class DefineGrammarSymbols

refReturnAction

public void refReturnAction(Token returnAction)
Enabled:

Specified by:
refReturnAction in interface ANTLRGrammarParseBehavior
Overrides:
refReturnAction in class DefineGrammarSymbols

refRule

public void refRule(Token idAssign,
                    Token r,
                    Token label,
                    Token args,
                    int autoGenType)
Enabled:

Specified by:
refRule in interface ANTLRGrammarParseBehavior
Overrides:
refRule in class DefineGrammarSymbols

refSemPred

public void refSemPred(Token pred)
Enabled:

Specified by:
refSemPred in interface ANTLRGrammarParseBehavior
Overrides:
refSemPred in class DefineGrammarSymbols

refStringLiteral

public void refStringLiteral(Token lit,
                             Token label,
                             int autoGenType,
                             boolean lastInRule)
Enabled:

Specified by:
refStringLiteral in interface ANTLRGrammarParseBehavior
Overrides:
refStringLiteral in class DefineGrammarSymbols

refToken

public void refToken(Token idAssign,
                     Token t,
                     Token label,
                     Token args,
                     boolean inverted,
                     int autoGenType,
                     boolean lastInRule)
Enabled:

Specified by:
refToken in interface ANTLRGrammarParseBehavior
Overrides:
refToken in class DefineGrammarSymbols

refTokenRange

public void refTokenRange(Token t1,
                          Token t2,
                          Token label,
                          int autoGenType,
                          boolean lastInRule)
Enabled:

Specified by:
refTokenRange in interface ANTLRGrammarParseBehavior
Overrides:
refTokenRange in class DefineGrammarSymbols

refTreeSpecifier

public void refTreeSpecifier(Token treeSpec)
Enabled:

Specified by:
refTreeSpecifier in interface ANTLRGrammarParseBehavior
Overrides:
refTreeSpecifier in class DefineGrammarSymbols

refWildcard

public void refWildcard(Token t,
                        Token label,
                        int autoGenType)
Enabled:

Specified by:
refWildcard in interface ANTLRGrammarParseBehavior
Overrides:
refWildcard in class DefineGrammarSymbols

reset

public void reset()
Enabled: Get ready to process a new grammar

Overrides:
reset in class DefineGrammarSymbols

setArgOfRuleRef

public void setArgOfRuleRef(Token argAction)
Enabled:

Specified by:
setArgOfRuleRef in interface ANTLRGrammarParseBehavior
Overrides:
setArgOfRuleRef in class DefineGrammarSymbols

setBlock

public static void setBlock(AlternativeBlock b,
                            AlternativeBlock src)
Enabled:


setRuleOption

public void setRuleOption(Token key,
                          Token value)
Enabled:

Specified by:
setRuleOption in interface ANTLRGrammarParseBehavior
Overrides:
setRuleOption in class DefineGrammarSymbols

setSubruleOption

public void setSubruleOption(Token key,
                             Token value)
Enabled:

Specified by:
setSubruleOption in interface ANTLRGrammarParseBehavior
Overrides:
setSubruleOption in class DefineGrammarSymbols

synPred

public void synPred()
Enabled:

Specified by:
synPred in interface ANTLRGrammarParseBehavior
Overrides:
synPred in class DefineGrammarSymbols

zeroOrMoreSubRule

public void zeroOrMoreSubRule()
Enabled:

Specified by:
zeroOrMoreSubRule in interface ANTLRGrammarParseBehavior
Overrides:
zeroOrMoreSubRule in class DefineGrammarSymbols


comments?