antlr
Class MakeGrammar

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

public class MakeGrammar
extends DefineGrammarSymbols


Field Summary
protected  Stack blocks
           
protected  boolean grammarError
           
protected  antlr.RuleRefElement lastRuleRef
           
protected  int nested
           
protected  RuleBlock ruleBlock
           
protected  antlr.RuleEndElement ruleEnd
           
 
Fields inherited from class antlr.DefineGrammarSymbols
grammar, grammars, headerActions, numLexers, numParsers, numTreeParsers, tokenManagers, tool
 
Constructor Summary
MakeGrammar(Tool tool_, String[] args_, LLkAnalyzer analyzer_)
           
 
Method Summary
 void abortGrammar()
          Abort the processing of a grammar (due to syntax errors)
protected  void addElementToCurrentAlt(antlr.AlternativeElement e)
           
 void beginAlt(boolean doAutoGen_)
           
 void beginChildList()
           
 void beginExceptionGroup()
          Add an exception group to a rule (currently a no-op)
 void beginExceptionSpec(Token label)
          Add an exception spec to an exception group or rule block
 void beginSubRule(Token label, Token start, boolean not)
           
 void beginTree(Token tok)
           
 antlr.BlockContext context()
           
static RuleBlock createNextTokenRule(Grammar g, Vector lexRules, String rname)
          Used to build nextToken() for the lexer.
 void defineRuleName(Token r, String access, boolean ruleAutoGen, String docComment)
          Define a lexer or parser rule
 void endAlt()
           
 void endChildList()
           
 void endExceptionGroup()
           
 void endExceptionSpec()
           
 void endGrammar()
          Called at the end of processing a grammar
 void endRule(String rule)
           
 void endSubRule()
           
 void endTree()
           
 void hasError()
          Remember that a major error occured in the grammar
 void noAutoGenSubRule()
           
 void oneOrMoreSubRule()
           
 void optionalSubRule()
           
 void refAction(Token action)
           
 void refArgAction(Token action)
           
 void refCharLiteral(Token lit, Token label, boolean inverted, int autoGenType, boolean lastInRule)
           
 void refCharRange(Token t1, Token t2, Token label, int autoGenType, boolean lastInRule)
           
 void refElementOption(Token option, Token value)
           
 void refExceptionHandler(Token exTypeAndName, Token action)
          Add an exception handler to an exception spec
 void refInitAction(Token action)
           
 void refMemberAction(Token act)
           
 void refPreambleAction(Token act)
           
 void refReturnAction(Token returnAction)
           
 void refRule(Token idAssign, Token r, Token label, Token args, int autoGenType)
           
 void refSemPred(Token pred)
           
 void refStringLiteral(Token lit, Token label, int autoGenType, boolean lastInRule)
           
 void refToken(Token idAssign, Token t, Token label, Token args, boolean inverted, int autoGenType, boolean lastInRule)
          Reference a token
 void refTokenRange(Token t1, Token t2, Token label, int autoGenType, boolean lastInRule)
           
 void refTokensSpecElementOption(Token tok, Token option, Token value)
           
 void refTreeSpecifier(Token treeSpec)
           
 void refWildcard(Token t, Token label, int autoGenType)
           
 void reset()
          Get ready to process a new grammar
 void setArgOfRuleRef(Token argAction)
           
static void setBlock(antlr.AlternativeBlock b, antlr.AlternativeBlock src)
           
 void setRuleOption(Token key, Token value)
           
 void setSubruleOption(Token key, Token value)
           
 void setUserExceptions(String thr)
           
 void synPred()
           
 void zeroOrMoreSubRule()
           
 
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 antlr.RuleRefElement lastRuleRef

ruleEnd

protected antlr.RuleEndElement ruleEnd

ruleBlock

protected RuleBlock ruleBlock

nested

protected int nested

grammarError

protected boolean grammarError
Constructor Detail

MakeGrammar

public MakeGrammar(Tool tool_,
                   String[] args_,
                   LLkAnalyzer analyzer_)
Method Detail

abortGrammar

public void abortGrammar()
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(antlr.AlternativeElement e)

beginAlt

public void beginAlt(boolean doAutoGen_)
Specified by:
beginAlt in interface ANTLRGrammarParseBehavior
Overrides:
beginAlt in class DefineGrammarSymbols

beginChildList

public void beginChildList()
Specified by:
beginChildList in interface ANTLRGrammarParseBehavior
Overrides:
beginChildList in class DefineGrammarSymbols

beginExceptionGroup

public void beginExceptionGroup()
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)
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,
                         Token start,
                         boolean not)
Specified by:
beginSubRule in interface ANTLRGrammarParseBehavior
Overrides:
beginSubRule in class DefineGrammarSymbols

beginTree

public void beginTree(Token tok)
               throws SemanticException
Specified by:
beginTree in interface ANTLRGrammarParseBehavior
Overrides:
beginTree in class DefineGrammarSymbols
SemanticException

context

public antlr.BlockContext context()

createNextTokenRule

public static RuleBlock createNextTokenRule(Grammar g,
                                            Vector lexRules,
                                            String rname)
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.

defineRuleName

public void defineRuleName(Token r,
                           String access,
                           boolean ruleAutoGen,
                           String docComment)
                    throws SemanticException
Description copied from class: DefineGrammarSymbols
Define a lexer or parser rule

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

endAlt

public void endAlt()
Specified by:
endAlt in interface ANTLRGrammarParseBehavior
Overrides:
endAlt in class DefineGrammarSymbols

endChildList

public void endChildList()
Specified by:
endChildList in interface ANTLRGrammarParseBehavior
Overrides:
endChildList in class DefineGrammarSymbols

endExceptionGroup

public void endExceptionGroup()
Specified by:
endExceptionGroup in interface ANTLRGrammarParseBehavior
Overrides:
endExceptionGroup in class DefineGrammarSymbols

endExceptionSpec

public void endExceptionSpec()
Specified by:
endExceptionSpec in interface ANTLRGrammarParseBehavior
Overrides:
endExceptionSpec in class DefineGrammarSymbols

endGrammar

public void endGrammar()
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)
Specified by:
endRule in interface ANTLRGrammarParseBehavior
Overrides:
endRule in class DefineGrammarSymbols

endSubRule

public void endSubRule()
Specified by:
endSubRule in interface ANTLRGrammarParseBehavior
Overrides:
endSubRule in class DefineGrammarSymbols

endTree

public void endTree()
Specified by:
endTree in interface ANTLRGrammarParseBehavior
Overrides:
endTree in class DefineGrammarSymbols

hasError

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

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

noAutoGenSubRule

public void noAutoGenSubRule()

oneOrMoreSubRule

public void oneOrMoreSubRule()
Specified by:
oneOrMoreSubRule in interface ANTLRGrammarParseBehavior
Overrides:
oneOrMoreSubRule in class DefineGrammarSymbols

optionalSubRule

public void optionalSubRule()
Specified by:
optionalSubRule in interface ANTLRGrammarParseBehavior
Overrides:
optionalSubRule in class DefineGrammarSymbols

refAction

public void refAction(Token action)
Specified by:
refAction in interface ANTLRGrammarParseBehavior
Overrides:
refAction in class DefineGrammarSymbols

setUserExceptions

public void setUserExceptions(String thr)
Specified by:
setUserExceptions in interface ANTLRGrammarParseBehavior
Overrides:
setUserExceptions in class DefineGrammarSymbols

refArgAction

public void refArgAction(Token action)
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)
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)
Specified by:
refCharRange in interface ANTLRGrammarParseBehavior
Overrides:
refCharRange in class DefineGrammarSymbols

refTokensSpecElementOption

public void refTokensSpecElementOption(Token tok,
                                       Token option,
                                       Token value)
Specified by:
refTokensSpecElementOption in interface ANTLRGrammarParseBehavior
Overrides:
refTokensSpecElementOption in class DefineGrammarSymbols

refElementOption

public void refElementOption(Token option,
                             Token value)
Specified by:
refElementOption in interface ANTLRGrammarParseBehavior
Overrides:
refElementOption in class DefineGrammarSymbols

refExceptionHandler

public void refExceptionHandler(Token exTypeAndName,
                                Token action)
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)
Specified by:
refInitAction in interface ANTLRGrammarParseBehavior
Overrides:
refInitAction in class DefineGrammarSymbols

refMemberAction

public void refMemberAction(Token act)
Specified by:
refMemberAction in interface ANTLRGrammarParseBehavior
Overrides:
refMemberAction in class DefineGrammarSymbols

refPreambleAction

public void refPreambleAction(Token act)
Specified by:
refPreambleAction in interface ANTLRGrammarParseBehavior
Overrides:
refPreambleAction in class DefineGrammarSymbols

refReturnAction

public void refReturnAction(Token returnAction)
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)
Specified by:
refRule in interface ANTLRGrammarParseBehavior
Overrides:
refRule in class DefineGrammarSymbols

refSemPred

public void refSemPred(Token pred)
Specified by:
refSemPred in interface ANTLRGrammarParseBehavior
Overrides:
refSemPred in class DefineGrammarSymbols

refStringLiteral

public void refStringLiteral(Token lit,
                             Token label,
                             int autoGenType,
                             boolean lastInRule)
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)
Description copied from class: DefineGrammarSymbols
Reference a token

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)
Specified by:
refTokenRange in interface ANTLRGrammarParseBehavior
Overrides:
refTokenRange in class DefineGrammarSymbols

refTreeSpecifier

public void refTreeSpecifier(Token treeSpec)
Specified by:
refTreeSpecifier in interface ANTLRGrammarParseBehavior
Overrides:
refTreeSpecifier in class DefineGrammarSymbols

refWildcard

public void refWildcard(Token t,
                        Token label,
                        int autoGenType)
Specified by:
refWildcard in interface ANTLRGrammarParseBehavior
Overrides:
refWildcard in class DefineGrammarSymbols

reset

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

Overrides:
reset in class DefineGrammarSymbols

setArgOfRuleRef

public void setArgOfRuleRef(Token argAction)
Specified by:
setArgOfRuleRef in interface ANTLRGrammarParseBehavior
Overrides:
setArgOfRuleRef in class DefineGrammarSymbols

setBlock

public static void setBlock(antlr.AlternativeBlock b,
                            antlr.AlternativeBlock src)

setRuleOption

public void setRuleOption(Token key,
                          Token value)
Specified by:
setRuleOption in interface ANTLRGrammarParseBehavior
Overrides:
setRuleOption in class DefineGrammarSymbols

setSubruleOption

public void setSubruleOption(Token key,
                             Token value)
Specified by:
setSubruleOption in interface ANTLRGrammarParseBehavior
Overrides:
setSubruleOption in class DefineGrammarSymbols

synPred

public void synPred()
Specified by:
synPred in interface ANTLRGrammarParseBehavior
Overrides:
synPred in class DefineGrammarSymbols

zeroOrMoreSubRule

public void zeroOrMoreSubRule()
Specified by:
zeroOrMoreSubRule in interface ANTLRGrammarParseBehavior
Overrides:
zeroOrMoreSubRule in class DefineGrammarSymbols


Copyright 1999-2003 Oliver Zeigermann. All Rights Reserved.