[e-cvs] cvs commit: e/src/jsrc/org/quasiliteral/astro AstroSchema.java AstroToken.java BaseSchema.java

markm@eros.cs.jhu.edu markm@eros.cs.jhu.edu
Sun, 2 Dec 2001 01:01:53 -0500


markm       01/12/02 01:01:50

  Modified:    src/jsrc/antlr ANTLRError.java ANTLRException.java
                        ANTLRGrammarParseBehavior.java ANTLRHashString.java
                        ANTLRLexer.java ANTLRParser.java
                        ANTLRStringBuffer.java ANTLRTokdefLexer.java
                        ANTLRTokdefParser.java
                        ANTLRTokdefParserTokenTypes.java
                        ANTLRTokenTypes.java ASTFactory.java
                        ASTIterator.java ASTNULLType.java ASTPair.java
                        ASTVisitor.java ActionElement.java
                        ActionTransInfo.java Alternative.java
                        AlternativeBlock.java AlternativeElement.java
                        BaseAST.java BlockContext.java BlockEndElement.java
                        BlockWithImpliedExitPath.java ByteBuffer.java
                        CharBuffer.java CharFormatter.java
                        CharLiteralElement.java CharQueue.java
                        CharRangeElement.java CharScanner.java
                        CharStreamException.java CharStreamIOException.java
                        CodeGenerator.java CommonAST.java
                        CommonASTWithHiddenTokens.java
                        CommonHiddenStreamToken.java CommonToken.java
                        CppBlockFinishingInfo.java CppCharFormatter.java
                        CppCodeGenerator.java DefaultFileLineFormatter.java
                        DefaultToolErrorHandler.java
                        DefineGrammarSymbols.java
                        DiagnosticCodeGenerator.java DumpASTVisitor.java
                        ExceptionHandler.java ExceptionSpec.java
                        FileCopyException.java FileLineFormatter.java
                        Grammar.java GrammarAnalyzer.java GrammarAtom.java
                        GrammarElement.java GrammarSymbol.java
                        HTMLCodeGenerator.java ImportVocabTokenManager.java
                        InputBuffer.java JavaBlockFinishingInfo.java
                        JavaCharFormatter.java JavaCodeGenerator.java
                        LLkAnalyzer.java LLkGrammarAnalyzer.java
                        LLkParser.java LexerGrammar.java
                        LexerSharedInputState.java Lookahead.java
                        MakeGrammar.java MismatchedCharException.java
                        MismatchedTokenException.java NameSpace.java
                        NoViableAltException.java
                        NoViableAltForCharException.java
                        OneOrMoreBlock.java Parser.java ParserGrammar.java
                        ParserSharedInputState.java
                        RecognitionException.java RuleBlock.java
                        RuleEndElement.java RuleRefElement.java
                        RuleSymbol.java SatherBlockFinishingInfo.java
                        SatherCharFormatter.java SatherCodeGenerator.java
                        SemanticException.java SimpleTokenManager.java
                        StringLiteralElement.java StringLiteralSymbol.java
                        SynPredBlock.java Token.java TokenBuffer.java
                        TokenManager.java TokenQueue.java
                        TokenRangeElement.java TokenRefElement.java
                        TokenStream.java TokenStreamBasicFilter.java
                        TokenStreamException.java
                        TokenStreamHiddenTokenFilter.java
                        TokenStreamIOException.java
                        TokenStreamRecognitionException.java
                        TokenStreamRetryException.java
                        TokenStreamSelector.java TokenSymbol.java Tool.java
                        ToolErrorHandler.java TreeBlockContext.java
                        TreeElement.java TreeParser.java
                        TreeParserSharedInputState.java
                        TreeSpecifierNode.java TreeWalkerGrammar.java
                        WildcardElement.java ZeroOrMoreBlock.java
               src/jsrc/antlr/actions/cpp ActionLexer.java
                        ActionLexerTokenTypes.java
               src/jsrc/antlr/actions/java ActionLexer.java
                        ActionLexerTokenTypes.java
               src/jsrc/antlr/actions/sather ActionLexer.java
                        ActionLexerTokenTypes.java
               src/jsrc/antlr/collections AST.java ASTEnumeration.java
                        Enumerator.java List.java Stack.java
               src/jsrc/antlr/collections/impl ASTArray.java
                        ASTEnumerator.java BitSet.java IndexedVector.java
                        IntRange.java LLCell.java LLEnumeration.java
                        LList.java Vector.java VectorEnumeration.java
                        VectorEnumerator.java
               src/jsrc/antlr/debug DebuggingCharScanner.java
                        DebuggingInputBuffer.java DebuggingParser.java
                        Event.java GuessingEvent.java
                        InputBufferAdapter.java InputBufferEvent.java
                        InputBufferEventSupport.java
                        InputBufferListener.java InputBufferReporter.java
                        LLkDebuggingParser.java ListenerBase.java
                        MessageAdapter.java MessageEvent.java
                        MessageListener.java NewLineEvent.java
                        NewLineListener.java ParserAdapter.java
                        ParserController.java ParserEventSupport.java
                        ParserListener.java ParserMatchAdapter.java
                        ParserMatchEvent.java ParserMatchListener.java
                        ParserReporter.java ParserTokenAdapter.java
                        ParserTokenEvent.java ParserTokenListener.java
                        SemanticPredicateAdapter.java
                        SemanticPredicateEvent.java
                        SemanticPredicateListener.java
                        SyntacticPredicateAdapter.java
                        SyntacticPredicateEvent.java
                        SyntacticPredicateListener.java TraceAdapter.java
                        TraceEvent.java TraceListener.java Tracer.java
               src/jsrc/antlr/debug/misc ASTFrame.java JTreeASTModel.java
                        JTreeASTPanel.java
               src/jsrc/antlr/preprocessor Grammar.java GrammarFile.java
                        Hierarchy.java Option.java Preprocessor.java
                        PreprocessorLexer.java PreprocessorTokenTypes.java
                        Rule.java Tool.java
               src/jsrc/net/captp/jcomm CapTPConnection.java CapTPMgr.java
                        CapTPReplacer.java CapTPResolver.java
                        DelayedRedirector.java Far3Desc.java
                        FarHandler.java ImportDesc.java IncomingDesc.java
                        Introducer.java LocatorUnum.java LookupHandler.java
                        NewFarDesc.java NewRemotePromiseDesc.java
                        NonceLocator.java ObjectID.java ObjectRefDesc.java
                        Promise3Desc.java Redirector.java
                        RemoteHandler.java RemotePromiseHandler.java
                        Sturdifier.java SturdyRef.java
               src/jsrc/net/captp/tables AnswersTable.java CommTable.java
                        ExportsTable.java ImportsTable.java
                        NearGiftTable.java PromiseGiftTable.java
                        QuestionsTable.java SwissTable.java Vine.java
               src/jsrc/net/vattp/data AuthSecrets.java
                        ConnectionAttemptFailed.java DES.java
                        DataCommThunk.java DataPath.java Decrypt3DES.java
                        Encrypt3DES.java ListenThread.java
                        MsgTransformer.java RecvThread.java SendThread.java
                        StartUpProtocol.java StreamMessage.java
                        Suspend.java UserThread.java VatTPConnection.java
                        VatTPMgr.java
               src/jsrc/net/vattp/security ESecureRandom.java
                        MicroTime.java Native.java
                        SecureRandomCrewSeedIt.java TimerJitterEntropy.java
               src/jsrc/net/vattp/tunnel HTTPClient.java
                        HTTPConnectionHandler.java HTTPInputStream.java
                        HTTPMsgID.java HTTPServeMain.java
                        HTTPSocketCtl.java TCPConnectionListener.java
               src/jsrc/net/vattp/vls VatLocationServer.java
               src/jsrc/org/apache/oro/text/regex CharStringPointer.java
                        MalformedPatternException.java MatchResult.java
                        OpCode.java Pattern.java PatternCompiler.java
                        PatternMatcher.java PatternMatcherInput.java
                        Perl5Compiler.java Perl5Debug.java
                        Perl5MatchResult.java Perl5Matcher.java
                        Perl5Pattern.java Perl5Repetition.java
                        Perl5Substitution.java StringSubstitution.java
                        Substitution.java Util.java
               src/jsrc/org/capml/dom Element.java Node.java Text.java
               src/jsrc/org/capml/quasi QuasiContent.java
                        QuasiContentExprHole.java QuasiContentList.java
                        QuasiContentPattHole.java QuasiElement.java
                        QuasiText.java XMLQuasiParser.java
               src/jsrc/org/erights/e/develop/assertion
                        AssertionFailed.java
               src/jsrc/org/erights/e/develop/exception
                        ExceptionNoticer.java
               src/jsrc/org/erights/e/develop/trace Trace.java
                        TraceBuffer.java TraceDateToString.java
                        TraceLog.java TraceLogDescriptor.java
                        TraceMessageStringifier.java
                        TraceSubsystemMediator.java
                        TraceTxtVersionNamer.java TraceVersionNamer.java
               src/jsrc/org/erights/e/elang/evm AssignExpr.java
                        CallExpr.java CatchExpr.java CdrPattern.java
                        DefineExpr.java EExpr.java EImpl.java EMeta.java
                        ENode.java EScript.java EscapeExpr.java
                        FinalPattern.java FinallyExpr.java
                        FrameFinalNounExpr.java HideExpr.java IfExpr.java
                        IgnorePattern.java ListPattern.java
                        LiteralExpr.java LiteralNounExpr.java
                        LiteralSlotNounExpr.java LocalFinalNounExpr.java
                        MatchBindExpr.java MetaExpr.java NounExpr.java
                        NounPattern.java ObjectExpr.java OuterNounExpr.java
                        Pattern.java QuasiLiteralExpr.java
                        QuasiLiteralPatt.java QuasiPatternExpr.java
                        QuasiPatternPatt.java ScopeExpr.java SendExpr.java
                        SeqExpr.java SlotExpr.java SuchThatPattern.java
                        VarPattern.java
               src/jsrc/org/erights/e/elang/interp InteractiveInterp.java
                        Loader.java LoaderScope.java PackageScope.java
                        ScopeSetup.java URLGetter.java
                        UnsafeLoaderScope.java
               src/jsrc/org/erights/e/elang/scope ContourBoundary.java
                        EvalContext.java ForwardingSlot.java
                        OuterScope.java ScopeMap.java ScopeMapBase.java
                        ScopeMapLink.java UndefinedVariableException.java
               src/jsrc/org/erights/e/elang/syntax Assoc.java EBuilder.java
                        ELexer.java EParser.java MsgPatt.java URIKit.java
               src/jsrc/org/erights/e/elang/visitors BindFramesVisitor.java
                        CopyVisitor.java
               src/jsrc/org/erights/e/elib/base ClassDesc.java
               src/jsrc/org/erights/e/elib/deflect Deflector.java
               src/jsrc/org/erights/e/elib/eio TextReader.java
               src/jsrc/org/erights/e/elib/prim BERunner.java
                        CallThunk.java ConstructorNode.java E.java
                        FERunner.java FERunnerEvent.java
                        InstanceMethodNode.java JavaMemberNode.java
                        MirandaMethods.java NowRunnable.java Runner.java
                        RunnerThread.java SacrificialComponent.java
                        ScriptMaker.java ShutDownVatException.java
                        StaticMaker.java StaticMethodNode.java VTable.java
                        VarGetterNode.java VarSetterNode.java WeakPtr.java
                        WeakPtrThread.java
               src/jsrc/org/erights/e/elib/quasi Identifiers.java
                        Substituter.java
               src/jsrc/org/erights/e/elib/ref BufferingRef.java
                        DisconnectedRef.java ExternalRef.java FarRef.java
                        LocalResolver.java NearRef.java Proxy.java Ref.java
                        RemotePromise.java SlotRef.java StemCell.java
                        SwitchableRef.java Switcher.java
                        UnconnectedRef.java WhenBrokenReactor.java
                        WhenResolvedReactor.java
               src/jsrc/org/erights/e/elib/sealing Brand.java
                        SealedBox.java Sealer.java Unsealer.java
               src/jsrc/org/erights/e/elib/slot FinalSlot.java
                        SettableSlot.java SimpleSlot.java
               src/jsrc/org/erights/e/elib/tables ArrayedList.java
                        AssocFunc.java AtomicTwine.java Column.java
                        CompositeTwine.java ConstList.java
                        ConstListImpl.java ConstMap.java ConstMapImpl.java
                        ConstSet.java ConstSubclassSet.java EList.java
                        EMap.java ESet.java EmptyTwine.java
                        EqualityKeyColumn.java FlexList.java
                        FlexListImpl.java FlexMap.java FlexMapImpl.java
                        FlexSet.java IdentityKeyColumn.java
                        IdentityMap.java IndirectCompFunc.java
                        IntColumn.java IntTable.java KeyColumn.java
                        LocatedTwine.java ROList.java ROMap.java ROSet.java
                        RefColumn.java SamenessKeyColumn.java
                        ScalarColumn.java ShareCount.java
                        SimpleCompFunc.java SimpleTwine.java Twine.java
                        VoidColumn.java WeakKey.java WeakValue.java
               src/jsrc/org/erights/e/elib/util
                        AlreadyDefinedException.java
                        ArityMismatchException.java DynamicCollection.java
               src/jsrc/org/erights/e/extern/timer Clock.java Timeout.java
                        TimerQEntry.java TimerThread.java TimerWatcher.java
               src/jsrc/org/erights/e/meta/java/io ReadOnlyFile.java
               src/jsrc/org/erights/e/meta/java/lang BooleanSugar.java
                        Bufferer.java ByteGuardSugar.java
                        ClassGuardSugar.java DoubleGuardSugar.java
                        FloatGuardSugar.java IntegerGuardSugar.java
                        InterfaceGuardSugar.java LongGuardSugar.java
                        ShortGuardSugar.java StringGuardSugar.java
                        ThrowableGuardSugar.java VoidGuardSugar.java
               src/jsrc/org/erights/e/meta/java/math
                        BigIntegerGuardSugar.java
               src/jsrc/org/erights/e/meta/org/erights/e/elib/base
                        TypeDescGuardSugar.java
               src/jsrc/org/erights/e/meta/org/erights/e/elib/ref
                        RefGuardSugar.java
               src/jsrc/org/erights/e/meta/org/erights/e/elib/slot
                        SlotGuardGuardSugar.java ValueGuardGuardSugar.java
               src/jsrc/org/erights/e/meta/org/erights/e/elib/tables
                        EListGuardSugar.java
               src/jsrc/org/erights/e/ui/elmer EInterpAdapter.java
               src/jsrc/org/erights/e/ui/jed EditGroup.java JedMain.java
               src/jsrc/org/quasiliteral/astro AstroSchema.java
                        AstroToken.java BaseSchema.java
  Log:
  Just formatting

Revision  Changes    Path
1.5       +3 -3      e/src/jsrc/antlr/ANTLRError.java

Index: ANTLRError.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ANTLRError.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ANTLRError.java	2001/11/29 20:33:25	1.4
+++ ANTLRError.java	2001/12/02 06:01:28	1.5
@@ -4,7 +4,7 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: ANTLRError.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: ANTLRError.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 public class ANTLRError extends Error {
@@ -13,7 +13,7 @@
      * ANTLRError constructor comment.
      */
     public ANTLRError() {
-	super();
+        super();
     }
 
     /**
@@ -21,6 +21,6 @@
      * @param s java.lang.String
      */
     public ANTLRError(String s) {
-	super(s);
+        super(s);
     }
 }



1.4       +8 -7      e/src/jsrc/antlr/ANTLRException.java

Index: ANTLRException.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ANTLRException.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ANTLRException.java	2001/10/26 03:08:50	1.3
+++ ANTLRException.java	2001/12/02 06:01:28	1.4
@@ -4,15 +4,16 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: ANTLRException.java,v 1.3 2001/10/26 03:08:50 markm Exp $
+ * $Id: ANTLRException.java,v 1.4 2001/12/02 06:01:28 markm Exp $
  */
 
 public class ANTLRException extends Exception {
 
-	public ANTLRException() {
-		super();
-	}
-	public ANTLRException(String s) {
-		super(s);
-	}
+    public ANTLRException() {
+        super();
+    }
+
+    public ANTLRException(String s) {
+        super(s);
+    }
 }



1.4       +113 -60   e/src/jsrc/antlr/ANTLRGrammarParseBehavior.java

Index: ANTLRGrammarParseBehavior.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ANTLRGrammarParseBehavior.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ANTLRGrammarParseBehavior.java	2001/10/26 03:08:50	1.3
+++ ANTLRGrammarParseBehavior.java	2001/12/02 06:01:28	1.4
@@ -4,69 +4,122 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: ANTLRGrammarParseBehavior.java,v 1.3 2001/10/26 03:08:50 markm Exp $
+ * $Id: ANTLRGrammarParseBehavior.java,v 1.4 2001/12/02 06:01:28 markm Exp $
  */
 
 import antlr.collections.impl.BitSet;
 
 public interface ANTLRGrammarParseBehavior {
-	public void abortGrammar();
-	public void beginAlt(boolean doAST_);
-	public void beginChildList();
-	// Exception handling
-	public void beginExceptionGroup();
-	public void beginExceptionSpec(Token label);
-	public void beginSubRule(Token label, int line, boolean not);
-	// Trees
-	public void beginTree(int line)  throws SemanticException ;
-	public void defineRuleName(Token r, String access, boolean ruleAST, String docComment) throws SemanticException;
-	public void defineToken(Token tokname, Token tokliteral);
-	public void endAlt();
-	public void endChildList();
-	public void endExceptionGroup();
-	public void endExceptionSpec();
-	public void endGrammar();
-	public void endOptions();
-	public void endRule(String r);
-	public void endSubRule();
-	public void endTree();
-	public void hasError();
-	public void noASTSubRule();
-	public void oneOrMoreSubRule();
-	public void optionalSubRule();
-	public void refAction(Token action);
-	public void refArgAction(Token action);
-	public void setUserExceptions(String thr);
-	public void refCharLiteral(Token lit, Token label, boolean inverted, int autoGenType, boolean lastInRule);
-	public void refCharRange(Token t1, Token t2, Token label, int autoGenType, boolean lastInRule);
-	public void refElementOption(Token option, Token value);
-	public void refTokensSpecElementOption(Token tok, Token option, Token value);
-	public void refExceptionHandler(Token exTypeAndName, Token action);
-	public void refHeaderAction(Token name,Token act);
-	public void refInitAction(Token action);
-	public void refMemberAction(Token act);
-	public void refPreambleAction(Token act);
-	public void refReturnAction(Token returnAction);
-	public void refRule(Token idAssign, Token r, Token label, Token arg, int autoGenType);
-	public void refSemPred(Token pred);
-	public void refStringLiteral(Token lit, Token label, int autoGenType, boolean lastInRule);
-	public void refToken(Token assignId, Token t, Token label, Token args,
-		boolean inverted, int autoGenType, boolean lastInRule);
-	public void refTokenRange(Token t1, Token t2, Token label, int autoGenType, boolean lastInRule);
-	// Tree specifiers
-	public void refTreeSpecifier(Token treeSpec);
-	public void refWildcard(Token t, Token label, int autoGenType);
-	public void setArgOfRuleRef(Token argaction);
-	public void setCharVocabulary(BitSet b);
-	// Options
-	public void setFileOption(Token key, Token value, String filename);
-	public void setGrammarOption(Token key, Token value);
-	public void setRuleOption(Token key, Token value);
-	public void setSubruleOption(Token key, Token value);
-	public void startLexer(String file, Token name, String superClass, String doc);
-	// Flow control for grammars
-	public void startParser(String file, Token name, String superClass, String doc);
-	public void startTreeWalker(String file, Token name, String superClass, String doc);
-	public void synPred();
-	public void zeroOrMoreSubRule();
+
+    public void abortGrammar();
+
+    public void beginAlt(boolean doAST_);
+
+    public void beginChildList();
+
+    // Exception handling
+    public void beginExceptionGroup();
+
+    public void beginExceptionSpec(Token label);
+
+    public void beginSubRule(Token label, int line, boolean not);
+
+    // Trees
+    public void beginTree(int line) throws SemanticException;
+
+    public void defineRuleName(Token r, String access, boolean ruleAST, String docComment) throws SemanticException;
+
+    public void defineToken(Token tokname, Token tokliteral);
+
+    public void endAlt();
+
+    public void endChildList();
+
+    public void endExceptionGroup();
+
+    public void endExceptionSpec();
+
+    public void endGrammar();
+
+    public void endOptions();
+
+    public void endRule(String r);
+
+    public void endSubRule();
+
+    public void endTree();
+
+    public void hasError();
+
+    public void noASTSubRule();
+
+    public void oneOrMoreSubRule();
+
+    public void optionalSubRule();
+
+    public void refAction(Token action);
+
+    public void refArgAction(Token action);
+
+    public void setUserExceptions(String thr);
+
+    public void refCharLiteral(Token lit, Token label, boolean inverted, int autoGenType, boolean lastInRule);
+
+    public void refCharRange(Token t1, Token t2, Token label, int autoGenType, boolean lastInRule);
+
+    public void refElementOption(Token option, Token value);
+
+    public void refTokensSpecElementOption(Token tok, Token option, Token value);
+
+    public void refExceptionHandler(Token exTypeAndName, Token action);
+
+    public void refHeaderAction(Token name, Token act);
+
+    public void refInitAction(Token action);
+
+    public void refMemberAction(Token act);
+
+    public void refPreambleAction(Token act);
+
+    public void refReturnAction(Token returnAction);
+
+    public void refRule(Token idAssign, Token r, Token label, Token arg, int autoGenType);
+
+    public void refSemPred(Token pred);
+
+    public void refStringLiteral(Token lit, Token label, int autoGenType, boolean lastInRule);
+
+    public void refToken(Token assignId, Token t, Token label, Token args,
+                         boolean inverted, int autoGenType, boolean lastInRule);
+
+    public void refTokenRange(Token t1, Token t2, Token label, int autoGenType, boolean lastInRule);
+
+    // Tree specifiers
+    public void refTreeSpecifier(Token treeSpec);
+
+    public void refWildcard(Token t, Token label, int autoGenType);
+
+    public void setArgOfRuleRef(Token argaction);
+
+    public void setCharVocabulary(BitSet b);
+
+    // Options
+    public void setFileOption(Token key, Token value, String filename);
+
+    public void setGrammarOption(Token key, Token value);
+
+    public void setRuleOption(Token key, Token value);
+
+    public void setSubruleOption(Token key, Token value);
+
+    public void startLexer(String file, Token name, String superClass, String doc);
+
+    // Flow control for grammars
+    public void startParser(String file, Token name, String superClass, String doc);
+
+    public void startTreeWalker(String file, Token name, String superClass, String doc);
+
+    public void synPred();
+
+    public void zeroOrMoreSubRule();
 }



1.5       +95 -83    e/src/jsrc/antlr/ANTLRHashString.java

Index: ANTLRHashString.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ANTLRHashString.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ANTLRHashString.java	2001/11/29 20:33:25	1.4
+++ ANTLRHashString.java	2001/12/02 06:01:28	1.5
@@ -4,7 +4,7 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: ANTLRHashString.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: ANTLRHashString.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 // class implements a String-like object whose sole purpose is to be
@@ -12,86 +12,98 @@
 // information about case sensitivity.
 
 public class ANTLRHashString {
-	// only one of s or buf is non-null
-	private String s;
-	private char[] buf;
-	private int len;
-	private CharScanner lexer;
-	private static final int prime = 151;
-
-
-	public ANTLRHashString(char[] buf, int length, CharScanner lexer) {
-		this.lexer = lexer;
-		setBuffer(buf, length);
-	}
-	// Hash strings constructed this way are unusable until setBuffer or setString are called.
-	public ANTLRHashString(CharScanner lexer) {
-		this.lexer = lexer;
-	}
-	public ANTLRHashString(String s, CharScanner lexer) {
-		this.lexer = lexer;
-		setString(s);
-	}
-	private final char charAt(int index) {
-		return (s!=null) ? s.charAt(index) : buf[index];
-	}
-	// Return true if o is an ANTLRHashString equal to this.
-	public boolean equals(Object o) {
-		if (!(o instanceof ANTLRHashString) && !(o instanceof String)) {
-			return false;
-		}
-
-		ANTLRHashString s;
-		if ( o instanceof String ) {
-			s = new ANTLRHashString((String)o,lexer);
-		}
-		else {
-			s = (ANTLRHashString)o;
-		}
-		int l = length();
-		if (s.length() != l) {
-			return false;
-		}
-		if (lexer.getCaseSensitiveLiterals()) {
-			for (int i = 0; i < l; i++) {
-				if (charAt(i) != s.charAt(i)) {
-					return false;
-				}
-			}
-		} else {
-			for (int i = 0; i < l; i++) {
-				if (lexer.toLower(charAt(i)) != lexer.toLower(s.charAt(i))) {
-					return false;
-				}
-			}
-		}
-		return true;
-	}
-	public int hashCode() {
-		int hashval = 0;
-		int l = length();
-
-		if (lexer.getCaseSensitiveLiterals()) {
-			for (int i = 0; i < l; i++) {
-				hashval = hashval * prime + charAt(i);
-			}
-		} else {
-			for (int i = 0; i < l; i++) {
-				hashval = hashval * prime + lexer.toLower(charAt(i));
-			}
-		}
-		return hashval;
-	}
-	private final int length() {
-		return (s!=null) ? s.length() : len;
-	}
-	public void setBuffer(char[] buf, int length) {
-		this.buf = buf;
-		this.len = length;
-		s = null;
-	}
-	public void setString(String s) {
-		this.s = s;
-		buf = null;
-	}
+
+    // only one of s or buf is non-null
+    private String s;
+
+    private char[] buf;
+
+    private int len;
+
+    private CharScanner lexer;
+
+    private static final int prime = 151;
+
+
+    public ANTLRHashString(char[] buf, int length, CharScanner lexer) {
+        this.lexer = lexer;
+        setBuffer(buf, length);
+    }
+
+    // Hash strings constructed this way are unusable until setBuffer or setString are called.
+    public ANTLRHashString(CharScanner lexer) {
+        this.lexer = lexer;
+    }
+
+    public ANTLRHashString(String s, CharScanner lexer) {
+        this.lexer = lexer;
+        setString(s);
+    }
+
+    private final char charAt(int index) {
+        return (s != null) ? s.charAt(index) : buf[index];
+    }
+
+    // Return true if o is an ANTLRHashString equal to this.
+    public boolean equals(Object o) {
+        if (!(o instanceof ANTLRHashString) && !(o instanceof String)) {
+            return false;
+        }
+
+        ANTLRHashString s;
+        if (o instanceof String) {
+            s = new ANTLRHashString((String)o, lexer);
+        } else {
+            s = (ANTLRHashString)o;
+        }
+        int l = length();
+        if (s.length() != l) {
+            return false;
+        }
+        if (lexer.getCaseSensitiveLiterals()) {
+            for (int i = 0; i < l; i++) {
+                if (charAt(i) != s.charAt(i)) {
+                    return false;
+                }
+            }
+        } else {
+            for (int i = 0; i < l; i++) {
+                if (lexer.toLower(charAt(i)) != lexer.toLower(s.charAt(i))) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    public int hashCode() {
+        int hashval = 0;
+        int l = length();
+
+        if (lexer.getCaseSensitiveLiterals()) {
+            for (int i = 0; i < l; i++) {
+                hashval = hashval * prime + charAt(i);
+            }
+        } else {
+            for (int i = 0; i < l; i++) {
+                hashval = hashval * prime + lexer.toLower(charAt(i));
+            }
+        }
+        return hashval;
+    }
+
+    private final int length() {
+        return (s != null) ? s.length() : len;
+    }
+
+    public void setBuffer(char[] buf, int length) {
+        this.buf = buf;
+        this.len = length;
+        s = null;
+    }
+
+    public void setString(String s) {
+        this.s = s;
+        buf = null;
+    }
 }



1.5       +2091 -1604e/src/jsrc/antlr/ANTLRLexer.java

Index: ANTLRLexer.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ANTLRLexer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ANTLRLexer.java	2001/11/29 20:33:25	1.4
+++ ANTLRLexer.java	2001/12/02 06:01:28	1.5
@@ -8,1611 +8,2098 @@
 import java.io.Reader;
 import java.util.Hashtable;
 
-public class ANTLRLexer extends antlr.CharScanner implements ANTLRTokenTypes, TokenStream
- {
+public class ANTLRLexer extends antlr.CharScanner implements ANTLRTokenTypes, TokenStream {
 
-	/**Convert 'c' to an integer char value. */
-	public static int escapeCharValue(String cs) {
-		//System.out.println("escapeCharValue("+cs+")");
-		if ( cs.charAt(1)!='\\' ) return 0;
-		switch ( cs.charAt(2) ) {
-		case 'b' : return '\b';
-		case 'r' : return '\r';
-		case 't' : return '\t';
-		case 'n' : return '\n';
-		case 'f' : return '\f';
-		case '"' : return '\"';
-		case '\'' :return '\'';
-		case '\\' :return '\\';
-
-		case 'u' :
-			// Unicode char
-			if (cs.length() != 8) {
-				return 0;
-			}
-			else {
-				return
-					Character.digit(cs.charAt(3), 16) * 16 * 16 * 16 +
-					Character.digit(cs.charAt(4), 16) * 16 * 16 +
-					Character.digit(cs.charAt(5), 16) * 16 +
-					Character.digit(cs.charAt(6), 16);
-			}
-
-		case '0' :
-		case '1' :
-		case '2' :
-		case '3' :
-			if ( cs.length()>5 && Character.isDigit(cs.charAt(4)) ) {
-				return (cs.charAt(2)-'0')*8*8 + (cs.charAt(3)-'0')*8 + (cs.charAt(4)-'0');
-			}
-			if ( cs.length()>4 && Character.isDigit(cs.charAt(3)) ) {
-				return (cs.charAt(2)-'0')*8 + (cs.charAt(3)-'0');
-			}
-			return cs.charAt(2)-'0';
-
-		case '4' :
-		case '5' :
-		case '6' :
-		case '7' :
-			if ( cs.length()>4 && Character.isDigit(cs.charAt(3)) ) {
-				return (cs.charAt(2)-'0')*8 + (cs.charAt(3)-'0');
-			}
-			return cs.charAt(2)-'0';
-
-		default :
-			return 0;
-		}
-	}
-
-	public static int tokenTypeForCharLiteral(String lit) {
-		if ( lit.length()>3 ) {  // does char contain escape?
-			return escapeCharValue(lit);
-		}
-		else {
-			return lit.charAt(1);
-		}
-	}
-public ANTLRLexer(InputStream in) {
-	this(new ByteBuffer(in));
-}
-public ANTLRLexer(Reader in) {
-	this(new CharBuffer(in));
-}
-public ANTLRLexer(InputBuffer ib) {
-	this(new LexerSharedInputState(ib));
-}
-public ANTLRLexer(LexerSharedInputState state) {
-	super(state);
-	literals = new Hashtable();
-	literals.put(new ANTLRHashString("Parser", this), new Integer(30));
-	literals.put(new ANTLRHashString("catch", this), new Integer(41));
-	literals.put(new ANTLRHashString("Lexer", this), new Integer(12));
-	literals.put(new ANTLRHashString("exception", this), new Integer(40));
-	literals.put(new ANTLRHashString("class", this), new Integer(10));
-	literals.put(new ANTLRHashString("lexclass", this), new Integer(9));
-	literals.put(new ANTLRHashString("public", this), new Integer(32));
-	literals.put(new ANTLRHashString("header", this), new Integer(5));
-	literals.put(new ANTLRHashString("options", this), new Integer(51));
-	literals.put(new ANTLRHashString("charVocabulary", this), new Integer(18));
-	literals.put(new ANTLRHashString("tokens", this), new Integer(4));
-	literals.put(new ANTLRHashString("returns", this), new Integer(36));
-	literals.put(new ANTLRHashString("TreeParser", this), new Integer(13));
-	literals.put(new ANTLRHashString("private", this), new Integer(33));
-	literals.put(new ANTLRHashString("protected", this), new Integer(31));
-	literals.put(new ANTLRHashString("throws", this), new Integer(38));
-	literals.put(new ANTLRHashString("extends", this), new Integer(11));
-caseSensitiveLiterals = true;
-setCaseSensitive(true);
-}
+    /**Convert 'c' to an integer char value. */
+    public static int escapeCharValue(String cs) {
+        //System.out.println("escapeCharValue("+cs+")");
+        if (cs.charAt(1) != '\\') return 0;
+        switch (cs.charAt(2)) {
+            case 'b':
+                return '\b';
+            case 'r':
+                return '\r';
+            case 't':
+                return '\t';
+            case 'n':
+                return '\n';
+            case 'f':
+                return '\f';
+            case '"':
+                return '\"';
+            case '\'':
+                return '\'';
+            case '\\':
+                return '\\';
+
+            case 'u':
+                // Unicode char
+                if (cs.length() != 8) {
+                    return 0;
+                } else {
+                    return
+                      Character.digit(cs.charAt(3), 16) * 16 * 16 * 16 +
+                      Character.digit(cs.charAt(4), 16) * 16 * 16 +
+                      Character.digit(cs.charAt(5), 16) * 16 +
+                      Character.digit(cs.charAt(6), 16);
+                }
+
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+                if (cs.length() > 5 && Character.isDigit(cs.charAt(4))) {
+                    return (cs.charAt(2) - '0') * 8 * 8 + (cs.charAt(3) - '0') * 8 + (cs.charAt(4) - '0');
+                }
+                if (cs.length() > 4 && Character.isDigit(cs.charAt(3))) {
+                    return (cs.charAt(2) - '0') * 8 + (cs.charAt(3) - '0');
+                }
+                return cs.charAt(2) - '0';
+
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+                if (cs.length() > 4 && Character.isDigit(cs.charAt(3))) {
+                    return (cs.charAt(2) - '0') * 8 + (cs.charAt(3) - '0');
+                }
+                return cs.charAt(2) - '0';
+
+            default :
+                return 0;
+        }
+    }
+
+    public static int tokenTypeForCharLiteral(String lit) {
+        if (lit.length() > 3) { // does char contain escape?
+            return escapeCharValue(lit);
+        } else {
+            return lit.charAt(1);
+        }
+    }
+
+    public ANTLRLexer(InputStream in) {
+        this(new ByteBuffer(in));
+    }
+
+    public ANTLRLexer(Reader in) {
+        this(new CharBuffer(in));
+    }
+
+    public ANTLRLexer(InputBuffer ib) {
+        this(new LexerSharedInputState(ib));
+    }
+
+    public ANTLRLexer(LexerSharedInputState state) {
+        super(state);
+        literals = new Hashtable();
+        literals.put(new ANTLRHashString("Parser", this), new Integer(30));
+        literals.put(new ANTLRHashString("catch", this), new Integer(41));
+        literals.put(new ANTLRHashString("Lexer", this), new Integer(12));
+        literals.put(new ANTLRHashString("exception", this), new Integer(40));
+        literals.put(new ANTLRHashString("class", this), new Integer(10));
+        literals.put(new ANTLRHashString("lexclass", this), new Integer(9));
+        literals.put(new ANTLRHashString("public", this), new Integer(32));
+        literals.put(new ANTLRHashString("header", this), new Integer(5));
+        literals.put(new ANTLRHashString("options", this), new Integer(51));
+        literals.put(new ANTLRHashString("charVocabulary", this), new Integer(18));
+        literals.put(new ANTLRHashString("tokens", this), new Integer(4));
+        literals.put(new ANTLRHashString("returns", this), new Integer(36));
+        literals.put(new ANTLRHashString("TreeParser", this), new Integer(13));
+        literals.put(new ANTLRHashString("private", this), new Integer(33));
+        literals.put(new ANTLRHashString("protected", this), new Integer(31));
+        literals.put(new ANTLRHashString("throws", this), new Integer(38));
+        literals.put(new ANTLRHashString("extends", this), new Integer(11));
+        caseSensitiveLiterals = true;
+        setCaseSensitive(true);
+    }
+
+    public Token nextToken() throws TokenStreamException {
+        Token theRetToken = null;
+        tryAgain:
+                for (; ;) {
+                    Token _token = null;
+                    int _ttype = Token.INVALID_TYPE;
+                    resetText();
+                    try { // for char stream error handling
+                        try { // for lexical error handling
+                            switch (LA(1)) {
+                                case '\t':
+                                case '\n':
+                                case '\r':
+                                case ' ':
+                                    {
+                                        mWS(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '/':
+                                    {
+                                        mCOMMENT(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '<':
+                                    {
+                                        mOPEN_ELEMENT_OPTION(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '>':
+                                    {
+                                        mCLOSE_ELEMENT_OPTION(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case ',':
+                                    {
+                                        mCOMMA(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '?':
+                                    {
+                                        mQUESTION(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '#':
+                                    {
+                                        mTREE_BEGIN(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '(':
+                                    {
+                                        mLPAREN(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case ')':
+                                    {
+                                        mRPAREN(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case ':':
+                                    {
+                                        mCOLON(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '*':
+                                    {
+                                        mSTAR(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '+':
+                                    {
+                                        mPLUS(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case ';':
+                                    {
+                                        mSEMI(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '^':
+                                    {
+                                        mCARET(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '!':
+                                    {
+                                        mBANG(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '|':
+                                    {
+                                        mOR(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '~':
+                                    {
+                                        mNOT_OP(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '}':
+                                    {
+                                        mRCURLY(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '\'':
+                                    {
+                                        mCHAR_LITERAL(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '"':
+                                    {
+                                        mSTRING_LITERAL(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '0':
+                                case '1':
+                                case '2':
+                                case '3':
+                                case '4':
+                                case '5':
+                                case '6':
+                                case '7':
+                                case '8':
+                                case '9':
+                                    {
+                                        mINT(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '[':
+                                    {
+                                        mARG_ACTION(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case '{':
+                                    {
+                                        mACTION(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case 'A':
+                                case 'B':
+                                case 'C':
+                                case 'D':
+                                case 'E':
+                                case 'F':
+                                case 'G':
+                                case 'H':
+                                case 'I':
+                                case 'J':
+                                case 'K':
+                                case 'L':
+                                case 'M':
+                                case 'N':
+                                case 'O':
+                                case 'P':
+                                case 'Q':
+                                case 'R':
+                                case 'S':
+                                case 'T':
+                                case 'U':
+                                case 'V':
+                                case 'W':
+                                case 'X':
+                                case 'Y':
+                                case 'Z':
+                                    {
+                                        mTOKEN_REF(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                case 'a':
+                                case 'b':
+                                case 'c':
+                                case 'd':
+                                case 'e':
+                                case 'f':
+                                case 'g':
+                                case 'h':
+                                case 'i':
+                                case 'j':
+                                case 'k':
+                                case 'l':
+                                case 'm':
+                                case 'n':
+                                case 'o':
+                                case 'p':
+                                case 'q':
+                                case 'r':
+                                case 's':
+                                case 't':
+                                case 'u':
+                                case 'v':
+                                case 'w':
+                                case 'x':
+                                case 'y':
+                                case 'z':
+                                    {
+                                        mRULE_REF(true);
+                                        theRetToken = _returnToken;
+                                        break;
+                                    }
+                                default:
+                                    if ((LA(1) == '=') && (LA(2) == '>')) {
+                                        mIMPLIES(true);
+                                        theRetToken = _returnToken;
+                                    } else if ((LA(1) == '.') && (LA(2) == '.')) {
+                                        mRANGE(true);
+                                        theRetToken = _returnToken;
+                                    } else if ((LA(1) == '=') && (true)) {
+                                        mASSIGN(true);
+                                        theRetToken = _returnToken;
+                                    } else if ((LA(1) == '.') && (true)) {
+                                        mWILDCARD(true);
+                                        theRetToken = _returnToken;
+                                    } else {
+                                        if (LA(1) == EOF_CHAR) {
+                                            uponEOF();
+                                            _returnToken = makeToken(Token.EOF_TYPE);
+                                        } else {
+                                            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                                        }
+                                    }
+                            }
+                            if (_returnToken == null) continue tryAgain; // found SKIP token
+                            _ttype = _returnToken.getType();
+                            _returnToken.setType(_ttype);
+                            return _returnToken;
+                        } catch (RecognitionException e) {
+                            throw new TokenStreamRecognitionException(e);
+                        }
+                    } catch (CharStreamException cse) {
+                        if (cse instanceof CharStreamIOException) {
+                            throw new TokenStreamIOException(((CharStreamIOException)cse).io);
+                        } else {
+                            throw new TokenStreamException(cse.getMessage());
+                        }
+                    }
+                }
+    }
+
+    public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = WS;
+        int _saveIndex;
+
+        {
+            switch (LA(1)) {
+                case ' ':
+                    {
+                        match(' ');
+                        break;
+                    }
+                case '\t':
+                    {
+                        match('\t');
+                        break;
+                    }
+                case '\n':
+                    {
+                        match('\n');
+                        if (inputState.guessing == 0) {
+                            newline();
+                        }
+                        break;
+                    }
+                default:
+                    if ((LA(1) == '\r') && (LA(2) == '\n')) {
+                        match('\r');
+                        match('\n');
+                        if (inputState.guessing == 0) {
+                            newline();
+                        }
+                    } else if ((LA(1) == '\r') && (true)) {
+                        match('\r');
+                        if (inputState.guessing == 0) {
+                            newline();
+                        }
+                    } else {
+                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                    }
+            }
+        }
+        if (inputState.guessing == 0) {
+            _ttype = Token.SKIP;
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mCOMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = COMMENT;
+        int _saveIndex;
+        Token t = null;
+
+        {
+            if ((LA(1) == '/') && (LA(2) == '/')) {
+                mSL_COMMENT(false);
+            } else if ((LA(1) == '/') && (LA(2) == '*')) {
+                mML_COMMENT(true);
+                t = _returnToken;
+                if (inputState.guessing == 0) {
+                    _ttype = t.getType();
+                }
+            } else {
+                throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+            }
+
+        }
+        if (inputState.guessing == 0) {
+            if (_ttype != DOC_COMMENT) _ttype = Token.SKIP;
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    protected final void mSL_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = SL_COMMENT;
+        int _saveIndex;
+
+        match("//");
+        {
+            _loop153:
+            do {
+                if ((_tokenSet_0.member(LA(1)))) {
+                    {
+                        match(_tokenSet_0);
+                    }
+                } else {
+                    break _loop153;
+                }
+
+            } while (true);
+        }
+        {
+            if ((LA(1) == '\r') && (LA(2) == '\n')) {
+                match('\r');
+                match('\n');
+            } else if ((LA(1) == '\r') && (true)) {
+                match('\r');
+            } else if ((LA(1) == '\n')) {
+                match('\n');
+            } else {
+                throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+            }
+
+        }
+        if (inputState.guessing == 0) {
+            newline();
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    protected final void mML_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = ML_COMMENT;
+        int _saveIndex;
+
+        match("/*");
+        {
+            if (((LA(1) == '*') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) && (LA(2) != '/')) {
+                match('*');
+                if (inputState.guessing == 0) {
+                    _ttype = DOC_COMMENT;
+                }
+            } else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
+            } else {
+                throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+            }
+
+        }
+        {
+            _loop159:
+            do {
+                // nongreedy exit test
+                if ((LA(1) == '*') && (LA(2) == '/')) break _loop159;
+                if ((LA(1) == '\r') && (LA(2) == '\n')) {
+                    match('\r');
+                    match('\n');
+                    if (inputState.guessing == 0) {
+                        newline();
+                    }
+                } else if ((LA(1) == '\r') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
+                    match('\r');
+                    if (inputState.guessing == 0) {
+                        newline();
+                    }
+                } else if ((_tokenSet_0.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
+                    {
+                        match(_tokenSet_0);
+                    }
+                } else if ((LA(1) == '\n')) {
+                    match('\n');
+                    if (inputState.guessing == 0) {
+                        newline();
+                    }
+                } else {
+                    break _loop159;
+                }
+
+            } while (true);
+        }
+        match("*/");
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mOPEN_ELEMENT_OPTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = OPEN_ELEMENT_OPTION;
+        int _saveIndex;
+
+        match('<');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mCLOSE_ELEMENT_OPTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = CLOSE_ELEMENT_OPTION;
+        int _saveIndex;
+
+        match('>');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = COMMA;
+        int _saveIndex;
+
+        match(',');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mQUESTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = QUESTION;
+        int _saveIndex;
+
+        match('?');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mTREE_BEGIN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = TREE_BEGIN;
+        int _saveIndex;
+
+        match("#(");
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mLPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = LPAREN;
+        int _saveIndex;
+
+        match('(');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mRPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = RPAREN;
+        int _saveIndex;
+
+        match(')');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mCOLON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = COLON;
+        int _saveIndex;
+
+        match(':');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mSTAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = STAR;
+        int _saveIndex;
+
+        match('*');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mPLUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = PLUS;
+        int _saveIndex;
+
+        match('+');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = ASSIGN;
+        int _saveIndex;
+
+        match('=');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mIMPLIES(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = IMPLIES;
+        int _saveIndex;
+
+        match("=>");
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mSEMI(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = SEMI;
+        int _saveIndex;
+
+        match(';');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mCARET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = CARET;
+        int _saveIndex;
+
+        match('^');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mBANG(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = BANG;
+        int _saveIndex;
+
+        match('!');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = OR;
+        int _saveIndex;
+
+        match('|');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mWILDCARD(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = WILDCARD;
+        int _saveIndex;
+
+        match('.');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mRANGE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = RANGE;
+        int _saveIndex;
+
+        match("..");
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mNOT_OP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = NOT_OP;
+        int _saveIndex;
+
+        match('~');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mRCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = RCURLY;
+        int _saveIndex;
+
+        match('}');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mCHAR_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = CHAR_LITERAL;
+        int _saveIndex;
+
+        match('\'');
+        {
+            switch (LA(1)) {
+                case '\\':
+                    {
+                        mESC(false);
+                        break;
+                    }
+                case '\u0003':
+                case '\u0004':
+                case '\u0005':
+                case '\u0006':
+                case '\u0007':
+                case '\u0008':
+                case '\t':
+                case '\n':
+                case '\u000b':
+                case '\u000c':
+                case '\r':
+                case '\u000e':
+                case '\u000f':
+                case '\u0010':
+                case '\u0011':
+                case '\u0012':
+                case '\u0013':
+                case '\u0014':
+                case '\u0015':
+                case '\u0016':
+                case '\u0017':
+                case '\u0018':
+                case '\u0019':
+                case '\u001a':
+                case '\u001b':
+                case '\u001c':
+                case '\u001d':
+                case '\u001e':
+                case '\u001f':
+                case ' ':
+                case '!':
+                case '"':
+                case '#':
+                case '$':
+                case '%':
+                case '&':
+                case '(':
+                case ')':
+                case '*':
+                case '+':
+                case ',':
+                case '-':
+                case '.':
+                case '/':
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                case '4':
+                case '5':
+                case '6':
+                case '7':
+                case '8':
+                case '9':
+                case ':':
+                case ';':
+                case '<':
+                case '=':
+                case '>':
+                case '?':
+                case '@':
+                case 'A':
+                case 'B':
+                case 'C':
+                case 'D':
+                case 'E':
+                case 'F':
+                case 'G':
+                case 'H':
+                case 'I':
+                case 'J':
+                case 'K':
+                case 'L':
+                case 'M':
+                case 'N':
+                case 'O':
+                case 'P':
+                case 'Q':
+                case 'R':
+                case 'S':
+                case 'T':
+                case 'U':
+                case 'V':
+                case 'W':
+                case 'X':
+                case 'Y':
+                case 'Z':
+                case '[':
+                case ']':
+                case '^':
+                case '_':
+                case '`':
+                case 'a':
+                case 'b':
+                case 'c':
+                case 'd':
+                case 'e':
+                case 'f':
+                case 'g':
+                case 'h':
+                case 'i':
+                case 'j':
+                case 'k':
+                case 'l':
+                case 'm':
+                case 'n':
+                case 'o':
+                case 'p':
+                case 'q':
+                case 'r':
+                case 's':
+                case 't':
+                case 'u':
+                case 'v':
+                case 'w':
+                case 'x':
+                case 'y':
+                case 'z':
+                case '{':
+                case '|':
+                case '}':
+                case '~':
+                    {
+                        matchNot('\'');
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                    }
+            }
+        }
+        match('\'');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    protected final void mESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = ESC;
+        int _saveIndex;
+
+        match('\\');
+        {
+            switch (LA(1)) {
+                case 'n':
+                    {
+                        match('n');
+                        break;
+                    }
+                case 'r':
+                    {
+                        match('r');
+                        break;
+                    }
+                case 't':
+                    {
+                        match('t');
+                        break;
+                    }
+                case 'b':
+                    {
+                        match('b');
+                        break;
+                    }
+                case 'f':
+                    {
+                        match('f');
+                        break;
+                    }
+                case 'w':
+                    {
+                        match('w');
+                        break;
+                    }
+                case 'a':
+                    {
+                        match('a');
+                        break;
+                    }
+                case '"':
+                    {
+                        match('"');
+                        break;
+                    }
+                case '\'':
+                    {
+                        match('\'');
+                        break;
+                    }
+                case '\\':
+                    {
+                        match('\\');
+                        break;
+                    }
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                    {
+                        {
+                            matchRange('0', '3');
+                        }
+                        {
+                            if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
+                                {
+                                    matchRange('0', '9');
+                                }
+                                {
+                                    if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
+                                        matchRange('0', '9');
+                                    } else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && (true)) {
+                                    } else {
+                                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                                    }
+
+                                }
+                            } else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && (true)) {
+                            } else {
+                                throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                            }
+
+                        }
+                        break;
+                    }
+                case '4':
+                case '5':
+                case '6':
+                case '7':
+                    {
+                        {
+                            matchRange('4', '7');
+                        }
+                        {
+                            if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
+                                {
+                                    matchRange('0', '9');
+                                }
+                            } else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && (true)) {
+                            } else {
+                                throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                            }
+
+                        }
+                        break;
+                    }
+                case 'u':
+                    {
+                        match('u');
+                        mXDIGIT(false);
+                        mXDIGIT(false);
+                        mXDIGIT(false);
+                        mXDIGIT(false);
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                    }
+            }
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mSTRING_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = STRING_LITERAL;
+        int _saveIndex;
+
+        match('"');
+        {
+            _loop184:
+            do {
+                switch (LA(1)) {
+                    case '\\':
+                        {
+                            mESC(false);
+                            break;
+                        }
+                    case '\u0003':
+                    case '\u0004':
+                    case '\u0005':
+                    case '\u0006':
+                    case '\u0007':
+                    case '\u0008':
+                    case '\t':
+                    case '\n':
+                    case '\u000b':
+                    case '\u000c':
+                    case '\r':
+                    case '\u000e':
+                    case '\u000f':
+                    case '\u0010':
+                    case '\u0011':
+                    case '\u0012':
+                    case '\u0013':
+                    case '\u0014':
+                    case '\u0015':
+                    case '\u0016':
+                    case '\u0017':
+                    case '\u0018':
+                    case '\u0019':
+                    case '\u001a':
+                    case '\u001b':
+                    case '\u001c':
+                    case '\u001d':
+                    case '\u001e':
+                    case '\u001f':
+                    case ' ':
+                    case '!':
+                    case '#':
+                    case '$':
+                    case '%':
+                    case '&':
+                    case '\'':
+                    case '(':
+                    case ')':
+                    case '*':
+                    case '+':
+                    case ',':
+                    case '-':
+                    case '.':
+                    case '/':
+                    case '0':
+                    case '1':
+                    case '2':
+                    case '3':
+                    case '4':
+                    case '5':
+                    case '6':
+                    case '7':
+                    case '8':
+                    case '9':
+                    case ':':
+                    case ';':
+                    case '<':
+                    case '=':
+                    case '>':
+                    case '?':
+                    case '@':
+                    case 'A':
+                    case 'B':
+                    case 'C':
+                    case 'D':
+                    case 'E':
+                    case 'F':
+                    case 'G':
+                    case 'H':
+                    case 'I':
+                    case 'J':
+                    case 'K':
+                    case 'L':
+                    case 'M':
+                    case 'N':
+                    case 'O':
+                    case 'P':
+                    case 'Q':
+                    case 'R':
+                    case 'S':
+                    case 'T':
+                    case 'U':
+                    case 'V':
+                    case 'W':
+                    case 'X':
+                    case 'Y':
+                    case 'Z':
+                    case '[':
+                    case ']':
+                    case '^':
+                    case '_':
+                    case '`':
+                    case 'a':
+                    case 'b':
+                    case 'c':
+                    case 'd':
+                    case 'e':
+                    case 'f':
+                    case 'g':
+                    case 'h':
+                    case 'i':
+                    case 'j':
+                    case 'k':
+                    case 'l':
+                    case 'm':
+                    case 'n':
+                    case 'o':
+                    case 'p':
+                    case 'q':
+                    case 'r':
+                    case 's':
+                    case 't':
+                    case 'u':
+                    case 'v':
+                    case 'w':
+                    case 'x':
+                    case 'y':
+                    case 'z':
+                    case '{':
+                    case '|':
+                    case '}':
+                    case '~':
+                        {
+                            matchNot('"');
+                            break;
+                        }
+                    default:
+                        {
+                            break _loop184;
+                        }
+                }
+            } while (true);
+        }
+        match('"');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    protected final void mXDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = XDIGIT;
+        int _saveIndex;
+
+        switch (LA(1)) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                {
+                    matchRange('0', '9');
+                    break;
+                }
+            case 'a':
+            case 'b':
+            case 'c':
+            case 'd':
+            case 'e':
+            case 'f':
+                {
+                    matchRange('a', 'f');
+                    break;
+                }
+            case 'A':
+            case 'B':
+            case 'C':
+            case 'D':
+            case 'E':
+            case 'F':
+                {
+                    matchRange('A', 'F');
+                    break;
+                }
+            default:
+                {
+                    throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                }
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = DIGIT;
+        int _saveIndex;
+
+        matchRange('0', '9');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    protected final void mVOCAB(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = VOCAB;
+        int _saveIndex;
+
+        matchRange('\3', '\176');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mINT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = INT;
+        int _saveIndex;
+
+        {
+            int _cnt199 = 0;
+            _loop199:
+            do {
+                if (((LA(1) >= '0' && LA(1) <= '9'))) {
+                    matchRange('0', '9');
+                } else {
+                    if (_cnt199 >= 1) {
+                        break _loop199;
+                    } else {
+                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                    }
+                }
+
+                _cnt199++;
+            } while (true);
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mARG_ACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = ARG_ACTION;
+        int _saveIndex;
+
+        mNESTED_ARG_ACTION(false);
+        if (inputState.guessing == 0) {
+            setText(Tool.stripFrontBack(getText(), "[", "]"));
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    protected final void mNESTED_ARG_ACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = NESTED_ARG_ACTION;
+        int _saveIndex;
+
+        match('[');
+        {
+            _loop203:
+            do {
+                switch (LA(1)) {
+                    case '[':
+                        {
+                            mNESTED_ARG_ACTION(false);
+                            break;
+                        }
+                    case '\n':
+                        {
+                            match('\n');
+                            if (inputState.guessing == 0) {
+                                newline();
+                            }
+                            break;
+                        }
+                    case '\'':
+                        {
+                            mCHAR_LITERAL(false);
+                            break;
+                        }
+                    case '"':
+                        {
+                            mSTRING_LITERAL(false);
+                            break;
+                        }
+                    case '\u0003':
+                    case '\u0004':
+                    case '\u0005':
+                    case '\u0006':
+                    case '\u0007':
+                    case '\u0008':
+                    case '\t':
+                    case '\u000b':
+                    case '\u000c':
+                    case '\u000e':
+                    case '\u000f':
+                    case '\u0010':
+                    case '\u0011':
+                    case '\u0012':
+                    case '\u0013':
+                    case '\u0014':
+                    case '\u0015':
+                    case '\u0016':
+                    case '\u0017':
+                    case '\u0018':
+                    case '\u0019':
+                    case '\u001a':
+                    case '\u001b':
+                    case '\u001c':
+                    case '\u001d':
+                    case '\u001e':
+                    case '\u001f':
+                    case ' ':
+                    case '!':
+                    case '#':
+                    case '$':
+                    case '%':
+                    case '&':
+                    case '(':
+                    case ')':
+                    case '*':
+                    case '+':
+                    case ',':
+                    case '-':
+                    case '.':
+                    case '/':
+                    case '0':
+                    case '1':
+                    case '2':
+                    case '3':
+                    case '4':
+                    case '5':
+                    case '6':
+                    case '7':
+                    case '8':
+                    case '9':
+                    case ':':
+                    case ';':
+                    case '<':
+                    case '=':
+                    case '>':
+                    case '?':
+                    case '@':
+                    case 'A':
+                    case 'B':
+                    case 'C':
+                    case 'D':
+                    case 'E':
+                    case 'F':
+                    case 'G':
+                    case 'H':
+                    case 'I':
+                    case 'J':
+                    case 'K':
+                    case 'L':
+                    case 'M':
+                    case 'N':
+                    case 'O':
+                    case 'P':
+                    case 'Q':
+                    case 'R':
+                    case 'S':
+                    case 'T':
+                    case 'U':
+                    case 'V':
+                    case 'W':
+                    case 'X':
+                    case 'Y':
+                    case 'Z':
+                    case '\\':
+                    case '^':
+                    case '_':
+                    case '`':
+                    case 'a':
+                    case 'b':
+                    case 'c':
+                    case 'd':
+                    case 'e':
+                    case 'f':
+                    case 'g':
+                    case 'h':
+                    case 'i':
+                    case 'j':
+                    case 'k':
+                    case 'l':
+                    case 'm':
+                    case 'n':
+                    case 'o':
+                    case 'p':
+                    case 'q':
+                    case 'r':
+                    case 's':
+                    case 't':
+                    case 'u':
+                    case 'v':
+                    case 'w':
+                    case 'x':
+                    case 'y':
+                    case 'z':
+                    case '{':
+                    case '|':
+                    case '}':
+                    case '~':
+                        {
+                            matchNot(']');
+                            break;
+                        }
+                    default:
+                        if ((LA(1) == '\r') && (LA(2) == '\n')) {
+                            match('\r');
+                            match('\n');
+                            if (inputState.guessing == 0) {
+                                newline();
+                            }
+                        } else if ((LA(1) == '\r') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
+                            match('\r');
+                            if (inputState.guessing == 0) {
+                                newline();
+                            }
+                        } else {
+                            break _loop203;
+                        }
+                }
+            } while (true);
+        }
+        match(']');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = ACTION;
+        int _saveIndex;
+        int actionLine = getLine();
+
+        mNESTED_ACTION(false);
+        {
+            if ((LA(1) == '?')) {
+                match('?');
+                if (inputState.guessing == 0) {
+                    _ttype = SEMPRED;
+                }
+            } else {
+            }
+
+        }
+        if (inputState.guessing == 0) {
+
+            if (_ttype == ACTION) {
+                setText(Tool.stripFrontBack(getText(), "{", "}"));
+            } else {
+                setText(Tool.stripFrontBack(getText(), "{", "}?"));
+            }
+            CommonToken t = new CommonToken(_ttype, new String(text.getBuffer(), _begin, text.length() - _begin));
+            t.setLine(actionLine);	// set action line to start
+            _token = t;
+
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    protected final void mNESTED_ACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = NESTED_ACTION;
+        int _saveIndex;
+
+        match('{');
+        {
+            _loop209:
+            do {
+                // nongreedy exit test
+                if ((LA(1) == '}') && (true)) break _loop209;
+                if ((LA(1) == '\n' || LA(1) == '\r') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
+                    {
+                        if ((LA(1) == '\r') && (LA(2) == '\n')) {
+                            match('\r');
+                            match('\n');
+                            if (inputState.guessing == 0) {
+                                newline();
+                            }
+                        } else if ((LA(1) == '\r') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
+                            match('\r');
+                            if (inputState.guessing == 0) {
+                                newline();
+                            }
+                        } else if ((LA(1) == '\n')) {
+                            match('\n');
+                            if (inputState.guessing == 0) {
+                                newline();
+                            }
+                        } else {
+                            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                        }
+
+                    }
+                } else if ((LA(1) == '{') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
+                    mNESTED_ACTION(false);
+                } else if ((LA(1) == '\'') && (_tokenSet_1.member(LA(2)))) {
+                    mCHAR_LITERAL(false);
+                } else if ((LA(1) == '/') && (LA(2) == '*' || LA(2) == '/')) {
+                    mCOMMENT(false);
+                } else if ((LA(1) == '"') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
+                    mSTRING_LITERAL(false);
+                } else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
+                    matchNot(EOF_CHAR);
+                } else {
+                    break _loop209;
+                }
+
+            } while (true);
+        }
+        match('}');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mTOKEN_REF(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = TOKEN_REF;
+        int _saveIndex;
+
+        matchRange('A', 'Z');
+        {
+            _loop212:
+            do {
+                switch (LA(1)) {
+                    case 'a':
+                    case 'b':
+                    case 'c':
+                    case 'd':
+                    case 'e':
+                    case 'f':
+                    case 'g':
+                    case 'h':
+                    case 'i':
+                    case 'j':
+                    case 'k':
+                    case 'l':
+                    case 'm':
+                    case 'n':
+                    case 'o':
+                    case 'p':
+                    case 'q':
+                    case 'r':
+                    case 's':
+                    case 't':
+                    case 'u':
+                    case 'v':
+                    case 'w':
+                    case 'x':
+                    case 'y':
+                    case 'z':
+                        {
+                            matchRange('a', 'z');
+                            break;
+                        }
+                    case 'A':
+                    case 'B':
+                    case 'C':
+                    case 'D':
+                    case 'E':
+                    case 'F':
+                    case 'G':
+                    case 'H':
+                    case 'I':
+                    case 'J':
+                    case 'K':
+                    case 'L':
+                    case 'M':
+                    case 'N':
+                    case 'O':
+                    case 'P':
+                    case 'Q':
+                    case 'R':
+                    case 'S':
+                    case 'T':
+                    case 'U':
+                    case 'V':
+                    case 'W':
+                    case 'X':
+                    case 'Y':
+                    case 'Z':
+                        {
+                            matchRange('A', 'Z');
+                            break;
+                        }
+                    case '_':
+                        {
+                            match('_');
+                            break;
+                        }
+                    case '0':
+                    case '1':
+                    case '2':
+                    case '3':
+                    case '4':
+                    case '5':
+                    case '6':
+                    case '7':
+                    case '8':
+                    case '9':
+                        {
+                            matchRange('0', '9');
+                            break;
+                        }
+                    default:
+                        {
+                            break _loop212;
+                        }
+                }
+            } while (true);
+        }
+        _ttype = testLiteralsTable(_ttype);
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mRULE_REF(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = RULE_REF;
+        int _saveIndex;
+
+        int t = 0;
+
+
+        t = mINTERNAL_RULE_REF(false);
+        if (inputState.guessing == 0) {
+            _ttype = t;
+        }
+        {
+            if (true && (t == LITERAL_options)) {
+                mWS_LOOP(false);
+                {
+                    if ((LA(1) == '{')) {
+                        match('{');
+                        if (inputState.guessing == 0) {
+                            _ttype = OPTIONS;
+                        }
+                    } else {
+                    }
+
+                }
+            } else if (true && (t == LITERAL_tokens)) {
+                mWS_LOOP(false);
+                {
+                    if ((LA(1) == '{')) {
+                        match('{');
+                        if (inputState.guessing == 0) {
+                            _ttype = TOKENS;
+                        }
+                    } else {
+                    }
+
+                }
+            } else {
+            }
+
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    protected final int mINTERNAL_RULE_REF(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int t;
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = INTERNAL_RULE_REF;
+        int _saveIndex;
+
+        t = RULE_REF;
+
+
+        matchRange('a', 'z');
+        {
+            _loop222:
+            do {
+                switch (LA(1)) {
+                    case 'a':
+                    case 'b':
+                    case 'c':
+                    case 'd':
+                    case 'e':
+                    case 'f':
+                    case 'g':
+                    case 'h':
+                    case 'i':
+                    case 'j':
+                    case 'k':
+                    case 'l':
+                    case 'm':
+                    case 'n':
+                    case 'o':
+                    case 'p':
+                    case 'q':
+                    case 'r':
+                    case 's':
+                    case 't':
+                    case 'u':
+                    case 'v':
+                    case 'w':
+                    case 'x':
+                    case 'y':
+                    case 'z':
+                        {
+                            matchRange('a', 'z');
+                            break;
+                        }
+                    case 'A':
+                    case 'B':
+                    case 'C':
+                    case 'D':
+                    case 'E':
+                    case 'F':
+                    case 'G':
+                    case 'H':
+                    case 'I':
+                    case 'J':
+                    case 'K':
+                    case 'L':
+                    case 'M':
+                    case 'N':
+                    case 'O':
+                    case 'P':
+                    case 'Q':
+                    case 'R':
+                    case 'S':
+                    case 'T':
+                    case 'U':
+                    case 'V':
+                    case 'W':
+                    case 'X':
+                    case 'Y':
+                    case 'Z':
+                        {
+                            matchRange('A', 'Z');
+                            break;
+                        }
+                    case '_':
+                        {
+                            match('_');
+                            break;
+                        }
+                    case '0':
+                    case '1':
+                    case '2':
+                    case '3':
+                    case '4':
+                    case '5':
+                    case '6':
+                    case '7':
+                    case '8':
+                    case '9':
+                        {
+                            matchRange('0', '9');
+                            break;
+                        }
+                    default:
+                        {
+                            break _loop222;
+                        }
+                }
+            } while (true);
+        }
+        if (inputState.guessing == 0) {
+            t = testLiteralsTable(t);
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+        return t;
+    }
+
+    protected final void mWS_LOOP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = WS_LOOP;
+        int _saveIndex;
+
+        {
+            _loop219:
+            do {
+                switch (LA(1)) {
+                    case '\t':
+                    case '\n':
+                    case '\r':
+                    case ' ':
+                        {
+                            mWS(false);
+                            break;
+                        }
+                    case '/':
+                        {
+                            mCOMMENT(false);
+                            break;
+                        }
+                    default:
+                        {
+                            break _loop219;
+                        }
+                }
+            } while (true);
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    protected final void mWS_OPT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = WS_OPT;
+        int _saveIndex;
+
+        {
+            if ((_tokenSet_2.member(LA(1)))) {
+                mWS(false);
+            } else {
+            }
+
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    protected final void mNOT_USEFUL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = NOT_USEFUL;
+        int _saveIndex;
+
+        boolean synPredMatched227 = false;
+        if (((LA(1) == 'a') && (true))) {
+            int _m227 = mark();
+            synPredMatched227 = true;
+            inputState.guessing++;
+            try {
+                {
+                    match('a');
+                }
+            } catch (RecognitionException pe) {
+                synPredMatched227 = false;
+            }
+            rewind(_m227);
+            inputState.guessing--;
+        }
+        if (synPredMatched227) {
+            match('a');
+        } else if ((LA(1) == 'a') && (true)) {
+            match('a');
+        } else {
+            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+        }
+
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+
+    private static final long _tokenSet_0_data_[] = { -9224L, 9223372036854775807L, 0L, 0L };
+
+    public static final BitSet _tokenSet_0 = new BitSet(_tokenSet_0_data_);
 
-public Token nextToken() throws TokenStreamException {
-	Token theRetToken=null;
-tryAgain:
-	for (;;) {
-		Token _token = null;
-		int _ttype = Token.INVALID_TYPE;
-		resetText();
-		try {   // for char stream error handling
-			try {   // for lexical error handling
-				switch ( LA(1)) {
-				case '\t':  case '\n':  case '\r':  case ' ':
-				{
-					mWS(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '/':
-				{
-					mCOMMENT(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '<':
-				{
-					mOPEN_ELEMENT_OPTION(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '>':
-				{
-					mCLOSE_ELEMENT_OPTION(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case ',':
-				{
-					mCOMMA(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '?':
-				{
-					mQUESTION(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '#':
-				{
-					mTREE_BEGIN(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '(':
-				{
-					mLPAREN(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case ')':
-				{
-					mRPAREN(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case ':':
-				{
-					mCOLON(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '*':
-				{
-					mSTAR(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '+':
-				{
-					mPLUS(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case ';':
-				{
-					mSEMI(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '^':
-				{
-					mCARET(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '!':
-				{
-					mBANG(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '|':
-				{
-					mOR(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '~':
-				{
-					mNOT_OP(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '}':
-				{
-					mRCURLY(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '\'':
-				{
-					mCHAR_LITERAL(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '"':
-				{
-					mSTRING_LITERAL(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '0':  case '1':  case '2':  case '3':
-				case '4':  case '5':  case '6':  case '7':
-				case '8':  case '9':
-				{
-					mINT(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '[':
-				{
-					mARG_ACTION(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case '{':
-				{
-					mACTION(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case 'A':  case 'B':  case 'C':  case 'D':
-				case 'E':  case 'F':  case 'G':  case 'H':
-				case 'I':  case 'J':  case 'K':  case 'L':
-				case 'M':  case 'N':  case 'O':  case 'P':
-				case 'Q':  case 'R':  case 'S':  case 'T':
-				case 'U':  case 'V':  case 'W':  case 'X':
-				case 'Y':  case 'Z':
-				{
-					mTOKEN_REF(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				case 'a':  case 'b':  case 'c':  case 'd':
-				case 'e':  case 'f':  case 'g':  case 'h':
-				case 'i':  case 'j':  case 'k':  case 'l':
-				case 'm':  case 'n':  case 'o':  case 'p':
-				case 'q':  case 'r':  case 's':  case 't':
-				case 'u':  case 'v':  case 'w':  case 'x':
-				case 'y':  case 'z':
-				{
-					mRULE_REF(true);
-					theRetToken=_returnToken;
-					break;
-				}
-				default:
-					if ((LA(1)=='=') && (LA(2)=='>')) {
-						mIMPLIES(true);
-						theRetToken=_returnToken;
-					}
-					else if ((LA(1)=='.') && (LA(2)=='.')) {
-						mRANGE(true);
-						theRetToken=_returnToken;
-					}
-					else if ((LA(1)=='=') && (true)) {
-						mASSIGN(true);
-						theRetToken=_returnToken;
-					}
-					else if ((LA(1)=='.') && (true)) {
-						mWILDCARD(true);
-						theRetToken=_returnToken;
-					}
-				else {
-					if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
-				else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());}
-				}
-				}
-				if ( _returnToken==null ) continue tryAgain; // found SKIP token
-				_ttype = _returnToken.getType();
-				_returnToken.setType(_ttype);
-				return _returnToken;
-			}
-			catch (RecognitionException e) {
-				throw new TokenStreamRecognitionException(e);
-			}
-		}
-		catch (CharStreamException cse) {
-			if ( cse instanceof CharStreamIOException ) {
-				throw new TokenStreamIOException(((CharStreamIOException)cse).io);
-			}
-			else {
-				throw new TokenStreamException(cse.getMessage());
-			}
-		}
-	}
-}
+    private static final long _tokenSet_1_data_[] = { -549755813896L, 9223372036854775807L, 0L, 0L };
+
+    public static final BitSet _tokenSet_1 = new BitSet(_tokenSet_1_data_);
 
-	public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = WS;
-		int _saveIndex;
-
-		{
-		switch ( LA(1)) {
-		case ' ':
-		{
-			match(' ');
-			break;
-		}
-		case '\t':
-		{
-			match('\t');
-			break;
-		}
-		case '\n':
-		{
-			match('\n');
-			if ( inputState.guessing==0 ) {
-				newline();
-			}
-			break;
-		}
-		default:
-			if ((LA(1)=='\r') && (LA(2)=='\n')) {
-				match('\r');
-				match('\n');
-				if ( inputState.guessing==0 ) {
-					newline();
-				}
-			}
-			else if ((LA(1)=='\r') && (true)) {
-				match('\r');
-				if ( inputState.guessing==0 ) {
-					newline();
-				}
-			}
-		else {
-			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-		}
-		}
-		}
-		if ( inputState.guessing==0 ) {
-			_ttype = Token.SKIP;
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mCOMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = COMMENT;
-		int _saveIndex;
-		Token t=null;
-
-		{
-		if ((LA(1)=='/') && (LA(2)=='/')) {
-			mSL_COMMENT(false);
-		}
-		else if ((LA(1)=='/') && (LA(2)=='*')) {
-			mML_COMMENT(true);
-			t=_returnToken;
-			if ( inputState.guessing==0 ) {
-				_ttype = t.getType();
-			}
-		}
-		else {
-			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-		}
-
-		}
-		if ( inputState.guessing==0 ) {
-			if ( _ttype != DOC_COMMENT ) _ttype = Token.SKIP;
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	protected final void mSL_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = SL_COMMENT;
-		int _saveIndex;
-
-		match("//");
-		{
-		_loop153:
-		do {
-			if ((_tokenSet_0.member(LA(1)))) {
-				{
-				match(_tokenSet_0);
-				}
-			}
-			else {
-				break _loop153;
-			}
-
-		} while (true);
-		}
-		{
-		if ((LA(1)=='\r') && (LA(2)=='\n')) {
-			match('\r');
-			match('\n');
-		}
-		else if ((LA(1)=='\r') && (true)) {
-			match('\r');
-		}
-		else if ((LA(1)=='\n')) {
-			match('\n');
-		}
-		else {
-			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-		}
-
-		}
-		if ( inputState.guessing==0 ) {
-			newline();
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	protected final void mML_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = ML_COMMENT;
-		int _saveIndex;
-
-		match("/*");
-		{
-		if (((LA(1)=='*') && ((LA(2) >= '\u0003' && LA(2) <= '~')))&&( LA(2)!='/' )) {
-			match('*');
-			if ( inputState.guessing==0 ) {
-				_ttype = DOC_COMMENT;
-			}
-		}
-		else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
-		}
-		else {
-			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-		}
-
-		}
-		{
-		_loop159:
-		do {
-			// nongreedy exit test
-			if ((LA(1)=='*') && (LA(2)=='/')) break _loop159;
-			if ((LA(1)=='\r') && (LA(2)=='\n')) {
-				match('\r');
-				match('\n');
-				if ( inputState.guessing==0 ) {
-					newline();
-				}
-			}
-			else if ((LA(1)=='\r') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
-				match('\r');
-				if ( inputState.guessing==0 ) {
-					newline();
-				}
-			}
-			else if ((_tokenSet_0.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
-				{
-				match(_tokenSet_0);
-				}
-			}
-			else if ((LA(1)=='\n')) {
-				match('\n');
-				if ( inputState.guessing==0 ) {
-					newline();
-				}
-			}
-			else {
-				break _loop159;
-			}
-
-		} while (true);
-		}
-		match("*/");
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mOPEN_ELEMENT_OPTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = OPEN_ELEMENT_OPTION;
-		int _saveIndex;
-
-		match('<');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mCLOSE_ELEMENT_OPTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = CLOSE_ELEMENT_OPTION;
-		int _saveIndex;
-
-		match('>');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = COMMA;
-		int _saveIndex;
-
-		match(',');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mQUESTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = QUESTION;
-		int _saveIndex;
-
-		match('?');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mTREE_BEGIN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = TREE_BEGIN;
-		int _saveIndex;
-
-		match("#(");
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mLPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = LPAREN;
-		int _saveIndex;
-
-		match('(');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mRPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = RPAREN;
-		int _saveIndex;
-
-		match(')');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mCOLON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = COLON;
-		int _saveIndex;
-
-		match(':');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mSTAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = STAR;
-		int _saveIndex;
-
-		match('*');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mPLUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = PLUS;
-		int _saveIndex;
-
-		match('+');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = ASSIGN;
-		int _saveIndex;
-
-		match('=');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mIMPLIES(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = IMPLIES;
-		int _saveIndex;
-
-		match("=>");
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mSEMI(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = SEMI;
-		int _saveIndex;
-
-		match(';');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mCARET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = CARET;
-		int _saveIndex;
-
-		match('^');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mBANG(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = BANG;
-		int _saveIndex;
-
-		match('!');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = OR;
-		int _saveIndex;
-
-		match('|');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mWILDCARD(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = WILDCARD;
-		int _saveIndex;
-
-		match('.');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mRANGE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = RANGE;
-		int _saveIndex;
-
-		match("..");
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mNOT_OP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = NOT_OP;
-		int _saveIndex;
-
-		match('~');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mRCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = RCURLY;
-		int _saveIndex;
-
-		match('}');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mCHAR_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = CHAR_LITERAL;
-		int _saveIndex;
-
-		match('\'');
-		{
-		switch ( LA(1)) {
-		case '\\':
-		{
-			mESC(false);
-			break;
-		}
-		case '\u0003':  case '\u0004':  case '\u0005':  case '\u0006':
-		case '\u0007':  case '\u0008':  case '\t':  case '\n':
-		case '\u000b':  case '\u000c':  case '\r':  case '\u000e':
-		case '\u000f':  case '\u0010':  case '\u0011':  case '\u0012':
-		case '\u0013':  case '\u0014':  case '\u0015':  case '\u0016':
-		case '\u0017':  case '\u0018':  case '\u0019':  case '\u001a':
-		case '\u001b':  case '\u001c':  case '\u001d':  case '\u001e':
-		case '\u001f':  case ' ':  case '!':  case '"':
-		case '#':  case '$':  case '%':  case '&':
-		case '(':  case ')':  case '*':  case '+':
-		case ',':  case '-':  case '.':  case '/':
-		case '0':  case '1':  case '2':  case '3':
-		case '4':  case '5':  case '6':  case '7':
-		case '8':  case '9':  case ':':  case ';':
-		case '<':  case '=':  case '>':  case '?':
-		case '@':  case 'A':  case 'B':  case 'C':
-		case 'D':  case 'E':  case 'F':  case 'G':
-		case 'H':  case 'I':  case 'J':  case 'K':
-		case 'L':  case 'M':  case 'N':  case 'O':
-		case 'P':  case 'Q':  case 'R':  case 'S':
-		case 'T':  case 'U':  case 'V':  case 'W':
-		case 'X':  case 'Y':  case 'Z':  case '[':
-		case ']':  case '^':  case '_':  case '`':
-		case 'a':  case 'b':  case 'c':  case 'd':
-		case 'e':  case 'f':  case 'g':  case 'h':
-		case 'i':  case 'j':  case 'k':  case 'l':
-		case 'm':  case 'n':  case 'o':  case 'p':
-		case 'q':  case 'r':  case 's':  case 't':
-		case 'u':  case 'v':  case 'w':  case 'x':
-		case 'y':  case 'z':  case '{':  case '|':
-		case '}':  case '~':
-		{
-			matchNot('\'');
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-		}
-		}
-		}
-		match('\'');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	protected final void mESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = ESC;
-		int _saveIndex;
-
-		match('\\');
-		{
-		switch ( LA(1)) {
-		case 'n':
-		{
-			match('n');
-			break;
-		}
-		case 'r':
-		{
-			match('r');
-			break;
-		}
-		case 't':
-		{
-			match('t');
-			break;
-		}
-		case 'b':
-		{
-			match('b');
-			break;
-		}
-		case 'f':
-		{
-			match('f');
-			break;
-		}
-		case 'w':
-		{
-			match('w');
-			break;
-		}
-		case 'a':
-		{
-			match('a');
-			break;
-		}
-		case '"':
-		{
-			match('"');
-			break;
-		}
-		case '\'':
-		{
-			match('\'');
-			break;
-		}
-		case '\\':
-		{
-			match('\\');
-			break;
-		}
-		case '0':  case '1':  case '2':  case '3':
-		{
-			{
-			matchRange('0','3');
-			}
-			{
-			if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
-				{
-				matchRange('0','9');
-				}
-				{
-				if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
-					matchRange('0','9');
-				}
-				else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && (true)) {
-				}
-				else {
-					throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-				}
-
-				}
-			}
-			else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && (true)) {
-			}
-			else {
-				throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-			}
-
-			}
-			break;
-		}
-		case '4':  case '5':  case '6':  case '7':
-		{
-			{
-			matchRange('4','7');
-			}
-			{
-			if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
-				{
-				matchRange('0','9');
-				}
-			}
-			else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && (true)) {
-			}
-			else {
-				throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-			}
-
-			}
-			break;
-		}
-		case 'u':
-		{
-			match('u');
-			mXDIGIT(false);
-			mXDIGIT(false);
-			mXDIGIT(false);
-			mXDIGIT(false);
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-		}
-		}
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mSTRING_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = STRING_LITERAL;
-		int _saveIndex;
-
-		match('"');
-		{
-		_loop184:
-		do {
-			switch ( LA(1)) {
-			case '\\':
-			{
-				mESC(false);
-				break;
-			}
-			case '\u0003':  case '\u0004':  case '\u0005':  case '\u0006':
-			case '\u0007':  case '\u0008':  case '\t':  case '\n':
-			case '\u000b':  case '\u000c':  case '\r':  case '\u000e':
-			case '\u000f':  case '\u0010':  case '\u0011':  case '\u0012':
-			case '\u0013':  case '\u0014':  case '\u0015':  case '\u0016':
-			case '\u0017':  case '\u0018':  case '\u0019':  case '\u001a':
-			case '\u001b':  case '\u001c':  case '\u001d':  case '\u001e':
-			case '\u001f':  case ' ':  case '!':  case '#':
-			case '$':  case '%':  case '&':  case '\'':
-			case '(':  case ')':  case '*':  case '+':
-			case ',':  case '-':  case '.':  case '/':
-			case '0':  case '1':  case '2':  case '3':
-			case '4':  case '5':  case '6':  case '7':
-			case '8':  case '9':  case ':':  case ';':
-			case '<':  case '=':  case '>':  case '?':
-			case '@':  case 'A':  case 'B':  case 'C':
-			case 'D':  case 'E':  case 'F':  case 'G':
-			case 'H':  case 'I':  case 'J':  case 'K':
-			case 'L':  case 'M':  case 'N':  case 'O':
-			case 'P':  case 'Q':  case 'R':  case 'S':
-			case 'T':  case 'U':  case 'V':  case 'W':
-			case 'X':  case 'Y':  case 'Z':  case '[':
-			case ']':  case '^':  case '_':  case '`':
-			case 'a':  case 'b':  case 'c':  case 'd':
-			case 'e':  case 'f':  case 'g':  case 'h':
-			case 'i':  case 'j':  case 'k':  case 'l':
-			case 'm':  case 'n':  case 'o':  case 'p':
-			case 'q':  case 'r':  case 's':  case 't':
-			case 'u':  case 'v':  case 'w':  case 'x':
-			case 'y':  case 'z':  case '{':  case '|':
-			case '}':  case '~':
-			{
-				matchNot('"');
-				break;
-			}
-			default:
-			{
-				break _loop184;
-			}
-			}
-		} while (true);
-		}
-		match('"');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	protected final void mXDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = XDIGIT;
-		int _saveIndex;
-
-		switch ( LA(1)) {
-		case '0':  case '1':  case '2':  case '3':
-		case '4':  case '5':  case '6':  case '7':
-		case '8':  case '9':
-		{
-			matchRange('0','9');
-			break;
-		}
-		case 'a':  case 'b':  case 'c':  case 'd':
-		case 'e':  case 'f':
-		{
-			matchRange('a','f');
-			break;
-		}
-		case 'A':  case 'B':  case 'C':  case 'D':
-		case 'E':  case 'F':
-		{
-			matchRange('A','F');
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-		}
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = DIGIT;
-		int _saveIndex;
-
-		matchRange('0','9');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	protected final void mVOCAB(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = VOCAB;
-		int _saveIndex;
-
-		matchRange('\3','\176');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mINT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = INT;
-		int _saveIndex;
-
-		{
-		int _cnt199=0;
-		_loop199:
-		do {
-			if (((LA(1) >= '0' && LA(1) <= '9'))) {
-				matchRange('0','9');
-			}
-			else {
-				if ( _cnt199>=1 ) { break _loop199; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());}
-			}
-
-			_cnt199++;
-		} while (true);
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mARG_ACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = ARG_ACTION;
-		int _saveIndex;
-
-		mNESTED_ARG_ACTION(false);
-		if ( inputState.guessing==0 ) {
-			setText(Tool.stripFrontBack(getText(), "[", "]"));
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	protected final void mNESTED_ARG_ACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = NESTED_ARG_ACTION;
-		int _saveIndex;
-
-		match('[');
-		{
-		_loop203:
-		do {
-			switch ( LA(1)) {
-			case '[':
-			{
-				mNESTED_ARG_ACTION(false);
-				break;
-			}
-			case '\n':
-			{
-				match('\n');
-				if ( inputState.guessing==0 ) {
-					newline();
-				}
-				break;
-			}
-			case '\'':
-			{
-				mCHAR_LITERAL(false);
-				break;
-			}
-			case '"':
-			{
-				mSTRING_LITERAL(false);
-				break;
-			}
-			case '\u0003':  case '\u0004':  case '\u0005':  case '\u0006':
-			case '\u0007':  case '\u0008':  case '\t':  case '\u000b':
-			case '\u000c':  case '\u000e':  case '\u000f':  case '\u0010':
-			case '\u0011':  case '\u0012':  case '\u0013':  case '\u0014':
-			case '\u0015':  case '\u0016':  case '\u0017':  case '\u0018':
-			case '\u0019':  case '\u001a':  case '\u001b':  case '\u001c':
-			case '\u001d':  case '\u001e':  case '\u001f':  case ' ':
-			case '!':  case '#':  case '$':  case '%':
-			case '&':  case '(':  case ')':  case '*':
-			case '+':  case ',':  case '-':  case '.':
-			case '/':  case '0':  case '1':  case '2':
-			case '3':  case '4':  case '5':  case '6':
-			case '7':  case '8':  case '9':  case ':':
-			case ';':  case '<':  case '=':  case '>':
-			case '?':  case '@':  case 'A':  case 'B':
-			case 'C':  case 'D':  case 'E':  case 'F':
-			case 'G':  case 'H':  case 'I':  case 'J':
-			case 'K':  case 'L':  case 'M':  case 'N':
-			case 'O':  case 'P':  case 'Q':  case 'R':
-			case 'S':  case 'T':  case 'U':  case 'V':
-			case 'W':  case 'X':  case 'Y':  case 'Z':
-			case '\\':  case '^':  case '_':  case '`':
-			case 'a':  case 'b':  case 'c':  case 'd':
-			case 'e':  case 'f':  case 'g':  case 'h':
-			case 'i':  case 'j':  case 'k':  case 'l':
-			case 'm':  case 'n':  case 'o':  case 'p':
-			case 'q':  case 'r':  case 's':  case 't':
-			case 'u':  case 'v':  case 'w':  case 'x':
-			case 'y':  case 'z':  case '{':  case '|':
-			case '}':  case '~':
-			{
-				matchNot(']');
-				break;
-			}
-			default:
-				if ((LA(1)=='\r') && (LA(2)=='\n')) {
-					match('\r');
-					match('\n');
-					if ( inputState.guessing==0 ) {
-						newline();
-					}
-				}
-				else if ((LA(1)=='\r') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
-					match('\r');
-					if ( inputState.guessing==0 ) {
-						newline();
-					}
-				}
-			else {
-				break _loop203;
-			}
-			}
-		} while (true);
-		}
-		match(']');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = ACTION;
-		int _saveIndex;
-		int actionLine=getLine();
-
-		mNESTED_ACTION(false);
-		{
-		if ((LA(1)=='?')) {
-			match('?');
-			if ( inputState.guessing==0 ) {
-				_ttype = SEMPRED;
-			}
-		}
-		else {
-		}
-
-		}
-		if ( inputState.guessing==0 ) {
-
-						if ( _ttype==ACTION ) {
-							setText(Tool.stripFrontBack(getText(), "{", "}"));
-						}
-						else {
-							setText(Tool.stripFrontBack(getText(), "{", "}?"));
-						}
-						CommonToken t = new CommonToken(_ttype,new String(text.getBuffer(),_begin,text.length()-_begin));
-						t.setLine(actionLine);	// set action line to start
-						_token = t;
-
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	protected final void mNESTED_ACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = NESTED_ACTION;
-		int _saveIndex;
-
-		match('{');
-		{
-		_loop209:
-		do {
-			// nongreedy exit test
-			if ((LA(1)=='}') && (true)) break _loop209;
-			if ((LA(1)=='\n'||LA(1)=='\r') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
-				{
-				if ((LA(1)=='\r') && (LA(2)=='\n')) {
-					match('\r');
-					match('\n');
-					if ( inputState.guessing==0 ) {
-						newline();
-					}
-				}
-				else if ((LA(1)=='\r') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
-					match('\r');
-					if ( inputState.guessing==0 ) {
-						newline();
-					}
-				}
-				else if ((LA(1)=='\n')) {
-					match('\n');
-					if ( inputState.guessing==0 ) {
-						newline();
-					}
-				}
-				else {
-					throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-				}
-
-				}
-			}
-			else if ((LA(1)=='{') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
-				mNESTED_ACTION(false);
-			}
-			else if ((LA(1)=='\'') && (_tokenSet_1.member(LA(2)))) {
-				mCHAR_LITERAL(false);
-			}
-			else if ((LA(1)=='/') && (LA(2)=='*'||LA(2)=='/')) {
-				mCOMMENT(false);
-			}
-			else if ((LA(1)=='"') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
-				mSTRING_LITERAL(false);
-			}
-			else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
-				matchNot(EOF_CHAR);
-			}
-			else {
-				break _loop209;
-			}
-
-		} while (true);
-		}
-		match('}');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mTOKEN_REF(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = TOKEN_REF;
-		int _saveIndex;
-
-		matchRange('A','Z');
-		{
-		_loop212:
-		do {
-			switch ( LA(1)) {
-			case 'a':  case 'b':  case 'c':  case 'd':
-			case 'e':  case 'f':  case 'g':  case 'h':
-			case 'i':  case 'j':  case 'k':  case 'l':
-			case 'm':  case 'n':  case 'o':  case 'p':
-			case 'q':  case 'r':  case 's':  case 't':
-			case 'u':  case 'v':  case 'w':  case 'x':
-			case 'y':  case 'z':
-			{
-				matchRange('a','z');
-				break;
-			}
-			case 'A':  case 'B':  case 'C':  case 'D':
-			case 'E':  case 'F':  case 'G':  case 'H':
-			case 'I':  case 'J':  case 'K':  case 'L':
-			case 'M':  case 'N':  case 'O':  case 'P':
-			case 'Q':  case 'R':  case 'S':  case 'T':
-			case 'U':  case 'V':  case 'W':  case 'X':
-			case 'Y':  case 'Z':
-			{
-				matchRange('A','Z');
-				break;
-			}
-			case '_':
-			{
-				match('_');
-				break;
-			}
-			case '0':  case '1':  case '2':  case '3':
-			case '4':  case '5':  case '6':  case '7':
-			case '8':  case '9':
-			{
-				matchRange('0','9');
-				break;
-			}
-			default:
-			{
-				break _loop212;
-			}
-			}
-		} while (true);
-		}
-		_ttype = testLiteralsTable(_ttype);
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	public final void mRULE_REF(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = RULE_REF;
-		int _saveIndex;
-
-			int t=0;
-
-
-		t=mINTERNAL_RULE_REF(false);
-		if ( inputState.guessing==0 ) {
-			_ttype=t;
-		}
-		{
-		if (true&&(t==LITERAL_options)) {
-			mWS_LOOP(false);
-			{
-			if ((LA(1)=='{')) {
-				match('{');
-				if ( inputState.guessing==0 ) {
-					_ttype = OPTIONS;
-				}
-			}
-			else {
-			}
-
-			}
-		}
-		else if (true&&(t==LITERAL_tokens)) {
-			mWS_LOOP(false);
-			{
-			if ((LA(1)=='{')) {
-				match('{');
-				if ( inputState.guessing==0 ) {
-					_ttype = TOKENS;
-				}
-			}
-			else {
-			}
-
-			}
-		}
-		else {
-		}
-
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	protected final int  mINTERNAL_RULE_REF(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int t;
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = INTERNAL_RULE_REF;
-		int _saveIndex;
-
-			t = RULE_REF;
-
-
-		matchRange('a','z');
-		{
-		_loop222:
-		do {
-			switch ( LA(1)) {
-			case 'a':  case 'b':  case 'c':  case 'd':
-			case 'e':  case 'f':  case 'g':  case 'h':
-			case 'i':  case 'j':  case 'k':  case 'l':
-			case 'm':  case 'n':  case 'o':  case 'p':
-			case 'q':  case 'r':  case 's':  case 't':
-			case 'u':  case 'v':  case 'w':  case 'x':
-			case 'y':  case 'z':
-			{
-				matchRange('a','z');
-				break;
-			}
-			case 'A':  case 'B':  case 'C':  case 'D':
-			case 'E':  case 'F':  case 'G':  case 'H':
-			case 'I':  case 'J':  case 'K':  case 'L':
-			case 'M':  case 'N':  case 'O':  case 'P':
-			case 'Q':  case 'R':  case 'S':  case 'T':
-			case 'U':  case 'V':  case 'W':  case 'X':
-			case 'Y':  case 'Z':
-			{
-				matchRange('A','Z');
-				break;
-			}
-			case '_':
-			{
-				match('_');
-				break;
-			}
-			case '0':  case '1':  case '2':  case '3':
-			case '4':  case '5':  case '6':  case '7':
-			case '8':  case '9':
-			{
-				matchRange('0','9');
-				break;
-			}
-			default:
-			{
-				break _loop222;
-			}
-			}
-		} while (true);
-		}
-		if ( inputState.guessing==0 ) {
-			t = testLiteralsTable(t);
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-		return t;
-	}
-
-	protected final void mWS_LOOP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = WS_LOOP;
-		int _saveIndex;
-
-		{
-		_loop219:
-		do {
-			switch ( LA(1)) {
-			case '\t':  case '\n':  case '\r':  case ' ':
-			{
-				mWS(false);
-				break;
-			}
-			case '/':
-			{
-				mCOMMENT(false);
-				break;
-			}
-			default:
-			{
-				break _loop219;
-			}
-			}
-		} while (true);
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	protected final void mWS_OPT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = WS_OPT;
-		int _saveIndex;
-
-		{
-		if ((_tokenSet_2.member(LA(1)))) {
-			mWS(false);
-		}
-		else {
-		}
-
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-	protected final void mNOT_USEFUL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = NOT_USEFUL;
-		int _saveIndex;
-
-		boolean synPredMatched227 = false;
-		if (((LA(1)=='a') && (true))) {
-			int _m227 = mark();
-			synPredMatched227 = true;
-			inputState.guessing++;
-			try {
-				{
-				match('a');
-				}
-			}
-			catch (RecognitionException pe) {
-				synPredMatched227 = false;
-			}
-			rewind(_m227);
-			inputState.guessing--;
-		}
-		if ( synPredMatched227 ) {
-			match('a');
-		}
-		else if ((LA(1)=='a') && (true)) {
-			match('a');
-		}
-		else {
-			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-		}
-
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-
-
-	private static final long _tokenSet_0_data_[] = { -9224L, 9223372036854775807L, 0L, 0L };
-	public static final BitSet _tokenSet_0 = new BitSet(_tokenSet_0_data_);
-	private static final long _tokenSet_1_data_[] = { -549755813896L, 9223372036854775807L, 0L, 0L };
-	public static final BitSet _tokenSet_1 = new BitSet(_tokenSet_1_data_);
-	private static final long _tokenSet_2_data_[] = { 4294977024L, 0L, 0L };
-	public static final BitSet _tokenSet_2 = new BitSet(_tokenSet_2_data_);
+    private static final long _tokenSet_2_data_[] = { 4294977024L, 0L, 0L };
 
-	}
+    public static final BitSet _tokenSet_2 = new BitSet(_tokenSet_2_data_);
+
+}



1.5       +2898 -2890e/src/jsrc/antlr/ANTLRParser.java

Index: ANTLRParser.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ANTLRParser.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ANTLRParser.java	2001/11/29 20:33:25	1.4
+++ ANTLRParser.java	2001/12/02 06:01:28	1.5
@@ -5,2902 +5,2910 @@
 import antlr.collections.impl.BitSet;
 
 public class ANTLRParser extends antlr.LLkParser
-       implements ANTLRTokenTypes
- {
+  implements ANTLRTokenTypes {
 
-	private static final boolean DEBUG_PARSER = false;
+    private static final boolean DEBUG_PARSER = false;
 
-	ANTLRGrammarParseBehavior behavior;
-	Tool tool;
-	protected int blockNesting= -1;
-
-	public ANTLRParser(
-		TokenBuffer tokenBuf,
-		ANTLRGrammarParseBehavior behavior_,
-		Tool tool_
-	) {
-		super(tokenBuf, 1);
-		tokenNames = _tokenNames;
-		behavior = behavior_;
-		tool = tool_;
-	}
-
-	private boolean lastInRule() throws TokenStreamException {
-		if ( blockNesting==0 && (LA(1)==SEMI || LA(1)==LITERAL_exception || LA(1)==OR) ) {
-			return true;
-		}
-		return false;
-	}
-
-	private void checkForMissingEndRule(Token label) {
-		if ( label.getColumn()==1 ) {
-			Tool.warning("did you forget to terminate previous rule?", getFilename(), label.getLine());
-		}
-	}
-
-protected ANTLRParser(TokenBuffer tokenBuf, int k) {
-  super(tokenBuf,k);
-  tokenNames = _tokenNames;
-}
+    ANTLRGrammarParseBehavior behavior;
 
-public ANTLRParser(TokenBuffer tokenBuf) {
-  this(tokenBuf,2);
-}
+    Tool tool;
 
-protected ANTLRParser(TokenStream lexer, int k) {
-  super(lexer,k);
-  tokenNames = _tokenNames;
-}
+    protected int blockNesting = -1;
+
+    public ANTLRParser(
+      TokenBuffer tokenBuf,
+      ANTLRGrammarParseBehavior behavior_,
+      Tool tool_
+      ) {
+        super(tokenBuf, 1);
+        tokenNames = _tokenNames;
+        behavior = behavior_;
+        tool = tool_;
+    }
+
+    private boolean lastInRule() throws TokenStreamException {
+        if (blockNesting == 0 && (LA(1) == SEMI || LA(1) == LITERAL_exception || LA(1) == OR)) {
+            return true;
+        }
+        return false;
+    }
+
+    private void checkForMissingEndRule(Token label) {
+        if (label.getColumn() == 1) {
+            Tool.warning("did you forget to terminate previous rule?", getFilename(), label.getLine());
+        }
+    }
+
+    protected ANTLRParser(TokenBuffer tokenBuf, int k) {
+        super(tokenBuf, k);
+        tokenNames = _tokenNames;
+    }
+
+    public ANTLRParser(TokenBuffer tokenBuf) {
+        this(tokenBuf, 2);
+    }
+
+    protected ANTLRParser(TokenStream lexer, int k) {
+        super(lexer, k);
+        tokenNames = _tokenNames;
+    }
+
+    public ANTLRParser(TokenStream lexer) {
+        this(lexer, 2);
+    }
+
+    public ANTLRParser(ParserSharedInputState state) {
+        super(state, 2);
+        tokenNames = _tokenNames;
+    }
+
+    public final void grammar() throws RecognitionException, TokenStreamException {
+
+        Token n = null;
+        Token h = null;
+
+        try { // for error handling
+            {
+                _loop4:
+                do {
+                    if ((LA(1) == LITERAL_header)) {
+                        match(LITERAL_header);
+                        {
+                            switch (LA(1)) {
+                                case STRING_LITERAL:
+                                    {
+                                        n = LT(1);
+                                        match(STRING_LITERAL);
+                                        break;
+                                    }
+                                case ACTION:
+                                    {
+                                        break;
+                                    }
+                                default:
+                                    {
+                                        throw new NoViableAltException(LT(1), getFilename());
+                                    }
+                            }
+                        }
+                        h = LT(1);
+                        match(ACTION);
+                        if (inputState.guessing == 0) {
+                            behavior.refHeaderAction(n, h);
+                        }
+                    } else {
+                        break _loop4;
+                    }
+
+                } while (true);
+            }
+            {
+                switch (LA(1)) {
+                    case OPTIONS:
+                        {
+                            fileOptionsSpec();
+                            break;
+                        }
+                    case EOF:
+                    case ACTION:
+                    case DOC_COMMENT:
+                    case LITERAL_lexclass:
+                    case LITERAL_class:
+                        {
+                            break;
+                        }
+                    default:
+                        {
+                            throw new NoViableAltException(LT(1), getFilename());
+                        }
+                }
+            }
+            {
+                _loop7:
+                do {
+                    if (((LA(1) >= ACTION && LA(1) <= LITERAL_class))) {
+                        classDef();
+                    } else {
+                        break _loop7;
+                    }
+
+                } while (true);
+            }
+            match(Token.EOF_TYPE);
+        } catch (RecognitionException ex) {
+            if (inputState.guessing == 0) {
+
+                reportError("rule grammar trapped: " + ex.toString());
+                consumeUntil(EOF);
+
+            } else {
+                throw ex;
+            }
+        }
+    }
+
+    public final void fileOptionsSpec() throws RecognitionException, TokenStreamException {
+
+        Token idTok;
+        Token value;
+
+        match(OPTIONS);
+        {
+            _loop18:
+            do {
+                if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF)) {
+                    idTok = id();
+                    match(ASSIGN);
+                    value = optionValue();
+                    if (inputState.guessing == 0) {
+                        behavior.setFileOption(idTok, value, getInputState().filename);
+                    }
+                    match(SEMI);
+                } else {
+                    break _loop18;
+                }
+
+            } while (true);
+        }
+        match(RCURLY);
+    }
+
+    public final void classDef() throws RecognitionException, TokenStreamException {
+
+        Token a = null;
+        Token d = null;
+        String doc = null;
+
+        try { // for error handling
+            {
+                switch (LA(1)) {
+                    case ACTION:
+                        {
+                            a = LT(1);
+                            match(ACTION);
+                            if (inputState.guessing == 0) {
+                                behavior.refPreambleAction(a);
+                            }
+                            break;
+                        }
+                    case DOC_COMMENT:
+                    case LITERAL_lexclass:
+                    case LITERAL_class:
+                        {
+                            break;
+                        }
+                    default:
+                        {
+                            throw new NoViableAltException(LT(1), getFilename());
+                        }
+                }
+            }
+            {
+                switch (LA(1)) {
+                    case DOC_COMMENT:
+                        {
+                            d = LT(1);
+                            match(DOC_COMMENT);
+                            if (inputState.guessing == 0) {
+                                doc = d.getText();
+                            }
+                            break;
+                        }
+                    case LITERAL_lexclass:
+                    case LITERAL_class:
+                        {
+                            break;
+                        }
+                    default:
+                        {
+                            throw new NoViableAltException(LT(1), getFilename());
+                        }
+                }
+            }
+            {
+                boolean synPredMatched13 = false;
+                if (((LA(1) == LITERAL_lexclass || LA(1) == LITERAL_class) && (LA(2) == TOKEN_REF || LA(2) == RULE_REF))) {
+                    int _m13 = mark();
+                    synPredMatched13 = true;
+                    inputState.guessing++;
+                    try {
+                        {
+                            switch (LA(1)) {
+                                case LITERAL_lexclass:
+                                    {
+                                        match(LITERAL_lexclass);
+                                        break;
+                                    }
+                                case LITERAL_class:
+                                    {
+                                        match(LITERAL_class);
+                                        id();
+                                        match(LITERAL_extends);
+                                        match(LITERAL_Lexer);
+                                        break;
+                                    }
+                                default:
+                                    {
+                                        throw new NoViableAltException(LT(1), getFilename());
+                                    }
+                            }
+                        }
+                    } catch (RecognitionException pe) {
+                        synPredMatched13 = false;
+                    }
+                    rewind(_m13);
+                    inputState.guessing--;
+                }
+                if (synPredMatched13) {
+                    lexerSpec(doc);
+                } else {
+                    boolean synPredMatched15 = false;
+                    if (((LA(1) == LITERAL_class) && (LA(2) == TOKEN_REF || LA(2) == RULE_REF))) {
+                        int _m15 = mark();
+                        synPredMatched15 = true;
+                        inputState.guessing++;
+                        try {
+                            {
+                                match(LITERAL_class);
+                                id();
+                                match(LITERAL_extends);
+                                match(LITERAL_TreeParser);
+                            }
+                        } catch (RecognitionException pe) {
+                            synPredMatched15 = false;
+                        }
+                        rewind(_m15);
+                        inputState.guessing--;
+                    }
+                    if (synPredMatched15) {
+                        treeParserSpec(doc);
+                    } else if ((LA(1) == LITERAL_class) && (LA(2) == TOKEN_REF || LA(2) == RULE_REF)) {
+                        parserSpec(doc);
+                    } else {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+                }
+            }
+            rules();
+            if (inputState.guessing == 0) {
+                behavior.endGrammar();
+            }
+        } catch (RecognitionException ex) {
+            if (inputState.guessing == 0) {
+
+                if (ex instanceof NoViableAltException) {
+                    NoViableAltException e = (NoViableAltException)ex;
+                    if (e.token.getType() == DOC_COMMENT) {
+                        reportError("line " + ex.line + ": JAVADOC comments may only prefix rules and grammars");
+                    } else {
+                        reportError("rule classDef trapped: " + ex.toString());
+                    }
+                } else {
+                    reportError("rule classDef trapped: " + ex.toString());
+                }
+                behavior.abortGrammar();
+                boolean consuming = true;
+                // consume everything until the next class definition or EOF
+                while (consuming) {
+                    consume();
+                    switch (LA(1)) {
+                        case LITERAL_class:
+                        case LITERAL_lexclass:
+                        case EOF:
+                            consuming = false;
+                            break;
+                    }
+                }
+
+            } else {
+                throw ex;
+            }
+        }
+    }
+
+    public final Token id() throws RecognitionException, TokenStreamException {
+        Token idTok;
+
+        Token a = null;
+        Token b = null;
+        idTok = null;
+
+        switch (LA(1)) {
+            case TOKEN_REF:
+                {
+                    a = LT(1);
+                    match(TOKEN_REF);
+                    if (inputState.guessing == 0) {
+                        idTok = a;
+                    }
+                    break;
+                }
+            case RULE_REF:
+                {
+                    b = LT(1);
+                    match(RULE_REF);
+                    if (inputState.guessing == 0) {
+                        idTok = b;
+                    }
+                    break;
+                }
+            default:
+                {
+                    throw new NoViableAltException(LT(1), getFilename());
+                }
+        }
+        return idTok;
+    }
+
+    public final void lexerSpec(
+      String doc
+      ) throws RecognitionException, TokenStreamException {
+
+        Token lc = null;
+        Token a = null;
+
+        Token idTok;
+        String sup = null;
+
+
+        {
+            switch (LA(1)) {
+                case LITERAL_lexclass:
+                    {
+                        lc = LT(1);
+                        match(LITERAL_lexclass);
+                        idTok = id();
+                        if (inputState.guessing == 0) {
+                            System.out.println("warning: line " + lc.getLine() + ": 'lexclass' is deprecated; use 'class X extends Lexer'");
+                        }
+                        break;
+                    }
+                case LITERAL_class:
+                    {
+                        match(LITERAL_class);
+                        idTok = id();
+                        match(LITERAL_extends);
+                        match(LITERAL_Lexer);
+                        {
+                            switch (LA(1)) {
+                                case LPAREN:
+                                    {
+                                        sup = superClass();
+                                        break;
+                                    }
+                                case SEMI:
+                                    {
+                                        break;
+                                    }
+                                default:
+                                    {
+                                        throw new NoViableAltException(LT(1), getFilename());
+                                    }
+                            }
+                        }
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        if (inputState.guessing == 0) {
+            behavior.startLexer(getFilename(), idTok, sup, doc);
+        }
+        match(SEMI);
+        {
+            switch (LA(1)) {
+                case OPTIONS:
+                    {
+                        lexerOptionsSpec();
+                        break;
+                    }
+                case ACTION:
+                case DOC_COMMENT:
+                case TOKENS:
+                case TOKEN_REF:
+                case RULE_REF:
+                case LITERAL_protected:
+                case LITERAL_public:
+                case LITERAL_private:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        if (inputState.guessing == 0) {
+            behavior.endOptions();
+        }
+        {
+            switch (LA(1)) {
+                case TOKENS:
+                    {
+                        tokensSpec();
+                        break;
+                    }
+                case ACTION:
+                case DOC_COMMENT:
+                case TOKEN_REF:
+                case RULE_REF:
+                case LITERAL_protected:
+                case LITERAL_public:
+                case LITERAL_private:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        {
+            switch (LA(1)) {
+                case ACTION:
+                    {
+                        a = LT(1);
+                        match(ACTION);
+                        if (inputState.guessing == 0) {
+                            behavior.refMemberAction(a);
+                        }
+                        break;
+                    }
+                case DOC_COMMENT:
+                case TOKEN_REF:
+                case RULE_REF:
+                case LITERAL_protected:
+                case LITERAL_public:
+                case LITERAL_private:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+    }
+
+    public final void treeParserSpec(
+      String doc
+      ) throws RecognitionException, TokenStreamException {
+
+        Token a = null;
+
+        Token idTok;
+        String sup = null;
+
+
+        match(LITERAL_class);
+        idTok = id();
+        match(LITERAL_extends);
+        match(LITERAL_TreeParser);
+        {
+            switch (LA(1)) {
+                case LPAREN:
+                    {
+                        sup = superClass();
+                        break;
+                    }
+                case SEMI:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        if (inputState.guessing == 0) {
+            behavior.startTreeWalker(getFilename(), idTok, sup, doc);
+        }
+        match(SEMI);
+        {
+            switch (LA(1)) {
+                case OPTIONS:
+                    {
+                        treeParserOptionsSpec();
+                        break;
+                    }
+                case ACTION:
+                case DOC_COMMENT:
+                case TOKENS:
+                case TOKEN_REF:
+                case RULE_REF:
+                case LITERAL_protected:
+                case LITERAL_public:
+                case LITERAL_private:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        if (inputState.guessing == 0) {
+            behavior.endOptions();
+        }
+        {
+            switch (LA(1)) {
+                case TOKENS:
+                    {
+                        tokensSpec();
+                        break;
+                    }
+                case ACTION:
+                case DOC_COMMENT:
+                case TOKEN_REF:
+                case RULE_REF:
+                case LITERAL_protected:
+                case LITERAL_public:
+                case LITERAL_private:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        {
+            switch (LA(1)) {
+                case ACTION:
+                    {
+                        a = LT(1);
+                        match(ACTION);
+                        if (inputState.guessing == 0) {
+                            behavior.refMemberAction(a);
+                        }
+                        break;
+                    }
+                case DOC_COMMENT:
+                case TOKEN_REF:
+                case RULE_REF:
+                case LITERAL_protected:
+                case LITERAL_public:
+                case LITERAL_private:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+    }
+
+    public final void parserSpec(
+      String doc
+      ) throws RecognitionException, TokenStreamException {
+
+        Token a = null;
+
+        Token idTok;
+        String sup = null;
+
+
+        match(LITERAL_class);
+        idTok = id();
+        {
+            switch (LA(1)) {
+                case LITERAL_extends:
+                    {
+                        match(LITERAL_extends);
+                        match(LITERAL_Parser);
+                        {
+                            switch (LA(1)) {
+                                case LPAREN:
+                                    {
+                                        sup = superClass();
+                                        break;
+                                    }
+                                case SEMI:
+                                    {
+                                        break;
+                                    }
+                                default:
+                                    {
+                                        throw new NoViableAltException(LT(1), getFilename());
+                                    }
+                            }
+                        }
+                        break;
+                    }
+                case SEMI:
+                    {
+                        if (inputState.guessing == 0) {
+
+                            System.out.println("warning: line " +
+                                               idTok.getLine() + ": use 'class X extends Parser'");
+
+                        }
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        if (inputState.guessing == 0) {
+            behavior.startParser(getFilename(), idTok, sup, doc);
+        }
+        match(SEMI);
+        {
+            switch (LA(1)) {
+                case OPTIONS:
+                    {
+                        parserOptionsSpec();
+                        break;
+                    }
+                case ACTION:
+                case DOC_COMMENT:
+                case TOKENS:
+                case TOKEN_REF:
+                case RULE_REF:
+                case LITERAL_protected:
+                case LITERAL_public:
+                case LITERAL_private:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        if (inputState.guessing == 0) {
+            behavior.endOptions();
+        }
+        {
+            switch (LA(1)) {
+                case TOKENS:
+                    {
+                        tokensSpec();
+                        break;
+                    }
+                case ACTION:
+                case DOC_COMMENT:
+                case TOKEN_REF:
+                case RULE_REF:
+                case LITERAL_protected:
+                case LITERAL_public:
+                case LITERAL_private:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        {
+            switch (LA(1)) {
+                case ACTION:
+                    {
+                        a = LT(1);
+                        match(ACTION);
+                        if (inputState.guessing == 0) {
+                            behavior.refMemberAction(a);
+                        }
+                        break;
+                    }
+                case DOC_COMMENT:
+                case TOKEN_REF:
+                case RULE_REF:
+                case LITERAL_protected:
+                case LITERAL_public:
+                case LITERAL_private:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+    }
+
+    public final void rules() throws RecognitionException, TokenStreamException {
+
+
+        {
+            int _cnt68 = 0;
+            _loop68:
+            do {
+                if ((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2)))) {
+                    rule();
+                } else {
+                    if (_cnt68 >= 1) {
+                        break _loop68;
+                    } else {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+                }
+
+                _cnt68++;
+            } while (true);
+        }
+    }
+
+    public final Token optionValue() throws RecognitionException, TokenStreamException {
+        Token retval;
+
+        Token sl = null;
+        Token cl = null;
+        Token il = null;
+        retval = null;
+
+        switch (LA(1)) {
+            case TOKEN_REF:
+            case RULE_REF:
+                {
+                    retval = qualifiedID();
+                    break;
+                }
+            case STRING_LITERAL:
+                {
+                    sl = LT(1);
+                    match(STRING_LITERAL);
+                    if (inputState.guessing == 0) {
+                        retval = sl;
+                    }
+                    break;
+                }
+            case CHAR_LITERAL:
+                {
+                    cl = LT(1);
+                    match(CHAR_LITERAL);
+                    if (inputState.guessing == 0) {
+                        retval = cl;
+                    }
+                    break;
+                }
+            case INT:
+                {
+                    il = LT(1);
+                    match(INT);
+                    if (inputState.guessing == 0) {
+                        retval = il;
+                    }
+                    break;
+                }
+            default:
+                {
+                    throw new NoViableAltException(LT(1), getFilename());
+                }
+        }
+        return retval;
+    }
+
+    public final void parserOptionsSpec() throws RecognitionException, TokenStreamException {
+
+        Token idTok;
+        Token value;
+
+        match(OPTIONS);
+        {
+            _loop21:
+            do {
+                if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF)) {
+                    idTok = id();
+                    match(ASSIGN);
+                    value = optionValue();
+                    if (inputState.guessing == 0) {
+                        behavior.setGrammarOption(idTok, value);
+                    }
+                    match(SEMI);
+                } else {
+                    break _loop21;
+                }
+
+            } while (true);
+        }
+        match(RCURLY);
+    }
+
+    public final void treeParserOptionsSpec() throws RecognitionException, TokenStreamException {
+
+        Token idTok;
+        Token value;
+
+        match(OPTIONS);
+        {
+            _loop24:
+            do {
+                if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF)) {
+                    idTok = id();
+                    match(ASSIGN);
+                    value = optionValue();
+                    if (inputState.guessing == 0) {
+                        behavior.setGrammarOption(idTok, value);
+                    }
+                    match(SEMI);
+                } else {
+                    break _loop24;
+                }
+
+            } while (true);
+        }
+        match(RCURLY);
+    }
+
+    public final void lexerOptionsSpec() throws RecognitionException, TokenStreamException {
+
+        Token idTok;
+        Token value;
+        BitSet b;
+
+        match(OPTIONS);
+        {
+            _loop27:
+            do {
+                switch (LA(1)) {
+                    case LITERAL_charVocabulary:
+                        {
+                            match(LITERAL_charVocabulary);
+                            match(ASSIGN);
+                            b = charSet();
+                            match(SEMI);
+                            if (inputState.guessing == 0) {
+                                behavior.setCharVocabulary(b);
+                            }
+                            break;
+                        }
+                    case TOKEN_REF:
+                    case RULE_REF:
+                        {
+                            idTok = id();
+                            match(ASSIGN);
+                            value = optionValue();
+                            if (inputState.guessing == 0) {
+                                behavior.setGrammarOption(idTok, value);
+                            }
+                            match(SEMI);
+                            break;
+                        }
+                    default:
+                        {
+                            break _loop27;
+                        }
+                }
+            } while (true);
+        }
+        match(RCURLY);
+    }
+
+    public final BitSet charSet() throws RecognitionException, TokenStreamException {
+        BitSet b;
+
+
+        b = null;
+        BitSet tmpSet = null;
+
+
+        b = setBlockElement();
+        {
+            _loop34:
+            do {
+                if ((LA(1) == OR)) {
+                    match(OR);
+                    tmpSet = setBlockElement();
+                    if (inputState.guessing == 0) {
+                        b.orInPlace(tmpSet);
+                    }
+                } else {
+                    break _loop34;
+                }
+
+            } while (true);
+        }
+        return b;
+    }
+
+    public final void subruleOptionsSpec() throws RecognitionException, TokenStreamException {
+
+        Token idTok;
+        Token value;
+
+        match(OPTIONS);
+        {
+            _loop30:
+            do {
+                if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF)) {
+                    idTok = id();
+                    match(ASSIGN);
+                    value = optionValue();
+                    if (inputState.guessing == 0) {
+                        behavior.setSubruleOption(idTok, value);
+                    }
+                    match(SEMI);
+                } else {
+                    break _loop30;
+                }
+
+            } while (true);
+        }
+        match(RCURLY);
+    }
+
+    /** Match a.b.c.d qualified ids; WILDCARD here is overloaded as
+     *  id separator; that is, I need a reference to the '.' token.
+     */
+    public final Token qualifiedID() throws RecognitionException, TokenStreamException {
+        Token qidTok = null;
+
+
+        StringBuffer buf = new StringBuffer(30);
+        Token a;
+
+
+        a = id();
+        if (inputState.guessing == 0) {
+            buf.append(a.getText());
+        }
+        {
+            _loop144:
+            do {
+                if ((LA(1) == WILDCARD)) {
+                    match(WILDCARD);
+                    a = id();
+                    if (inputState.guessing == 0) {
+                        buf.append('.');
+                        buf.append(a.getText());
+                    }
+                } else {
+                    break _loop144;
+                }
+
+            } while (true);
+        }
+        if (inputState.guessing == 0) {
+
+            // can use either TOKEN_REF or RULE_REF; should
+            // really create a QID or something instead.
+            qidTok = new CommonToken(TOKEN_REF, buf.toString());
+            qidTok.setLine(a.getLine());
+
+        }
+        return qidTok;
+    }
+
+    public final BitSet setBlockElement() throws RecognitionException, TokenStreamException {
+        BitSet b;
+
+        Token c1 = null;
+        Token c2 = null;
+
+        b = null;
+        int rangeMin = 0;
+
+
+        c1 = LT(1);
+        match(CHAR_LITERAL);
+        if (inputState.guessing == 0) {
+
+            rangeMin = ANTLRLexer.tokenTypeForCharLiteral(c1.getText());
+            b = BitSet.of(rangeMin);
+
+        }
+        {
+            switch (LA(1)) {
+                case RANGE:
+                    {
+                        match(RANGE);
+                        c2 = LT(1);
+                        match(CHAR_LITERAL);
+                        if (inputState.guessing == 0) {
+
+                            int rangeMax = ANTLRLexer.tokenTypeForCharLiteral(c2.getText());
+                            if (rangeMax < rangeMin) {
+                                tool.error("Malformed range line " + c1.getLine());
+                            }
+                            for (int i = rangeMin + 1; i <= rangeMax; i++) {
+                                b.add(i);
+                            }
+
+                        }
+                        break;
+                    }
+                case SEMI:
+                case OR:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        return b;
+    }
+
+    public final void tokensSpec() throws RecognitionException, TokenStreamException {
+
+        Token t1 = null;
+        Token s1 = null;
+        Token s3 = null;
+
+        match(TOKENS);
+        {
+            int _cnt43 = 0;
+            _loop43:
+            do {
+                if ((LA(1) == STRING_LITERAL || LA(1) == TOKEN_REF)) {
+                    {
+                        switch (LA(1)) {
+                            case TOKEN_REF:
+                                {
+                                    if (inputState.guessing == 0) {
+                                        s1 = null;
+                                    }
+                                    t1 = LT(1);
+                                    match(TOKEN_REF);
+                                    {
+                                        switch (LA(1)) {
+                                            case ASSIGN:
+                                                {
+                                                    match(ASSIGN);
+                                                    s1 = LT(1);
+                                                    match(STRING_LITERAL);
+                                                    break;
+                                                }
+                                            case SEMI:
+                                            case OPEN_ELEMENT_OPTION:
+                                                {
+                                                    break;
+                                                }
+                                            default:
+                                                {
+                                                    throw new NoViableAltException(LT(1), getFilename());
+                                                }
+                                        }
+                                    }
+                                    if (inputState.guessing == 0) {
+                                        behavior.defineToken(t1, s1);
+                                    }
+                                    {
+                                        switch (LA(1)) {
+                                            case OPEN_ELEMENT_OPTION:
+                                                {
+                                                    tokensSpecOptions(t1);
+                                                    break;
+                                                }
+                                            case SEMI:
+                                                {
+                                                    break;
+                                                }
+                                            default:
+                                                {
+                                                    throw new NoViableAltException(LT(1), getFilename());
+                                                }
+                                        }
+                                    }
+                                    break;
+                                }
+                            case STRING_LITERAL:
+                                {
+                                    s3 = LT(1);
+                                    match(STRING_LITERAL);
+                                    if (inputState.guessing == 0) {
+                                        behavior.defineToken(null, s3);
+                                    }
+                                    {
+                                        switch (LA(1)) {
+                                            case OPEN_ELEMENT_OPTION:
+                                                {
+                                                    tokensSpecOptions(s3);
+                                                    break;
+                                                }
+                                            case SEMI:
+                                                {
+                                                    break;
+                                                }
+                                            default:
+                                                {
+                                                    throw new NoViableAltException(LT(1), getFilename());
+                                                }
+                                        }
+                                    }
+                                    break;
+                                }
+                            default:
+                                {
+                                    throw new NoViableAltException(LT(1), getFilename());
+                                }
+                        }
+                    }
+                    match(SEMI);
+                } else {
+                    if (_cnt43 >= 1) {
+                        break _loop43;
+                    } else {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+                }
+
+                _cnt43++;
+            } while (true);
+        }
+        match(RCURLY);
+    }
+
+    public final void tokensSpecOptions(
+      Token t
+      ) throws RecognitionException, TokenStreamException {
+
+
+        Token o = null, v = null;
+
+
+        match(OPEN_ELEMENT_OPTION);
+        o = id();
+        match(ASSIGN);
+        v = optionValue();
+        if (inputState.guessing == 0) {
+            behavior.refTokensSpecElementOption(t, o, v);
+        }
+        {
+            _loop46:
+            do {
+                if ((LA(1) == SEMI)) {
+                    match(SEMI);
+                    o = id();
+                    match(ASSIGN);
+                    v = optionValue();
+                    if (inputState.guessing == 0) {
+                        behavior.refTokensSpecElementOption(t, o, v);
+                    }
+                } else {
+                    break _loop46;
+                }
+
+            } while (true);
+        }
+        match(CLOSE_ELEMENT_OPTION);
+    }
+
+    public final String superClass() throws RecognitionException, TokenStreamException {
+        String sup;
+
+        sup = null;
+
+        match(LPAREN);
+        if (inputState.guessing == 0) {
+            sup = LT(1).getText();
+        }
+        {
+            switch (LA(1)) {
+                case TOKEN_REF:
+                    {
+                        match(TOKEN_REF);
+                        break;
+                    }
+                case RULE_REF:
+                    {
+                        match(RULE_REF);
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        match(RPAREN);
+        return sup;
+    }
+
+    public final void rule() throws RecognitionException, TokenStreamException {
+
+        Token d = null;
+        Token p1 = null;
+        Token p2 = null;
+        Token p3 = null;
+        Token aa = null;
+        Token rt = null;
+        Token a = null;
+
+        String access = "public";
+        Token idTok;
+        String doc = null;
+        boolean ruleAutoGen = true;
+        blockNesting = -1;	// block increments, so -1 to make rule at level 0
+
+
+        {
+            switch (LA(1)) {
+                case DOC_COMMENT:
+                    {
+                        d = LT(1);
+                        match(DOC_COMMENT);
+                        if (inputState.guessing == 0) {
+                            doc = d.getText();
+                        }
+                        break;
+                    }
+                case TOKEN_REF:
+                case RULE_REF:
+                case LITERAL_protected:
+                case LITERAL_public:
+                case LITERAL_private:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        {
+            switch (LA(1)) {
+                case LITERAL_protected:
+                    {
+                        p1 = LT(1);
+                        match(LITERAL_protected);
+                        if (inputState.guessing == 0) {
+                            access = p1.getText();
+                        }
+                        break;
+                    }
+                case LITERAL_public:
+                    {
+                        p2 = LT(1);
+                        match(LITERAL_public);
+                        if (inputState.guessing == 0) {
+                            access = p2.getText();
+                        }
+                        break;
+                    }
+                case LITERAL_private:
+                    {
+                        p3 = LT(1);
+                        match(LITERAL_private);
+                        if (inputState.guessing == 0) {
+                            access = p3.getText();
+                        }
+                        break;
+                    }
+                case TOKEN_REF:
+                case RULE_REF:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        idTok = id();
+        {
+            switch (LA(1)) {
+                case BANG:
+                    {
+                        match(BANG);
+                        if (inputState.guessing == 0) {
+                            ruleAutoGen = false;
+                        }
+                        break;
+                    }
+                case ACTION:
+                case OPTIONS:
+                case ARG_ACTION:
+                case LITERAL_returns:
+                case COLON:
+                case LITERAL_throws:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        if (inputState.guessing == 0) {
+
+            behavior.defineRuleName(idTok, access, ruleAutoGen, doc);
+
+        }
+        {
+            switch (LA(1)) {
+                case ARG_ACTION:
+                    {
+                        aa = LT(1);
+                        match(ARG_ACTION);
+                        if (inputState.guessing == 0) {
+                            behavior.refArgAction(aa);
+                        }
+                        break;
+                    }
+                case ACTION:
+                case OPTIONS:
+                case LITERAL_returns:
+                case COLON:
+                case LITERAL_throws:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        {
+            switch (LA(1)) {
+                case LITERAL_returns:
+                    {
+                        match(LITERAL_returns);
+                        rt = LT(1);
+                        match(ARG_ACTION);
+                        if (inputState.guessing == 0) {
+                            behavior.refReturnAction(rt);
+                        }
+                        break;
+                    }
+                case ACTION:
+                case OPTIONS:
+                case COLON:
+                case LITERAL_throws:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        {
+            switch (LA(1)) {
+                case LITERAL_throws:
+                    {
+                        throwsSpec();
+                        break;
+                    }
+                case ACTION:
+                case OPTIONS:
+                case COLON:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        {
+            switch (LA(1)) {
+                case OPTIONS:
+                    {
+                        ruleOptionsSpec();
+                        break;
+                    }
+                case ACTION:
+                case COLON:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        {
+            switch (LA(1)) {
+                case ACTION:
+                    {
+                        a = LT(1);
+                        match(ACTION);
+                        if (inputState.guessing == 0) {
+                            behavior.refInitAction(a);
+                        }
+                        break;
+                    }
+                case COLON:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        match(COLON);
+        block();
+        match(SEMI);
+        {
+            switch (LA(1)) {
+                case LITERAL_exception:
+                    {
+                        exceptionGroup();
+                        break;
+                    }
+                case EOF:
+                case ACTION:
+                case DOC_COMMENT:
+                case LITERAL_lexclass:
+                case LITERAL_class:
+                case TOKEN_REF:
+                case RULE_REF:
+                case LITERAL_protected:
+                case LITERAL_public:
+                case LITERAL_private:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        if (inputState.guessing == 0) {
+            behavior.endRule(idTok.getText());
+        }
+    }
+
+    public final void throwsSpec() throws RecognitionException, TokenStreamException {
+
+
+        String t = null;
+        Token a,b;
+
+
+        match(LITERAL_throws);
+        a = id();
+        if (inputState.guessing == 0) {
+            t = a.getText();
+        }
+        {
+            _loop84:
+            do {
+                if ((LA(1) == COMMA)) {
+                    match(COMMA);
+                    b = id();
+                    if (inputState.guessing == 0) {
+                        t += "," + b.getText();
+                    }
+                } else {
+                    break _loop84;
+                }
+
+            } while (true);
+        }
+        if (inputState.guessing == 0) {
+            behavior.setUserExceptions(t);
+        }
+    }
+
+    public final void ruleOptionsSpec() throws RecognitionException, TokenStreamException {
+
+        Token idTok;
+        Token value;
+
+        match(OPTIONS);
+        {
+            _loop81:
+            do {
+                if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF)) {
+                    idTok = id();
+                    match(ASSIGN);
+                    value = optionValue();
+                    if (inputState.guessing == 0) {
+                        behavior.setRuleOption(idTok, value);
+                    }
+                    match(SEMI);
+                } else {
+                    break _loop81;
+                }
+
+            } while (true);
+        }
+        match(RCURLY);
+    }
+
+    public final void block() throws RecognitionException, TokenStreamException {
+
+
+        if (inputState.guessing == 0) {
+            blockNesting++;
+        }
+        alternative();
+        {
+            _loop87:
+            do {
+                if ((LA(1) == OR)) {
+                    match(OR);
+                    alternative();
+                } else {
+                    break _loop87;
+                }
+
+            } while (true);
+        }
+        if (inputState.guessing == 0) {
+            blockNesting--;
+        }
+    }
+
+    public final void exceptionGroup() throws RecognitionException, TokenStreamException {
+
+
+        if (inputState.guessing == 0) {
+            behavior.beginExceptionGroup();
+        }
+        {
+            int _cnt95 = 0;
+            _loop95:
+            do {
+                if ((LA(1) == LITERAL_exception)) {
+                    exceptionSpec();
+                } else {
+                    if (_cnt95 >= 1) {
+                        break _loop95;
+                    } else {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+                }
+
+                _cnt95++;
+            } while (true);
+        }
+        if (inputState.guessing == 0) {
+            behavior.endExceptionGroup();
+        }
+    }
+
+    public final void alternative() throws RecognitionException, TokenStreamException {
+
+        boolean altAutoGen = true;
+
+        {
+            switch (LA(1)) {
+                case BANG:
+                    {
+                        match(BANG);
+                        if (inputState.guessing == 0) {
+                            altAutoGen = false;
+                        }
+                        break;
+                    }
+                case STRING_LITERAL:
+                case ACTION:
+                case SEMI:
+                case CHAR_LITERAL:
+                case OR:
+                case TOKEN_REF:
+                case LPAREN:
+                case RULE_REF:
+                case RPAREN:
+                case LITERAL_exception:
+                case NOT_OP:
+                case SEMPRED:
+                case TREE_BEGIN:
+                case WILDCARD:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        if (inputState.guessing == 0) {
+            behavior.beginAlt(altAutoGen);
+        }
+        {
+            _loop91:
+            do {
+                if ((_tokenSet_2.member(LA(1)))) {
+                    element();
+                } else {
+                    break _loop91;
+                }
+
+            } while (true);
+        }
+        {
+            switch (LA(1)) {
+                case LITERAL_exception:
+                    {
+                        exceptionSpecNoLabel();
+                        break;
+                    }
+                case SEMI:
+                case OR:
+                case RPAREN:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        if (inputState.guessing == 0) {
+            behavior.endAlt();
+        }
+    }
+
+    public final void element() throws RecognitionException, TokenStreamException {
+
+
+        elementNoOptionSpec();
+        {
+            switch (LA(1)) {
+                case OPEN_ELEMENT_OPTION:
+                    {
+                        elementOptionSpec();
+                        break;
+                    }
+                case STRING_LITERAL:
+                case ACTION:
+                case SEMI:
+                case CHAR_LITERAL:
+                case OR:
+                case TOKEN_REF:
+                case LPAREN:
+                case RULE_REF:
+                case RPAREN:
+                case LITERAL_exception:
+                case NOT_OP:
+                case SEMPRED:
+                case TREE_BEGIN:
+                case WILDCARD:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+    }
+
+    public final void exceptionSpecNoLabel() throws RecognitionException, TokenStreamException {
+
+
+        match(LITERAL_exception);
+        if (inputState.guessing == 0) {
+            behavior.beginExceptionSpec(null);
+        }
+        {
+            _loop102:
+            do {
+                if ((LA(1) == LITERAL_catch)) {
+                    exceptionHandler();
+                } else {
+                    break _loop102;
+                }
+
+            } while (true);
+        }
+        if (inputState.guessing == 0) {
+            behavior.endExceptionSpec();
+        }
+    }
+
+    public final void exceptionSpec() throws RecognitionException, TokenStreamException {
+
+        Token aa = null;
+        Token labelAction = null;
+
+        match(LITERAL_exception);
+        {
+            switch (LA(1)) {
+                case ARG_ACTION:
+                    {
+                        aa = LT(1);
+                        match(ARG_ACTION);
+                        if (inputState.guessing == 0) {
+                            labelAction = aa;
+                        }
+                        break;
+                    }
+                case EOF:
+                case ACTION:
+                case DOC_COMMENT:
+                case LITERAL_lexclass:
+                case LITERAL_class:
+                case TOKEN_REF:
+                case RULE_REF:
+                case LITERAL_protected:
+                case LITERAL_public:
+                case LITERAL_private:
+                case LITERAL_exception:
+                case LITERAL_catch:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        if (inputState.guessing == 0) {
+            behavior.beginExceptionSpec(labelAction);
+        }
+        {
+            _loop99:
+            do {
+                if ((LA(1) == LITERAL_catch)) {
+                    exceptionHandler();
+                } else {
+                    break _loop99;
+                }
+
+            } while (true);
+        }
+        if (inputState.guessing == 0) {
+            behavior.endExceptionSpec();
+        }
+    }
+
+    public final void exceptionHandler() throws RecognitionException, TokenStreamException {
+
+        Token a1 = null;
+        Token a2 = null;
+        Token exType;
+        Token exName;
+
+        match(LITERAL_catch);
+        a1 = LT(1);
+        match(ARG_ACTION);
+        a2 = LT(1);
+        match(ACTION);
+        if (inputState.guessing == 0) {
+            behavior.refExceptionHandler(a1, a2);
+        }
+    }
+
+    public final void elementNoOptionSpec() throws RecognitionException, TokenStreamException {
+
+        Token rr = null;
+        Token aa = null;
+        Token tr = null;
+        Token aa2 = null;
+        Token r2 = null;
+        Token aa3 = null;
+        Token a = null;
+        Token p = null;
+
+        Token label = null;
+        Token assignId = null;
+        Token args = null;
+        int autoGen = GrammarElement.AUTO_GEN_NONE;
+
+
+        switch (LA(1)) {
+            case ACTION:
+                {
+                    a = LT(1);
+                    match(ACTION);
+                    if (inputState.guessing == 0) {
+                        behavior.refAction(a);
+                    }
+                    break;
+                }
+            case SEMPRED:
+                {
+                    p = LT(1);
+                    match(SEMPRED);
+                    if (inputState.guessing == 0) {
+                        behavior.refSemPred(p);
+                    }
+                    break;
+                }
+            case TREE_BEGIN:
+                {
+                    tree();
+                    break;
+                }
+            default:
+                if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF) && (LA(2) == ASSIGN)) {
+                    assignId = id();
+                    match(ASSIGN);
+                    {
+                        if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF) && (LA(2) == COLON)) {
+                            label = id();
+                            match(COLON);
+                            if (inputState.guessing == 0) {
+                                checkForMissingEndRule(label);
+                            }
+                        } else if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF) && (_tokenSet_3.member(LA(2)))) {
+                        } else {
+                            throw new NoViableAltException(LT(1), getFilename());
+                        }
+
+                    }
+                    {
+                        switch (LA(1)) {
+                            case RULE_REF:
+                                {
+                                    rr = LT(1);
+                                    match(RULE_REF);
+                                    {
+                                        switch (LA(1)) {
+                                            case ARG_ACTION:
+                                                {
+                                                    aa = LT(1);
+                                                    match(ARG_ACTION);
+                                                    if (inputState.guessing == 0) {
+                                                        args = aa;
+                                                    }
+                                                    break;
+                                                }
+                                            case STRING_LITERAL:
+                                            case ACTION:
+                                            case SEMI:
+                                            case CHAR_LITERAL:
+                                            case OR:
+                                            case TOKEN_REF:
+                                            case OPEN_ELEMENT_OPTION:
+                                            case LPAREN:
+                                            case RULE_REF:
+                                            case RPAREN:
+                                            case BANG:
+                                            case LITERAL_exception:
+                                            case NOT_OP:
+                                            case SEMPRED:
+                                            case TREE_BEGIN:
+                                            case WILDCARD:
+                                                {
+                                                    break;
+                                                }
+                                            default:
+                                                {
+                                                    throw new NoViableAltException(LT(1), getFilename());
+                                                }
+                                        }
+                                    }
+                                    {
+                                        switch (LA(1)) {
+                                            case BANG:
+                                                {
+                                                    match(BANG);
+                                                    if (inputState.guessing == 0) {
+                                                        autoGen = GrammarElement.AUTO_GEN_BANG;
+                                                    }
+                                                    break;
+                                                }
+                                            case STRING_LITERAL:
+                                            case ACTION:
+                                            case SEMI:
+                                            case CHAR_LITERAL:
+                                            case OR:
+                                            case TOKEN_REF:
+                                            case OPEN_ELEMENT_OPTION:
+                                            case LPAREN:
+                                            case RULE_REF:
+                                            case RPAREN:
+                                            case LITERAL_exception:
+                                            case NOT_OP:
+                                            case SEMPRED:
+                                            case TREE_BEGIN:
+                                            case WILDCARD:
+                                                {
+                                                    break;
+                                                }
+                                            default:
+                                                {
+                                                    throw new NoViableAltException(LT(1), getFilename());
+                                                }
+                                        }
+                                    }
+                                    if (inputState.guessing == 0) {
+                                        behavior.refRule(assignId, rr, label, args, autoGen);
+                                    }
+                                    break;
+                                }
+                            case TOKEN_REF:
+                                {
+                                    tr = LT(1);
+                                    match(TOKEN_REF);
+                                    {
+                                        switch (LA(1)) {
+                                            case ARG_ACTION:
+                                                {
+                                                    aa2 = LT(1);
+                                                    match(ARG_ACTION);
+                                                    if (inputState.guessing == 0) {
+                                                        args = aa2;
+                                                    }
+                                                    break;
+                                                }
+                                            case STRING_LITERAL:
+                                            case ACTION:
+                                            case SEMI:
+                                            case CHAR_LITERAL:
+                                            case OR:
+                                            case TOKEN_REF:
+                                            case OPEN_ELEMENT_OPTION:
+                                            case LPAREN:
+                                            case RULE_REF:
+                                            case RPAREN:
+                                            case LITERAL_exception:
+                                            case NOT_OP:
+                                            case SEMPRED:
+                                            case TREE_BEGIN:
+                                            case WILDCARD:
+                                                {
+                                                    break;
+                                                }
+                                            default:
+                                                {
+                                                    throw new NoViableAltException(LT(1), getFilename());
+                                                }
+                                        }
+                                    }
+                                    if (inputState.guessing == 0) {
+                                        behavior.refToken(assignId, tr, label, args, false, autoGen, lastInRule());
+                                    }
+                                    break;
+                                }
+                            default:
+                                {
+                                    throw new NoViableAltException(LT(1), getFilename());
+                                }
+                        }
+                    }
+                } else if ((_tokenSet_4.member(LA(1))) && (_tokenSet_5.member(LA(2)))) {
+                    {
+                        if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF) && (LA(2) == COLON)) {
+                            label = id();
+                            match(COLON);
+                            if (inputState.guessing == 0) {
+                                checkForMissingEndRule(label);
+                            }
+                        } else if ((_tokenSet_4.member(LA(1))) && (_tokenSet_6.member(LA(2)))) {
+                        } else {
+                            throw new NoViableAltException(LT(1), getFilename());
+                        }
+
+                    }
+                    {
+                        switch (LA(1)) {
+                            case RULE_REF:
+                                {
+                                    r2 = LT(1);
+                                    match(RULE_REF);
+                                    {
+                                        switch (LA(1)) {
+                                            case ARG_ACTION:
+                                                {
+                                                    aa3 = LT(1);
+                                                    match(ARG_ACTION);
+                                                    if (inputState.guessing == 0) {
+                                                        args = aa3;
+                                                    }
+                                                    break;
+                                                }
+                                            case STRING_LITERAL:
+                                            case ACTION:
+                                            case SEMI:
+                                            case CHAR_LITERAL:
+                                            case OR:
+                                            case TOKEN_REF:
+                                            case OPEN_ELEMENT_OPTION:
+                                            case LPAREN:
+                                            case RULE_REF:
+                                            case RPAREN:
+                                            case BANG:
+                                            case LITERAL_exception:
+                                            case NOT_OP:
+                                            case SEMPRED:
+                                            case TREE_BEGIN:
+                                            case WILDCARD:
+                                                {
+                                                    break;
+                                                }
+                                            default:
+                                                {
+                                                    throw new NoViableAltException(LT(1), getFilename());
+                                                }
+                                        }
+                                    }
+                                    {
+                                        switch (LA(1)) {
+                                            case BANG:
+                                                {
+                                                    match(BANG);
+                                                    if (inputState.guessing == 0) {
+                                                        autoGen = GrammarElement.AUTO_GEN_BANG;
+                                                    }
+                                                    break;
+                                                }
+                                            case STRING_LITERAL:
+                                            case ACTION:
+                                            case SEMI:
+                                            case CHAR_LITERAL:
+                                            case OR:
+                                            case TOKEN_REF:
+                                            case OPEN_ELEMENT_OPTION:
+                                            case LPAREN:
+                                            case RULE_REF:
+                                            case RPAREN:
+                                            case LITERAL_exception:
+                                            case NOT_OP:
+                                            case SEMPRED:
+                                            case TREE_BEGIN:
+                                            case WILDCARD:
+                                                {
+                                                    break;
+                                                }
+                                            default:
+                                                {
+                                                    throw new NoViableAltException(LT(1), getFilename());
+                                                }
+                                        }
+                                    }
+                                    if (inputState.guessing == 0) {
+                                        behavior.refRule(assignId, r2, label, args, autoGen);
+                                    }
+                                    break;
+                                }
+                            case NOT_OP:
+                                {
+                                    match(NOT_OP);
+                                    {
+                                        switch (LA(1)) {
+                                            case CHAR_LITERAL:
+                                            case TOKEN_REF:
+                                                {
+                                                    notTerminal(label);
+                                                    break;
+                                                }
+                                            case LPAREN:
+                                                {
+                                                    ebnf(label, true);
+                                                    break;
+                                                }
+                                            default:
+                                                {
+                                                    throw new NoViableAltException(LT(1), getFilename());
+                                                }
+                                        }
+                                    }
+                                    break;
+                                }
+                            case LPAREN:
+                                {
+                                    ebnf(label, false);
+                                    break;
+                                }
+                            default:
+                                if ((LA(1) == STRING_LITERAL || LA(1) == CHAR_LITERAL || LA(1) == TOKEN_REF) && (LA(2) == RANGE)) {
+                                    range(label);
+                                } else if ((_tokenSet_7.member(LA(1))) && (_tokenSet_8.member(LA(2)))) {
+                                    terminal(label);
+                                } else {
+                                    throw new NoViableAltException(LT(1), getFilename());
+                                }
+                        }
+                    }
+                } else {
+                    throw new NoViableAltException(LT(1), getFilename());
+                }
+        }
+    }
+
+    public final void elementOptionSpec() throws RecognitionException, TokenStreamException {
+
+
+        Token o = null, v = null;
+
+
+        match(OPEN_ELEMENT_OPTION);
+        o = id();
+        match(ASSIGN);
+        v = optionValue();
+        if (inputState.guessing == 0) {
+            behavior.refElementOption(o, v);
+        }
+        {
+            _loop108:
+            do {
+                if ((LA(1) == SEMI)) {
+                    match(SEMI);
+                    o = id();
+                    match(ASSIGN);
+                    v = optionValue();
+                    if (inputState.guessing == 0) {
+                        behavior.refElementOption(o, v);
+                    }
+                } else {
+                    break _loop108;
+                }
+
+            } while (true);
+        }
+        match(CLOSE_ELEMENT_OPTION);
+    }
+
+    public final void range(
+      Token label
+      ) throws RecognitionException, TokenStreamException {
+
+        Token crLeft = null;
+        Token crRight = null;
+        Token t = null;
+        Token u = null;
+        Token v = null;
+        Token w = null;
+
+        Token trLeft = null;
+        Token trRight = null;
+        int autoGen = GrammarElement.AUTO_GEN_NONE;
+
+
+        switch (LA(1)) {
+            case CHAR_LITERAL:
+                {
+                    crLeft = LT(1);
+                    match(CHAR_LITERAL);
+                    match(RANGE);
+                    crRight = LT(1);
+                    match(CHAR_LITERAL);
+                    {
+                        switch (LA(1)) {
+                            case BANG:
+                                {
+                                    match(BANG);
+                                    if (inputState.guessing == 0) {
+                                        autoGen = GrammarElement.AUTO_GEN_BANG;
+                                    }
+                                    break;
+                                }
+                            case STRING_LITERAL:
+                            case ACTION:
+                            case SEMI:
+                            case CHAR_LITERAL:
+                            case OR:
+                            case TOKEN_REF:
+                            case OPEN_ELEMENT_OPTION:
+                            case LPAREN:
+                            case RULE_REF:
+                            case RPAREN:
+                            case LITERAL_exception:
+                            case NOT_OP:
+                            case SEMPRED:
+                            case TREE_BEGIN:
+                            case WILDCARD:
+                                {
+                                    break;
+                                }
+                            default:
+                                {
+                                    throw new NoViableAltException(LT(1), getFilename());
+                                }
+                        }
+                    }
+                    if (inputState.guessing == 0) {
+                        behavior.refCharRange(crLeft, crRight, label, autoGen, lastInRule());
+                    }
+                    break;
+                }
+            case STRING_LITERAL:
+            case TOKEN_REF:
+                {
+                    {
+                        switch (LA(1)) {
+                            case TOKEN_REF:
+                                {
+                                    t = LT(1);
+                                    match(TOKEN_REF);
+                                    if (inputState.guessing == 0) {
+                                        trLeft = t;
+                                    }
+                                    break;
+                                }
+                            case STRING_LITERAL:
+                                {
+                                    u = LT(1);
+                                    match(STRING_LITERAL);
+                                    if (inputState.guessing == 0) {
+                                        trLeft = u;
+                                    }
+                                    break;
+                                }
+                            default:
+                                {
+                                    throw new NoViableAltException(LT(1), getFilename());
+                                }
+                        }
+                    }
+                    match(RANGE);
+                    {
+                        switch (LA(1)) {
+                            case TOKEN_REF:
+                                {
+                                    v = LT(1);
+                                    match(TOKEN_REF);
+                                    if (inputState.guessing == 0) {
+                                        trRight = v;
+                                    }
+                                    break;
+                                }
+                            case STRING_LITERAL:
+                                {
+                                    w = LT(1);
+                                    match(STRING_LITERAL);
+                                    if (inputState.guessing == 0) {
+                                        trRight = w;
+                                    }
+                                    break;
+                                }
+                            default:
+                                {
+                                    throw new NoViableAltException(LT(1), getFilename());
+                                }
+                        }
+                    }
+                    autoGen = ast_type_spec();
+                    if (inputState.guessing == 0) {
+                        behavior.refTokenRange(trLeft, trRight, label, autoGen, lastInRule());
+                    }
+                    break;
+                }
+            default:
+                {
+                    throw new NoViableAltException(LT(1), getFilename());
+                }
+        }
+    }
+
+    public final void terminal(
+      Token label
+      ) throws RecognitionException, TokenStreamException {
+
+        Token cl = null;
+        Token tr = null;
+        Token aa = null;
+        Token sl = null;
+        Token wi = null;
+
+        int autoGen = GrammarElement.AUTO_GEN_NONE;
+        Token args = null;
+
+
+        switch (LA(1)) {
+            case CHAR_LITERAL:
+                {
+                    cl = LT(1);
+                    match(CHAR_LITERAL);
+                    {
+                        switch (LA(1)) {
+                            case BANG:
+                                {
+                                    match(BANG);
+                                    if (inputState.guessing == 0) {
+                                        autoGen = GrammarElement.AUTO_GEN_BANG;
+                                    }
+                                    break;
+                                }
+                            case STRING_LITERAL:
+                            case ACTION:
+                            case SEMI:
+                            case CHAR_LITERAL:
+                            case OR:
+                            case TOKEN_REF:
+                            case OPEN_ELEMENT_OPTION:
+                            case LPAREN:
+                            case RULE_REF:
+                            case RPAREN:
+                            case LITERAL_exception:
+                            case NOT_OP:
+                            case SEMPRED:
+                            case TREE_BEGIN:
+                            case WILDCARD:
+                                {
+                                    break;
+                                }
+                            default:
+                                {
+                                    throw new NoViableAltException(LT(1), getFilename());
+                                }
+                        }
+                    }
+                    if (inputState.guessing == 0) {
+                        behavior.refCharLiteral(cl, label, false, autoGen, lastInRule());
+                    }
+                    break;
+                }
+            case TOKEN_REF:
+                {
+                    tr = LT(1);
+                    match(TOKEN_REF);
+                    autoGen = ast_type_spec();
+                    {
+                        switch (LA(1)) {
+                            case ARG_ACTION:
+                                {
+                                    aa = LT(1);
+                                    match(ARG_ACTION);
+                                    if (inputState.guessing == 0) {
+                                        args = aa;
+                                    }
+                                    break;
+                                }
+                            case STRING_LITERAL:
+                            case ACTION:
+                            case SEMI:
+                            case CHAR_LITERAL:
+                            case OR:
+                            case TOKEN_REF:
+                            case OPEN_ELEMENT_OPTION:
+                            case LPAREN:
+                            case RULE_REF:
+                            case RPAREN:
+                            case LITERAL_exception:
+                            case NOT_OP:
+                            case SEMPRED:
+                            case TREE_BEGIN:
+                            case WILDCARD:
+                                {
+                                    break;
+                                }
+                            default:
+                                {
+                                    throw new NoViableAltException(LT(1), getFilename());
+                                }
+                        }
+                    }
+                    if (inputState.guessing == 0) {
+                        behavior.refToken(null, tr, label, args, false, autoGen, lastInRule());
+                    }
+                    break;
+                }
+            case STRING_LITERAL:
+                {
+                    sl = LT(1);
+                    match(STRING_LITERAL);
+                    autoGen = ast_type_spec();
+                    if (inputState.guessing == 0) {
+                        behavior.refStringLiteral(sl, label, autoGen, lastInRule());
+                    }
+                    break;
+                }
+            case WILDCARD:
+                {
+                    wi = LT(1);
+                    match(WILDCARD);
+                    autoGen = ast_type_spec();
+                    if (inputState.guessing == 0) {
+                        behavior.refWildcard(wi, label, autoGen);
+                    }
+                    break;
+                }
+            default:
+                {
+                    throw new NoViableAltException(LT(1), getFilename());
+                }
+        }
+    }
+
+    public final void notTerminal(
+      Token label
+      ) throws RecognitionException, TokenStreamException {
+
+        Token cl = null;
+        Token tr = null;
+        int autoGen = GrammarElement.AUTO_GEN_NONE;
+
+        switch (LA(1)) {
+            case CHAR_LITERAL:
+                {
+                    cl = LT(1);
+                    match(CHAR_LITERAL);
+                    {
+                        switch (LA(1)) {
+                            case BANG:
+                                {
+                                    match(BANG);
+                                    if (inputState.guessing == 0) {
+                                        autoGen = GrammarElement.AUTO_GEN_BANG;
+                                    }
+                                    break;
+                                }
+                            case STRING_LITERAL:
+                            case ACTION:
+                            case SEMI:
+                            case CHAR_LITERAL:
+                            case OR:
+                            case TOKEN_REF:
+                            case OPEN_ELEMENT_OPTION:
+                            case LPAREN:
+                            case RULE_REF:
+                            case RPAREN:
+                            case LITERAL_exception:
+                            case NOT_OP:
+                            case SEMPRED:
+                            case TREE_BEGIN:
+                            case WILDCARD:
+                                {
+                                    break;
+                                }
+                            default:
+                                {
+                                    throw new NoViableAltException(LT(1), getFilename());
+                                }
+                        }
+                    }
+                    if (inputState.guessing == 0) {
+                        behavior.refCharLiteral(cl, label, true, autoGen, lastInRule());
+                    }
+                    break;
+                }
+            case TOKEN_REF:
+                {
+                    tr = LT(1);
+                    match(TOKEN_REF);
+                    autoGen = ast_type_spec();
+                    if (inputState.guessing == 0) {
+                        behavior.refToken(null, tr, label, null, true, autoGen, lastInRule());
+                    }
+                    break;
+                }
+            default:
+                {
+                    throw new NoViableAltException(LT(1), getFilename());
+                }
+        }
+    }
+
+    public final void ebnf(
+      Token label, boolean not
+      ) throws RecognitionException, TokenStreamException {
+
+        Token lp = null;
+        Token aa = null;
+        Token ab = null;
+
+        lp = LT(1);
+        match(LPAREN);
+        if (inputState.guessing == 0) {
+            behavior.beginSubRule(label, lp.getLine(), not);
+        }
+        {
+            if ((LA(1) == OPTIONS)) {
+                subruleOptionsSpec();
+                {
+                    switch (LA(1)) {
+                        case ACTION:
+                            {
+                                aa = LT(1);
+                                match(ACTION);
+                                if (inputState.guessing == 0) {
+                                    behavior.refInitAction(aa);
+                                }
+                                break;
+                            }
+                        case COLON:
+                            {
+                                break;
+                            }
+                        default:
+                            {
+                                throw new NoViableAltException(LT(1), getFilename());
+                            }
+                    }
+                }
+                match(COLON);
+            } else if ((LA(1) == ACTION) && (LA(2) == COLON)) {
+                ab = LT(1);
+                match(ACTION);
+                if (inputState.guessing == 0) {
+                    behavior.refInitAction(ab);
+                }
+                match(COLON);
+            } else if ((_tokenSet_9.member(LA(1))) && (_tokenSet_10.member(LA(2)))) {
+            } else {
+                throw new NoViableAltException(LT(1), getFilename());
+            }
+
+        }
+        block();
+        match(RPAREN);
+        {
+            switch (LA(1)) {
+                case STRING_LITERAL:
+                case ACTION:
+                case SEMI:
+                case CHAR_LITERAL:
+                case OR:
+                case TOKEN_REF:
+                case OPEN_ELEMENT_OPTION:
+                case LPAREN:
+                case RULE_REF:
+                case RPAREN:
+                case BANG:
+                case LITERAL_exception:
+                case NOT_OP:
+                case SEMPRED:
+                case TREE_BEGIN:
+                case QUESTION:
+                case STAR:
+                case PLUS:
+                case WILDCARD:
+                    {
+                        {
+                            switch (LA(1)) {
+                                case QUESTION:
+                                    {
+                                        match(QUESTION);
+                                        if (inputState.guessing == 0) {
+                                            behavior.optionalSubRule();
+                                        }
+                                        break;
+                                    }
+                                case STAR:
+                                    {
+                                        match(STAR);
+                                        if (inputState.guessing == 0) {
+                                            behavior.zeroOrMoreSubRule();
+                                            ;
+                                        }
+                                        break;
+                                    }
+                                case PLUS:
+                                    {
+                                        match(PLUS);
+                                        if (inputState.guessing == 0) {
+                                            behavior.oneOrMoreSubRule();
+                                        }
+                                        break;
+                                    }
+                                case STRING_LITERAL:
+                                case ACTION:
+                                case SEMI:
+                                case CHAR_LITERAL:
+                                case OR:
+                                case TOKEN_REF:
+                                case OPEN_ELEMENT_OPTION:
+                                case LPAREN:
+                                case RULE_REF:
+                                case RPAREN:
+                                case BANG:
+                                case LITERAL_exception:
+                                case NOT_OP:
+                                case SEMPRED:
+                                case TREE_BEGIN:
+                                case WILDCARD:
+                                    {
+                                        break;
+                                    }
+                                default:
+                                    {
+                                        throw new NoViableAltException(LT(1), getFilename());
+                                    }
+                            }
+                        }
+                        {
+                            switch (LA(1)) {
+                                case BANG:
+                                    {
+                                        match(BANG);
+                                        if (inputState.guessing == 0) {
+                                            behavior.noASTSubRule();
+                                        }
+                                        break;
+                                    }
+                                case STRING_LITERAL:
+                                case ACTION:
+                                case SEMI:
+                                case CHAR_LITERAL:
+                                case OR:
+                                case TOKEN_REF:
+                                case OPEN_ELEMENT_OPTION:
+                                case LPAREN:
+                                case RULE_REF:
+                                case RPAREN:
+                                case LITERAL_exception:
+                                case NOT_OP:
+                                case SEMPRED:
+                                case TREE_BEGIN:
+                                case WILDCARD:
+                                    {
+                                        break;
+                                    }
+                                default:
+                                    {
+                                        throw new NoViableAltException(LT(1), getFilename());
+                                    }
+                            }
+                        }
+                        break;
+                    }
+                case IMPLIES:
+                    {
+                        match(IMPLIES);
+                        if (inputState.guessing == 0) {
+                            behavior.synPred();
+                        }
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        if (inputState.guessing == 0) {
+            behavior.endSubRule();
+        }
+    }
+
+    public final void tree() throws RecognitionException, TokenStreamException {
+
+        Token lp = null;
+
+        lp = LT(1);
+        match(TREE_BEGIN);
+        if (inputState.guessing == 0) {
+            behavior.beginTree(lp.getLine());
+        }
+        rootNode();
+        if (inputState.guessing == 0) {
+            behavior.beginChildList();
+        }
+        {
+            int _cnt122 = 0;
+            _loop122:
+            do {
+                if ((_tokenSet_2.member(LA(1)))) {
+                    element();
+                } else {
+                    if (_cnt122 >= 1) {
+                        break _loop122;
+                    } else {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+                }
+
+                _cnt122++;
+            } while (true);
+        }
+        if (inputState.guessing == 0) {
+            behavior.endChildList();
+        }
+        match(RPAREN);
+        if (inputState.guessing == 0) {
+            behavior.endTree();
+        }
+    }
+
+    public final void rootNode() throws RecognitionException, TokenStreamException {
+
+        Token label = null;
+
+        {
+            if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF) && (LA(2) == COLON)) {
+                label = id();
+                match(COLON);
+                if (inputState.guessing == 0) {
+                    checkForMissingEndRule(label);
+                }
+            } else if ((_tokenSet_7.member(LA(1))) && (_tokenSet_11.member(LA(2)))) {
+            } else {
+                throw new NoViableAltException(LT(1), getFilename());
+            }
+
+        }
+        terminal(label);
+    }
+
+    public final int ast_type_spec() throws RecognitionException, TokenStreamException {
+        int autoGen;
+
+        autoGen = GrammarElement.AUTO_GEN_NONE;
+
+        {
+            switch (LA(1)) {
+                case CARET:
+                    {
+                        match(CARET);
+                        if (inputState.guessing == 0) {
+                            autoGen = GrammarElement.AUTO_GEN_CARET;
+                        }
+                        break;
+                    }
+                case BANG:
+                    {
+                        match(BANG);
+                        if (inputState.guessing == 0) {
+                            autoGen = GrammarElement.AUTO_GEN_BANG;
+                        }
+                        break;
+                    }
+                case STRING_LITERAL:
+                case ACTION:
+                case SEMI:
+                case CHAR_LITERAL:
+                case OR:
+                case TOKEN_REF:
+                case OPEN_ELEMENT_OPTION:
+                case LPAREN:
+                case RULE_REF:
+                case RPAREN:
+                case ARG_ACTION:
+                case LITERAL_exception:
+                case NOT_OP:
+                case SEMPRED:
+                case TREE_BEGIN:
+                case WILDCARD:
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltException(LT(1), getFilename());
+                    }
+            }
+        }
+        return autoGen;
+    }
+
+
+    public static final String[] _tokenNames = {
+        "<0>",
+        "EOF",
+        "<2>",
+        "NULL_TREE_LOOKAHEAD",
+        "\"tokens\"",
+        "\"header\"",
+        "STRING_LITERAL",
+        "ACTION",
+        "DOC_COMMENT",
+        "\"lexclass\"",
+        "\"class\"",
+        "\"extends\"",
+        "\"Lexer\"",
+        "\"TreeParser\"",
+        "OPTIONS",
+        "ASSIGN",
+        "SEMI",
+        "RCURLY",
+        "\"charVocabulary\"",
+        "CHAR_LITERAL",
+        "INT",
+        "OR",
+        "RANGE",
+        "TOKENS",
+        "TOKEN_REF",
+        "OPEN_ELEMENT_OPTION",
+        "CLOSE_ELEMENT_OPTION",
+        "LPAREN",
+        "RULE_REF",
+        "RPAREN",
+        "\"Parser\"",
+        "\"protected\"",
+        "\"public\"",
+        "\"private\"",
+        "BANG",
+        "ARG_ACTION",
+        "\"returns\"",
+        "COLON",
+        "\"throws\"",
+        "COMMA",
+        "\"exception\"",
+        "\"catch\"",
+        "NOT_OP",
+        "SEMPRED",
+        "TREE_BEGIN",
+        "QUESTION",
+        "STAR",
+        "PLUS",
+        "IMPLIES",
+        "CARET",
+        "WILDCARD",
+        "\"options\"",
+        "WS",
+        "COMMENT",
+        "SL_COMMENT",
+        "ML_COMMENT",
+        "ESC",
+        "DIGIT",
+        "XDIGIT",
+        "VOCAB",
+        "NESTED_ARG_ACTION",
+        "NESTED_ACTION",
+        "WS_LOOP",
+        "INTERNAL_RULE_REF",
+        "WS_OPT",
+        "NOT_USEFUL"
+    };
+
+    private static final long _tokenSet_0_data_[] = { 15317598464L, 0L };
+
+    public static final BitSet _tokenSet_0 = new BitSet(_tokenSet_0_data_);
+
+    private static final long _tokenSet_1_data_[] = { 547893559424L, 0L };
+
+    public static final BitSet _tokenSet_1 = new BitSet(_tokenSet_1_data_);
+
+    private static final long _tokenSet_2_data_[] = { 1156686652375232L, 0L };
+
+    public static final BitSet _tokenSet_2 = new BitSet(_tokenSet_2_data_);
+
+    private static final long _tokenSet_3_data_[] = { 1157838276198592L, 0L };
+
+    public static final BitSet _tokenSet_3 = new BitSet(_tokenSet_3_data_);
+
+    private static final long _tokenSet_4_data_[] = { 1130298373308480L, 0L };
+
+    public static final BitSet _tokenSet_4 = new BitSet(_tokenSet_4_data_);
+
+    private static final long _tokenSet_5_data_[] = { 1720925672784064L, 0L };
+
+    public static final BitSet _tokenSet_5 = new BitSet(_tokenSet_5_data_);
+
+    private static final long _tokenSet_6_data_[] = { 1720788233830592L, 0L };
+
+    public static final BitSet _tokenSet_6 = new BitSet(_tokenSet_6_data_);
+
+    private static final long _tokenSet_7_data_[] = { 1125899924144192L, 0L };
+
+    public static final BitSet _tokenSet_7 = new BitSet(_tokenSet_7_data_);
+
+    private static final long _tokenSet_8_data_[] = { 1720788229619904L, 0L };
+
+    public static final BitSet _tokenSet_8 = new BitSet(_tokenSet_8_data_);
+
+    private static final long _tokenSet_9_data_[] = { 1157803882840256L, 0L };
+
+    public static final BitSet _tokenSet_9 = new BitSet(_tokenSet_9_data_);
 
-public ANTLRParser(TokenStream lexer) {
-  this(lexer,2);
-}
+    private static final long _tokenSet_10_data_[] = { 2250890277404864L, 0L };
 
-public ANTLRParser(ParserSharedInputState state) {
-  super(state,2);
-  tokenNames = _tokenNames;
-}
-
-	public final void grammar() throws RecognitionException, TokenStreamException {
+    public static final BitSet _tokenSet_10 = new BitSet(_tokenSet_10_data_);
 
-		Token  n = null;
-		Token  h = null;
+    private static final long _tokenSet_11_data_[] = { 1719688145404096L, 0L };
 
-		try {      // for error handling
-			{
-			_loop4:
-			do {
-				if ((LA(1)==LITERAL_header)) {
-					match(LITERAL_header);
-					{
-					switch ( LA(1)) {
-					case STRING_LITERAL:
-					{
-						n = LT(1);
-						match(STRING_LITERAL);
-						break;
-					}
-					case ACTION:
-					{
-						break;
-					}
-					default:
-					{
-						throw new NoViableAltException(LT(1), getFilename());
-					}
-					}
-					}
-					h = LT(1);
-					match(ACTION);
-					if ( inputState.guessing==0 ) {
-						behavior.refHeaderAction(n,h);
-					}
-				}
-				else {
-					break _loop4;
-				}
-
-			} while (true);
-			}
-			{
-			switch ( LA(1)) {
-			case OPTIONS:
-			{
-				fileOptionsSpec();
-				break;
-			}
-			case EOF:
-			case ACTION:
-			case DOC_COMMENT:
-			case LITERAL_lexclass:
-			case LITERAL_class:
-			{
-				break;
-			}
-			default:
-			{
-				throw new NoViableAltException(LT(1), getFilename());
-			}
-			}
-			}
-			{
-			_loop7:
-			do {
-				if (((LA(1) >= ACTION && LA(1) <= LITERAL_class))) {
-					classDef();
-				}
-				else {
-					break _loop7;
-				}
-
-			} while (true);
-			}
-			match(Token.EOF_TYPE);
-		}
-		catch (RecognitionException ex) {
-			if (inputState.guessing==0) {
-
-						reportError("rule grammar trapped: "+ex.toString());
-						consumeUntil(EOF);
-
-			} else {
-				throw ex;
-			}
-		}
-	}
-
-	public final void fileOptionsSpec() throws RecognitionException, TokenStreamException {
-
-		Token idTok; Token value;
-
-		match(OPTIONS);
-		{
-		_loop18:
-		do {
-			if ((LA(1)==TOKEN_REF||LA(1)==RULE_REF)) {
-				idTok=id();
-				match(ASSIGN);
-				value=optionValue();
-				if ( inputState.guessing==0 ) {
-					behavior.setFileOption(idTok, value,getInputState().filename);
-				}
-				match(SEMI);
-			}
-			else {
-				break _loop18;
-			}
-
-		} while (true);
-		}
-		match(RCURLY);
-	}
-
-	public final void classDef() throws RecognitionException, TokenStreamException {
-
-		Token  a = null;
-		Token  d = null;
-		String doc=null;
-
-		try {      // for error handling
-			{
-			switch ( LA(1)) {
-			case ACTION:
-			{
-				a = LT(1);
-				match(ACTION);
-				if ( inputState.guessing==0 ) {
-					behavior.refPreambleAction(a);
-				}
-				break;
-			}
-			case DOC_COMMENT:
-			case LITERAL_lexclass:
-			case LITERAL_class:
-			{
-				break;
-			}
-			default:
-			{
-				throw new NoViableAltException(LT(1), getFilename());
-			}
-			}
-			}
-			{
-			switch ( LA(1)) {
-			case DOC_COMMENT:
-			{
-				d = LT(1);
-				match(DOC_COMMENT);
-				if ( inputState.guessing==0 ) {
-					doc=d.getText();
-				}
-				break;
-			}
-			case LITERAL_lexclass:
-			case LITERAL_class:
-			{
-				break;
-			}
-			default:
-			{
-				throw new NoViableAltException(LT(1), getFilename());
-			}
-			}
-			}
-			{
-			boolean synPredMatched13 = false;
-			if (((LA(1)==LITERAL_lexclass||LA(1)==LITERAL_class) && (LA(2)==TOKEN_REF||LA(2)==RULE_REF))) {
-				int _m13 = mark();
-				synPredMatched13 = true;
-				inputState.guessing++;
-				try {
-					{
-					switch ( LA(1)) {
-					case LITERAL_lexclass:
-					{
-						match(LITERAL_lexclass);
-						break;
-					}
-					case LITERAL_class:
-					{
-						match(LITERAL_class);
-						id();
-						match(LITERAL_extends);
-						match(LITERAL_Lexer);
-						break;
-					}
-					default:
-					{
-						throw new NoViableAltException(LT(1), getFilename());
-					}
-					}
-					}
-				}
-				catch (RecognitionException pe) {
-					synPredMatched13 = false;
-				}
-				rewind(_m13);
-				inputState.guessing--;
-			}
-			if ( synPredMatched13 ) {
-				lexerSpec(doc);
-			}
-			else {
-				boolean synPredMatched15 = false;
-				if (((LA(1)==LITERAL_class) && (LA(2)==TOKEN_REF||LA(2)==RULE_REF))) {
-					int _m15 = mark();
-					synPredMatched15 = true;
-					inputState.guessing++;
-					try {
-						{
-						match(LITERAL_class);
-						id();
-						match(LITERAL_extends);
-						match(LITERAL_TreeParser);
-						}
-					}
-					catch (RecognitionException pe) {
-						synPredMatched15 = false;
-					}
-					rewind(_m15);
-					inputState.guessing--;
-				}
-				if ( synPredMatched15 ) {
-					treeParserSpec(doc);
-				}
-				else if ((LA(1)==LITERAL_class) && (LA(2)==TOKEN_REF||LA(2)==RULE_REF)) {
-					parserSpec(doc);
-				}
-				else {
-					throw new NoViableAltException(LT(1), getFilename());
-				}
-				}
-				}
-				rules();
-				if ( inputState.guessing==0 ) {
-					behavior.endGrammar();
-				}
-			}
-			catch (RecognitionException ex) {
-				if (inputState.guessing==0) {
-
-							if ( ex instanceof NoViableAltException ) {
-								NoViableAltException e = (NoViableAltException)ex;
-								if ( e.token.getType()==DOC_COMMENT ) {
-									reportError("line "+ex.line+": JAVADOC comments may only prefix rules and grammars");
-								}
-								else {
-									reportError("rule classDef trapped: "+ex.toString());
-								}
-							}
-							else {
-								reportError("rule classDef trapped: "+ex.toString());
-							}
-							behavior.abortGrammar();
-							boolean consuming = true;
-							// consume everything until the next class definition or EOF
-							while (consuming) {
-								consume();
-								switch(LA(1)) {
-								case LITERAL_class:
-								case LITERAL_lexclass:
-								case EOF:
-									consuming = false;
-									break;
-								}
-							}
-
-				} else {
-					throw ex;
-				}
-			}
-		}
-
-	public final  Token  id() throws RecognitionException, TokenStreamException {
-		 Token idTok ;
-
-		Token  a = null;
-		Token  b = null;
-		idTok = null;
-
-		switch ( LA(1)) {
-		case TOKEN_REF:
-		{
-			a = LT(1);
-			match(TOKEN_REF);
-			if ( inputState.guessing==0 ) {
-				idTok = a;
-			}
-			break;
-		}
-		case RULE_REF:
-		{
-			b = LT(1);
-			match(RULE_REF);
-			if ( inputState.guessing==0 ) {
-				idTok = b;
-			}
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		return idTok ;
-	}
-
-	public final void lexerSpec(
-		String doc
-	) throws RecognitionException, TokenStreamException {
-
-		Token  lc = null;
-		Token  a = null;
-
-			Token idTok;
-			String sup=null;
-
-
-		{
-		switch ( LA(1)) {
-		case LITERAL_lexclass:
-		{
-			lc = LT(1);
-			match(LITERAL_lexclass);
-			idTok=id();
-			if ( inputState.guessing==0 ) {
-				System.out.println("warning: line " + lc.getLine() + ": 'lexclass' is deprecated; use 'class X extends Lexer'");
-			}
-			break;
-		}
-		case LITERAL_class:
-		{
-			match(LITERAL_class);
-			idTok=id();
-			match(LITERAL_extends);
-			match(LITERAL_Lexer);
-			{
-			switch ( LA(1)) {
-			case LPAREN:
-			{
-				sup=superClass();
-				break;
-			}
-			case SEMI:
-			{
-				break;
-			}
-			default:
-			{
-				throw new NoViableAltException(LT(1), getFilename());
-			}
-			}
-			}
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.startLexer(getFilename(), idTok,sup,doc);
-		}
-		match(SEMI);
-		{
-		switch ( LA(1)) {
-		case OPTIONS:
-		{
-			lexerOptionsSpec();
-			break;
-		}
-		case ACTION:
-		case DOC_COMMENT:
-		case TOKENS:
-		case TOKEN_REF:
-		case RULE_REF:
-		case LITERAL_protected:
-		case LITERAL_public:
-		case LITERAL_private:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.endOptions();
-		}
-		{
-		switch ( LA(1)) {
-		case TOKENS:
-		{
-			tokensSpec();
-			break;
-		}
-		case ACTION:
-		case DOC_COMMENT:
-		case TOKEN_REF:
-		case RULE_REF:
-		case LITERAL_protected:
-		case LITERAL_public:
-		case LITERAL_private:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		{
-		switch ( LA(1)) {
-		case ACTION:
-		{
-			a = LT(1);
-			match(ACTION);
-			if ( inputState.guessing==0 ) {
-				behavior.refMemberAction(a);
-			}
-			break;
-		}
-		case DOC_COMMENT:
-		case TOKEN_REF:
-		case RULE_REF:
-		case LITERAL_protected:
-		case LITERAL_public:
-		case LITERAL_private:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-	}
-
-	public final void treeParserSpec(
-		String doc
-	) throws RecognitionException, TokenStreamException {
-
-		Token  a = null;
-
-			Token idTok;
-			String sup=null;
-
-
-		match(LITERAL_class);
-		idTok=id();
-		match(LITERAL_extends);
-		match(LITERAL_TreeParser);
-		{
-		switch ( LA(1)) {
-		case LPAREN:
-		{
-			sup=superClass();
-			break;
-		}
-		case SEMI:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.startTreeWalker(getFilename(), idTok,sup,doc);
-		}
-		match(SEMI);
-		{
-		switch ( LA(1)) {
-		case OPTIONS:
-		{
-			treeParserOptionsSpec();
-			break;
-		}
-		case ACTION:
-		case DOC_COMMENT:
-		case TOKENS:
-		case TOKEN_REF:
-		case RULE_REF:
-		case LITERAL_protected:
-		case LITERAL_public:
-		case LITERAL_private:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.endOptions();
-		}
-		{
-		switch ( LA(1)) {
-		case TOKENS:
-		{
-			tokensSpec();
-			break;
-		}
-		case ACTION:
-		case DOC_COMMENT:
-		case TOKEN_REF:
-		case RULE_REF:
-		case LITERAL_protected:
-		case LITERAL_public:
-		case LITERAL_private:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		{
-		switch ( LA(1)) {
-		case ACTION:
-		{
-			a = LT(1);
-			match(ACTION);
-			if ( inputState.guessing==0 ) {
-				behavior.refMemberAction(a);
-			}
-			break;
-		}
-		case DOC_COMMENT:
-		case TOKEN_REF:
-		case RULE_REF:
-		case LITERAL_protected:
-		case LITERAL_public:
-		case LITERAL_private:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-	}
-
-	public final void parserSpec(
-		String doc
-	) throws RecognitionException, TokenStreamException {
-
-		Token  a = null;
-
-			Token idTok;
-			String sup=null;
-
-
-		match(LITERAL_class);
-		idTok=id();
-		{
-		switch ( LA(1)) {
-		case LITERAL_extends:
-		{
-			match(LITERAL_extends);
-			match(LITERAL_Parser);
-			{
-			switch ( LA(1)) {
-			case LPAREN:
-			{
-				sup=superClass();
-				break;
-			}
-			case SEMI:
-			{
-				break;
-			}
-			default:
-			{
-				throw new NoViableAltException(LT(1), getFilename());
-			}
-			}
-			}
-			break;
-		}
-		case SEMI:
-		{
-			if ( inputState.guessing==0 ) {
-
-							System.out.println("warning: line " +
-								idTok.getLine() + ": use 'class X extends Parser'");
-
-			}
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.startParser(getFilename(), idTok, sup, doc);
-		}
-		match(SEMI);
-		{
-		switch ( LA(1)) {
-		case OPTIONS:
-		{
-			parserOptionsSpec();
-			break;
-		}
-		case ACTION:
-		case DOC_COMMENT:
-		case TOKENS:
-		case TOKEN_REF:
-		case RULE_REF:
-		case LITERAL_protected:
-		case LITERAL_public:
-		case LITERAL_private:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.endOptions();
-		}
-		{
-		switch ( LA(1)) {
-		case TOKENS:
-		{
-			tokensSpec();
-			break;
-		}
-		case ACTION:
-		case DOC_COMMENT:
-		case TOKEN_REF:
-		case RULE_REF:
-		case LITERAL_protected:
-		case LITERAL_public:
-		case LITERAL_private:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		{
-		switch ( LA(1)) {
-		case ACTION:
-		{
-			a = LT(1);
-			match(ACTION);
-			if ( inputState.guessing==0 ) {
-				behavior.refMemberAction(a);
-			}
-			break;
-		}
-		case DOC_COMMENT:
-		case TOKEN_REF:
-		case RULE_REF:
-		case LITERAL_protected:
-		case LITERAL_public:
-		case LITERAL_private:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-	}
-
-	public final void rules() throws RecognitionException, TokenStreamException {
-
-
-		{
-		int _cnt68=0;
-		_loop68:
-		do {
-			if ((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2)))) {
-				rule();
-			}
-			else {
-				if ( _cnt68>=1 ) { break _loop68; } else {throw new NoViableAltException(LT(1), getFilename());}
-			}
-
-			_cnt68++;
-		} while (true);
-		}
-	}
-
-	public final  Token  optionValue() throws RecognitionException, TokenStreamException {
-		 Token retval ;
-
-		Token  sl = null;
-		Token  cl = null;
-		Token  il = null;
-		retval = null;
-
-		switch ( LA(1)) {
-		case TOKEN_REF:
-		case RULE_REF:
-		{
-			retval=qualifiedID();
-			break;
-		}
-		case STRING_LITERAL:
-		{
-			sl = LT(1);
-			match(STRING_LITERAL);
-			if ( inputState.guessing==0 ) {
-				retval = sl;
-			}
-			break;
-		}
-		case CHAR_LITERAL:
-		{
-			cl = LT(1);
-			match(CHAR_LITERAL);
-			if ( inputState.guessing==0 ) {
-				retval = cl;
-			}
-			break;
-		}
-		case INT:
-		{
-			il = LT(1);
-			match(INT);
-			if ( inputState.guessing==0 ) {
-				retval = il;
-			}
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		return retval ;
-	}
-
-	public final void parserOptionsSpec() throws RecognitionException, TokenStreamException {
-
-		Token idTok; Token value;
-
-		match(OPTIONS);
-		{
-		_loop21:
-		do {
-			if ((LA(1)==TOKEN_REF||LA(1)==RULE_REF)) {
-				idTok=id();
-				match(ASSIGN);
-				value=optionValue();
-				if ( inputState.guessing==0 ) {
-					behavior.setGrammarOption(idTok, value);
-				}
-				match(SEMI);
-			}
-			else {
-				break _loop21;
-			}
-
-		} while (true);
-		}
-		match(RCURLY);
-	}
-
-	public final void treeParserOptionsSpec() throws RecognitionException, TokenStreamException {
-
-		Token idTok; Token value;
-
-		match(OPTIONS);
-		{
-		_loop24:
-		do {
-			if ((LA(1)==TOKEN_REF||LA(1)==RULE_REF)) {
-				idTok=id();
-				match(ASSIGN);
-				value=optionValue();
-				if ( inputState.guessing==0 ) {
-					behavior.setGrammarOption(idTok, value);
-				}
-				match(SEMI);
-			}
-			else {
-				break _loop24;
-			}
-
-		} while (true);
-		}
-		match(RCURLY);
-	}
-
-	public final void lexerOptionsSpec() throws RecognitionException, TokenStreamException {
-
-		Token idTok; Token value; BitSet b;
-
-		match(OPTIONS);
-		{
-		_loop27:
-		do {
-			switch ( LA(1)) {
-			case LITERAL_charVocabulary:
-			{
-				match(LITERAL_charVocabulary);
-				match(ASSIGN);
-				b=charSet();
-				match(SEMI);
-				if ( inputState.guessing==0 ) {
-					behavior.setCharVocabulary(b);
-				}
-				break;
-			}
-			case TOKEN_REF:
-			case RULE_REF:
-			{
-				idTok=id();
-				match(ASSIGN);
-				value=optionValue();
-				if ( inputState.guessing==0 ) {
-					behavior.setGrammarOption(idTok, value);
-				}
-				match(SEMI);
-				break;
-			}
-			default:
-			{
-				break _loop27;
-			}
-			}
-		} while (true);
-		}
-		match(RCURLY);
-	}
-
-	public final  BitSet  charSet() throws RecognitionException, TokenStreamException {
-		 BitSet b ;
-
-
-			b = null;
-			BitSet tmpSet = null;
-
-
-		b=setBlockElement();
-		{
-		_loop34:
-		do {
-			if ((LA(1)==OR)) {
-				match(OR);
-				tmpSet=setBlockElement();
-				if ( inputState.guessing==0 ) {
-					b.orInPlace(tmpSet);
-				}
-			}
-			else {
-				break _loop34;
-			}
-
-		} while (true);
-		}
-		return b ;
-	}
-
-	public final void subruleOptionsSpec() throws RecognitionException, TokenStreamException {
-
-		Token idTok; Token value;
-
-		match(OPTIONS);
-		{
-		_loop30:
-		do {
-			if ((LA(1)==TOKEN_REF||LA(1)==RULE_REF)) {
-				idTok=id();
-				match(ASSIGN);
-				value=optionValue();
-				if ( inputState.guessing==0 ) {
-					behavior.setSubruleOption(idTok, value);
-				}
-				match(SEMI);
-			}
-			else {
-				break _loop30;
-			}
-
-		} while (true);
-		}
-		match(RCURLY);
-	}
-
-/** Match a.b.c.d qualified ids; WILDCARD here is overloaded as
- *  id separator; that is, I need a reference to the '.' token.
- */
-	public final Token  qualifiedID() throws RecognitionException, TokenStreamException {
-		Token qidTok=null;
-
-
-			StringBuffer buf = new StringBuffer(30);
-			Token a;
-
-
-		a=id();
-		if ( inputState.guessing==0 ) {
-			buf.append(a.getText());
-		}
-		{
-		_loop144:
-		do {
-			if ((LA(1)==WILDCARD)) {
-				match(WILDCARD);
-				a=id();
-				if ( inputState.guessing==0 ) {
-					buf.append('.'); buf.append(a.getText());
-				}
-			}
-			else {
-				break _loop144;
-			}
-
-		} while (true);
-		}
-		if ( inputState.guessing==0 ) {
-
-					 // can use either TOKEN_REF or RULE_REF; should
-					 // really create a QID or something instead.
-					 qidTok = new CommonToken(TOKEN_REF, buf.toString());
-					 qidTok.setLine(a.getLine());
-
-		}
-		return qidTok;
-	}
-
-	public final  BitSet  setBlockElement() throws RecognitionException, TokenStreamException {
-		 BitSet b ;
-
-		Token  c1 = null;
-		Token  c2 = null;
-
-			b = null;
-			int rangeMin = 0;
-
-
-		c1 = LT(1);
-		match(CHAR_LITERAL);
-		if ( inputState.guessing==0 ) {
-
-					rangeMin = ANTLRLexer.tokenTypeForCharLiteral(c1.getText());
-					b = BitSet.of(rangeMin);
-
-		}
-		{
-		switch ( LA(1)) {
-		case RANGE:
-		{
-			match(RANGE);
-			c2 = LT(1);
-			match(CHAR_LITERAL);
-			if ( inputState.guessing==0 ) {
-
-							int rangeMax = ANTLRLexer.tokenTypeForCharLiteral(c2.getText());
-							if (rangeMax < rangeMin) {
-								tool.error("Malformed range line "+c1.getLine());
-							}
-							for (int i = rangeMin+1; i <= rangeMax; i++) {
-								b.add(i);
-							}
-
-			}
-			break;
-		}
-		case SEMI:
-		case OR:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		return b ;
-	}
-
-	public final void tokensSpec() throws RecognitionException, TokenStreamException {
-
-		Token  t1 = null;
-		Token  s1 = null;
-		Token  s3 = null;
-
-		match(TOKENS);
-		{
-		int _cnt43=0;
-		_loop43:
-		do {
-			if ((LA(1)==STRING_LITERAL||LA(1)==TOKEN_REF)) {
-				{
-				switch ( LA(1)) {
-				case TOKEN_REF:
-				{
-					if ( inputState.guessing==0 ) {
-						s1=null;
-					}
-					t1 = LT(1);
-					match(TOKEN_REF);
-					{
-					switch ( LA(1)) {
-					case ASSIGN:
-					{
-						match(ASSIGN);
-						s1 = LT(1);
-						match(STRING_LITERAL);
-						break;
-					}
-					case SEMI:
-					case OPEN_ELEMENT_OPTION:
-					{
-						break;
-					}
-					default:
-					{
-						throw new NoViableAltException(LT(1), getFilename());
-					}
-					}
-					}
-					if ( inputState.guessing==0 ) {
-						behavior.defineToken(t1, s1);
-					}
-					{
-					switch ( LA(1)) {
-					case OPEN_ELEMENT_OPTION:
-					{
-						tokensSpecOptions(t1);
-						break;
-					}
-					case SEMI:
-					{
-						break;
-					}
-					default:
-					{
-						throw new NoViableAltException(LT(1), getFilename());
-					}
-					}
-					}
-					break;
-				}
-				case STRING_LITERAL:
-				{
-					s3 = LT(1);
-					match(STRING_LITERAL);
-					if ( inputState.guessing==0 ) {
-						behavior.defineToken(null, s3);
-					}
-					{
-					switch ( LA(1)) {
-					case OPEN_ELEMENT_OPTION:
-					{
-						tokensSpecOptions(s3);
-						break;
-					}
-					case SEMI:
-					{
-						break;
-					}
-					default:
-					{
-						throw new NoViableAltException(LT(1), getFilename());
-					}
-					}
-					}
-					break;
-				}
-				default:
-				{
-					throw new NoViableAltException(LT(1), getFilename());
-				}
-				}
-				}
-				match(SEMI);
-			}
-			else {
-				if ( _cnt43>=1 ) { break _loop43; } else {throw new NoViableAltException(LT(1), getFilename());}
-			}
-
-			_cnt43++;
-		} while (true);
-		}
-		match(RCURLY);
-	}
-
-	public final void tokensSpecOptions(
-		Token t
-	) throws RecognitionException, TokenStreamException {
-
-
-			Token o=null, v=null;
-
-
-		match(OPEN_ELEMENT_OPTION);
-		o=id();
-		match(ASSIGN);
-		v=optionValue();
-		if ( inputState.guessing==0 ) {
-			behavior.refTokensSpecElementOption(t,o,v);
-		}
-		{
-		_loop46:
-		do {
-			if ((LA(1)==SEMI)) {
-				match(SEMI);
-				o=id();
-				match(ASSIGN);
-				v=optionValue();
-				if ( inputState.guessing==0 ) {
-					behavior.refTokensSpecElementOption(t,o,v);
-				}
-			}
-			else {
-				break _loop46;
-			}
-
-		} while (true);
-		}
-		match(CLOSE_ELEMENT_OPTION);
-	}
-
-	public final String  superClass() throws RecognitionException, TokenStreamException {
-		String sup;
-
-		sup=null;
-
-		match(LPAREN);
-		if ( inputState.guessing==0 ) {
-			sup = LT(1).getText();
-		}
-		{
-		switch ( LA(1)) {
-		case TOKEN_REF:
-		{
-			match(TOKEN_REF);
-			break;
-		}
-		case RULE_REF:
-		{
-			match(RULE_REF);
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		match(RPAREN);
-		return sup;
-	}
-
-	public final void rule() throws RecognitionException, TokenStreamException {
-
-		Token  d = null;
-		Token  p1 = null;
-		Token  p2 = null;
-		Token  p3 = null;
-		Token  aa = null;
-		Token  rt = null;
-		Token  a = null;
-
-			String access="public";
-			Token idTok;
-			String doc=null;
-			boolean ruleAutoGen = true;
-			blockNesting = -1;	// block increments, so -1 to make rule at level 0
-
-
-		{
-		switch ( LA(1)) {
-		case DOC_COMMENT:
-		{
-			d = LT(1);
-			match(DOC_COMMENT);
-			if ( inputState.guessing==0 ) {
-				doc=d.getText();
-			}
-			break;
-		}
-		case TOKEN_REF:
-		case RULE_REF:
-		case LITERAL_protected:
-		case LITERAL_public:
-		case LITERAL_private:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		{
-		switch ( LA(1)) {
-		case LITERAL_protected:
-		{
-			p1 = LT(1);
-			match(LITERAL_protected);
-			if ( inputState.guessing==0 ) {
-				access=p1.getText();
-			}
-			break;
-		}
-		case LITERAL_public:
-		{
-			p2 = LT(1);
-			match(LITERAL_public);
-			if ( inputState.guessing==0 ) {
-				access=p2.getText();
-			}
-			break;
-		}
-		case LITERAL_private:
-		{
-			p3 = LT(1);
-			match(LITERAL_private);
-			if ( inputState.guessing==0 ) {
-				access=p3.getText();
-			}
-			break;
-		}
-		case TOKEN_REF:
-		case RULE_REF:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		idTok=id();
-		{
-		switch ( LA(1)) {
-		case BANG:
-		{
-			match(BANG);
-			if ( inputState.guessing==0 ) {
-				ruleAutoGen = false;
-			}
-			break;
-		}
-		case ACTION:
-		case OPTIONS:
-		case ARG_ACTION:
-		case LITERAL_returns:
-		case COLON:
-		case LITERAL_throws:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		if ( inputState.guessing==0 ) {
-
-					behavior.defineRuleName(idTok, access, ruleAutoGen, doc);
-
-		}
-		{
-		switch ( LA(1)) {
-		case ARG_ACTION:
-		{
-			aa = LT(1);
-			match(ARG_ACTION);
-			if ( inputState.guessing==0 ) {
-				behavior.refArgAction(aa);
-			}
-			break;
-		}
-		case ACTION:
-		case OPTIONS:
-		case LITERAL_returns:
-		case COLON:
-		case LITERAL_throws:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		{
-		switch ( LA(1)) {
-		case LITERAL_returns:
-		{
-			match(LITERAL_returns);
-			rt = LT(1);
-			match(ARG_ACTION);
-			if ( inputState.guessing==0 ) {
-				behavior.refReturnAction(rt);
-			}
-			break;
-		}
-		case ACTION:
-		case OPTIONS:
-		case COLON:
-		case LITERAL_throws:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		{
-		switch ( LA(1)) {
-		case LITERAL_throws:
-		{
-			throwsSpec();
-			break;
-		}
-		case ACTION:
-		case OPTIONS:
-		case COLON:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		{
-		switch ( LA(1)) {
-		case OPTIONS:
-		{
-			ruleOptionsSpec();
-			break;
-		}
-		case ACTION:
-		case COLON:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		{
-		switch ( LA(1)) {
-		case ACTION:
-		{
-			a = LT(1);
-			match(ACTION);
-			if ( inputState.guessing==0 ) {
-				behavior.refInitAction(a);
-			}
-			break;
-		}
-		case COLON:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		match(COLON);
-		block();
-		match(SEMI);
-		{
-		switch ( LA(1)) {
-		case LITERAL_exception:
-		{
-			exceptionGroup();
-			break;
-		}
-		case EOF:
-		case ACTION:
-		case DOC_COMMENT:
-		case LITERAL_lexclass:
-		case LITERAL_class:
-		case TOKEN_REF:
-		case RULE_REF:
-		case LITERAL_protected:
-		case LITERAL_public:
-		case LITERAL_private:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.endRule(idTok.getText());
-		}
-	}
-
-	public final void throwsSpec() throws RecognitionException, TokenStreamException {
-
-
-			String t=null;
-			Token a,b;
-
-
-		match(LITERAL_throws);
-		a=id();
-		if ( inputState.guessing==0 ) {
-			t=a.getText();
-		}
-		{
-		_loop84:
-		do {
-			if ((LA(1)==COMMA)) {
-				match(COMMA);
-				b=id();
-				if ( inputState.guessing==0 ) {
-					t+=","+b.getText();
-				}
-			}
-			else {
-				break _loop84;
-			}
-
-		} while (true);
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.setUserExceptions(t);
-		}
-	}
-
-	public final void ruleOptionsSpec() throws RecognitionException, TokenStreamException {
-
-		Token idTok; Token value;
-
-		match(OPTIONS);
-		{
-		_loop81:
-		do {
-			if ((LA(1)==TOKEN_REF||LA(1)==RULE_REF)) {
-				idTok=id();
-				match(ASSIGN);
-				value=optionValue();
-				if ( inputState.guessing==0 ) {
-					behavior.setRuleOption(idTok, value);
-				}
-				match(SEMI);
-			}
-			else {
-				break _loop81;
-			}
-
-		} while (true);
-		}
-		match(RCURLY);
-	}
-
-	public final void block() throws RecognitionException, TokenStreamException {
-
-
-		if ( inputState.guessing==0 ) {
-			blockNesting++;
-		}
-		alternative();
-		{
-		_loop87:
-		do {
-			if ((LA(1)==OR)) {
-				match(OR);
-				alternative();
-			}
-			else {
-				break _loop87;
-			}
-
-		} while (true);
-		}
-		if ( inputState.guessing==0 ) {
-			blockNesting--;
-		}
-	}
-
-	public final void exceptionGroup() throws RecognitionException, TokenStreamException {
-
-
-		if ( inputState.guessing==0 ) {
-			behavior.beginExceptionGroup();
-		}
-		{
-		int _cnt95=0;
-		_loop95:
-		do {
-			if ((LA(1)==LITERAL_exception)) {
-				exceptionSpec();
-			}
-			else {
-				if ( _cnt95>=1 ) { break _loop95; } else {throw new NoViableAltException(LT(1), getFilename());}
-			}
-
-			_cnt95++;
-		} while (true);
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.endExceptionGroup();
-		}
-	}
-
-	public final void alternative() throws RecognitionException, TokenStreamException {
-
-		boolean altAutoGen = true;
-
-		{
-		switch ( LA(1)) {
-		case BANG:
-		{
-			match(BANG);
-			if ( inputState.guessing==0 ) {
-				altAutoGen=false;
-			}
-			break;
-		}
-		case STRING_LITERAL:
-		case ACTION:
-		case SEMI:
-		case CHAR_LITERAL:
-		case OR:
-		case TOKEN_REF:
-		case LPAREN:
-		case RULE_REF:
-		case RPAREN:
-		case LITERAL_exception:
-		case NOT_OP:
-		case SEMPRED:
-		case TREE_BEGIN:
-		case WILDCARD:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.beginAlt(altAutoGen);
-		}
-		{
-		_loop91:
-		do {
-			if ((_tokenSet_2.member(LA(1)))) {
-				element();
-			}
-			else {
-				break _loop91;
-			}
-
-		} while (true);
-		}
-		{
-		switch ( LA(1)) {
-		case LITERAL_exception:
-		{
-			exceptionSpecNoLabel();
-			break;
-		}
-		case SEMI:
-		case OR:
-		case RPAREN:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.endAlt();
-		}
-	}
-
-	public final void element() throws RecognitionException, TokenStreamException {
-
-
-		elementNoOptionSpec();
-		{
-		switch ( LA(1)) {
-		case OPEN_ELEMENT_OPTION:
-		{
-			elementOptionSpec();
-			break;
-		}
-		case STRING_LITERAL:
-		case ACTION:
-		case SEMI:
-		case CHAR_LITERAL:
-		case OR:
-		case TOKEN_REF:
-		case LPAREN:
-		case RULE_REF:
-		case RPAREN:
-		case LITERAL_exception:
-		case NOT_OP:
-		case SEMPRED:
-		case TREE_BEGIN:
-		case WILDCARD:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-	}
-
-	public final void exceptionSpecNoLabel() throws RecognitionException, TokenStreamException {
-
-
-		match(LITERAL_exception);
-		if ( inputState.guessing==0 ) {
-			behavior.beginExceptionSpec(null);
-		}
-		{
-		_loop102:
-		do {
-			if ((LA(1)==LITERAL_catch)) {
-				exceptionHandler();
-			}
-			else {
-				break _loop102;
-			}
-
-		} while (true);
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.endExceptionSpec();
-		}
-	}
-
-	public final void exceptionSpec() throws RecognitionException, TokenStreamException {
-
-		Token  aa = null;
-		Token labelAction = null;
-
-		match(LITERAL_exception);
-		{
-		switch ( LA(1)) {
-		case ARG_ACTION:
-		{
-			aa = LT(1);
-			match(ARG_ACTION);
-			if ( inputState.guessing==0 ) {
-				labelAction = aa;
-			}
-			break;
-		}
-		case EOF:
-		case ACTION:
-		case DOC_COMMENT:
-		case LITERAL_lexclass:
-		case LITERAL_class:
-		case TOKEN_REF:
-		case RULE_REF:
-		case LITERAL_protected:
-		case LITERAL_public:
-		case LITERAL_private:
-		case LITERAL_exception:
-		case LITERAL_catch:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.beginExceptionSpec(labelAction);
-		}
-		{
-		_loop99:
-		do {
-			if ((LA(1)==LITERAL_catch)) {
-				exceptionHandler();
-			}
-			else {
-				break _loop99;
-			}
-
-		} while (true);
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.endExceptionSpec();
-		}
-	}
-
-	public final void exceptionHandler() throws RecognitionException, TokenStreamException {
-
-		Token  a1 = null;
-		Token  a2 = null;
-		Token exType; Token exName;
-
-		match(LITERAL_catch);
-		a1 = LT(1);
-		match(ARG_ACTION);
-		a2 = LT(1);
-		match(ACTION);
-		if ( inputState.guessing==0 ) {
-			behavior.refExceptionHandler(a1, a2);
-		}
-	}
-
-	public final void elementNoOptionSpec() throws RecognitionException, TokenStreamException {
-
-		Token  rr = null;
-		Token  aa = null;
-		Token  tr = null;
-		Token  aa2 = null;
-		Token  r2 = null;
-		Token  aa3 = null;
-		Token  a = null;
-		Token  p = null;
-
-			Token label = null;
-			Token assignId = null;
-			Token args = null;
-			int autoGen = GrammarElement.AUTO_GEN_NONE;
-
-
-		switch ( LA(1)) {
-		case ACTION:
-		{
-			a = LT(1);
-			match(ACTION);
-			if ( inputState.guessing==0 ) {
-				behavior.refAction(a);
-			}
-			break;
-		}
-		case SEMPRED:
-		{
-			p = LT(1);
-			match(SEMPRED);
-			if ( inputState.guessing==0 ) {
-				behavior.refSemPred(p);
-			}
-			break;
-		}
-		case TREE_BEGIN:
-		{
-			tree();
-			break;
-		}
-		default:
-			if ((LA(1)==TOKEN_REF||LA(1)==RULE_REF) && (LA(2)==ASSIGN)) {
-				assignId=id();
-				match(ASSIGN);
-				{
-				if ((LA(1)==TOKEN_REF||LA(1)==RULE_REF) && (LA(2)==COLON)) {
-					label=id();
-					match(COLON);
-					if ( inputState.guessing==0 ) {
-						checkForMissingEndRule(label);
-					}
-				}
-				else if ((LA(1)==TOKEN_REF||LA(1)==RULE_REF) && (_tokenSet_3.member(LA(2)))) {
-				}
-				else {
-					throw new NoViableAltException(LT(1), getFilename());
-				}
-
-				}
-				{
-				switch ( LA(1)) {
-				case RULE_REF:
-				{
-					rr = LT(1);
-					match(RULE_REF);
-					{
-					switch ( LA(1)) {
-					case ARG_ACTION:
-					{
-						aa = LT(1);
-						match(ARG_ACTION);
-						if ( inputState.guessing==0 ) {
-							args=aa;
-						}
-						break;
-					}
-					case STRING_LITERAL:
-					case ACTION:
-					case SEMI:
-					case CHAR_LITERAL:
-					case OR:
-					case TOKEN_REF:
-					case OPEN_ELEMENT_OPTION:
-					case LPAREN:
-					case RULE_REF:
-					case RPAREN:
-					case BANG:
-					case LITERAL_exception:
-					case NOT_OP:
-					case SEMPRED:
-					case TREE_BEGIN:
-					case WILDCARD:
-					{
-						break;
-					}
-					default:
-					{
-						throw new NoViableAltException(LT(1), getFilename());
-					}
-					}
-					}
-					{
-					switch ( LA(1)) {
-					case BANG:
-					{
-						match(BANG);
-						if ( inputState.guessing==0 ) {
-							autoGen = GrammarElement.AUTO_GEN_BANG;
-						}
-						break;
-					}
-					case STRING_LITERAL:
-					case ACTION:
-					case SEMI:
-					case CHAR_LITERAL:
-					case OR:
-					case TOKEN_REF:
-					case OPEN_ELEMENT_OPTION:
-					case LPAREN:
-					case RULE_REF:
-					case RPAREN:
-					case LITERAL_exception:
-					case NOT_OP:
-					case SEMPRED:
-					case TREE_BEGIN:
-					case WILDCARD:
-					{
-						break;
-					}
-					default:
-					{
-						throw new NoViableAltException(LT(1), getFilename());
-					}
-					}
-					}
-					if ( inputState.guessing==0 ) {
-						behavior.refRule(assignId, rr, label, args, autoGen);
-					}
-					break;
-				}
-				case TOKEN_REF:
-				{
-					tr = LT(1);
-					match(TOKEN_REF);
-					{
-					switch ( LA(1)) {
-					case ARG_ACTION:
-					{
-						aa2 = LT(1);
-						match(ARG_ACTION);
-						if ( inputState.guessing==0 ) {
-							args=aa2;
-						}
-						break;
-					}
-					case STRING_LITERAL:
-					case ACTION:
-					case SEMI:
-					case CHAR_LITERAL:
-					case OR:
-					case TOKEN_REF:
-					case OPEN_ELEMENT_OPTION:
-					case LPAREN:
-					case RULE_REF:
-					case RPAREN:
-					case LITERAL_exception:
-					case NOT_OP:
-					case SEMPRED:
-					case TREE_BEGIN:
-					case WILDCARD:
-					{
-						break;
-					}
-					default:
-					{
-						throw new NoViableAltException(LT(1), getFilename());
-					}
-					}
-					}
-					if ( inputState.guessing==0 ) {
-						behavior.refToken(assignId, tr, label, args, false, autoGen, lastInRule());
-					}
-					break;
-				}
-				default:
-				{
-					throw new NoViableAltException(LT(1), getFilename());
-				}
-				}
-				}
-			}
-			else if ((_tokenSet_4.member(LA(1))) && (_tokenSet_5.member(LA(2)))) {
-				{
-				if ((LA(1)==TOKEN_REF||LA(1)==RULE_REF) && (LA(2)==COLON)) {
-					label=id();
-					match(COLON);
-					if ( inputState.guessing==0 ) {
-						checkForMissingEndRule(label);
-					}
-				}
-				else if ((_tokenSet_4.member(LA(1))) && (_tokenSet_6.member(LA(2)))) {
-				}
-				else {
-					throw new NoViableAltException(LT(1), getFilename());
-				}
-
-				}
-				{
-				switch ( LA(1)) {
-				case RULE_REF:
-				{
-					r2 = LT(1);
-					match(RULE_REF);
-					{
-					switch ( LA(1)) {
-					case ARG_ACTION:
-					{
-						aa3 = LT(1);
-						match(ARG_ACTION);
-						if ( inputState.guessing==0 ) {
-							args=aa3;
-						}
-						break;
-					}
-					case STRING_LITERAL:
-					case ACTION:
-					case SEMI:
-					case CHAR_LITERAL:
-					case OR:
-					case TOKEN_REF:
-					case OPEN_ELEMENT_OPTION:
-					case LPAREN:
-					case RULE_REF:
-					case RPAREN:
-					case BANG:
-					case LITERAL_exception:
-					case NOT_OP:
-					case SEMPRED:
-					case TREE_BEGIN:
-					case WILDCARD:
-					{
-						break;
-					}
-					default:
-					{
-						throw new NoViableAltException(LT(1), getFilename());
-					}
-					}
-					}
-					{
-					switch ( LA(1)) {
-					case BANG:
-					{
-						match(BANG);
-						if ( inputState.guessing==0 ) {
-							autoGen = GrammarElement.AUTO_GEN_BANG;
-						}
-						break;
-					}
-					case STRING_LITERAL:
-					case ACTION:
-					case SEMI:
-					case CHAR_LITERAL:
-					case OR:
-					case TOKEN_REF:
-					case OPEN_ELEMENT_OPTION:
-					case LPAREN:
-					case RULE_REF:
-					case RPAREN:
-					case LITERAL_exception:
-					case NOT_OP:
-					case SEMPRED:
-					case TREE_BEGIN:
-					case WILDCARD:
-					{
-						break;
-					}
-					default:
-					{
-						throw new NoViableAltException(LT(1), getFilename());
-					}
-					}
-					}
-					if ( inputState.guessing==0 ) {
-						behavior.refRule(assignId, r2, label, args, autoGen);
-					}
-					break;
-				}
-				case NOT_OP:
-				{
-					match(NOT_OP);
-					{
-					switch ( LA(1)) {
-					case CHAR_LITERAL:
-					case TOKEN_REF:
-					{
-						notTerminal(label);
-						break;
-					}
-					case LPAREN:
-					{
-						ebnf(label,true);
-						break;
-					}
-					default:
-					{
-						throw new NoViableAltException(LT(1), getFilename());
-					}
-					}
-					}
-					break;
-				}
-				case LPAREN:
-				{
-					ebnf(label,false);
-					break;
-				}
-				default:
-					if ((LA(1)==STRING_LITERAL||LA(1)==CHAR_LITERAL||LA(1)==TOKEN_REF) && (LA(2)==RANGE)) {
-						range(label);
-					}
-					else if ((_tokenSet_7.member(LA(1))) && (_tokenSet_8.member(LA(2)))) {
-						terminal(label);
-					}
-				else {
-					throw new NoViableAltException(LT(1), getFilename());
-				}
-				}
-				}
-			}
-		else {
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-	}
-
-	public final void elementOptionSpec() throws RecognitionException, TokenStreamException {
-
-
-			Token o=null, v=null;
-
-
-		match(OPEN_ELEMENT_OPTION);
-		o=id();
-		match(ASSIGN);
-		v=optionValue();
-		if ( inputState.guessing==0 ) {
-			behavior.refElementOption(o,v);
-		}
-		{
-		_loop108:
-		do {
-			if ((LA(1)==SEMI)) {
-				match(SEMI);
-				o=id();
-				match(ASSIGN);
-				v=optionValue();
-				if ( inputState.guessing==0 ) {
-					behavior.refElementOption(o,v);
-				}
-			}
-			else {
-				break _loop108;
-			}
-
-		} while (true);
-		}
-		match(CLOSE_ELEMENT_OPTION);
-	}
-
-	public final void range(
-		 Token label
-	) throws RecognitionException, TokenStreamException {
-
-		Token  crLeft = null;
-		Token  crRight = null;
-		Token  t = null;
-		Token  u = null;
-		Token  v = null;
-		Token  w = null;
-
-			Token trLeft=null;
-			Token trRight=null;
-			int autoGen=GrammarElement.AUTO_GEN_NONE;
-
-
-		switch ( LA(1)) {
-		case CHAR_LITERAL:
-		{
-			crLeft = LT(1);
-			match(CHAR_LITERAL);
-			match(RANGE);
-			crRight = LT(1);
-			match(CHAR_LITERAL);
-			{
-			switch ( LA(1)) {
-			case BANG:
-			{
-				match(BANG);
-				if ( inputState.guessing==0 ) {
-					autoGen = GrammarElement.AUTO_GEN_BANG;
-				}
-				break;
-			}
-			case STRING_LITERAL:
-			case ACTION:
-			case SEMI:
-			case CHAR_LITERAL:
-			case OR:
-			case TOKEN_REF:
-			case OPEN_ELEMENT_OPTION:
-			case LPAREN:
-			case RULE_REF:
-			case RPAREN:
-			case LITERAL_exception:
-			case NOT_OP:
-			case SEMPRED:
-			case TREE_BEGIN:
-			case WILDCARD:
-			{
-				break;
-			}
-			default:
-			{
-				throw new NoViableAltException(LT(1), getFilename());
-			}
-			}
-			}
-			if ( inputState.guessing==0 ) {
-				behavior.refCharRange(crLeft, crRight, label, autoGen, lastInRule());
-			}
-			break;
-		}
-		case STRING_LITERAL:
-		case TOKEN_REF:
-		{
-			{
-			switch ( LA(1)) {
-			case TOKEN_REF:
-			{
-				t = LT(1);
-				match(TOKEN_REF);
-				if ( inputState.guessing==0 ) {
-					trLeft=t;
-				}
-				break;
-			}
-			case STRING_LITERAL:
-			{
-				u = LT(1);
-				match(STRING_LITERAL);
-				if ( inputState.guessing==0 ) {
-					trLeft=u;
-				}
-				break;
-			}
-			default:
-			{
-				throw new NoViableAltException(LT(1), getFilename());
-			}
-			}
-			}
-			match(RANGE);
-			{
-			switch ( LA(1)) {
-			case TOKEN_REF:
-			{
-				v = LT(1);
-				match(TOKEN_REF);
-				if ( inputState.guessing==0 ) {
-					trRight=v;
-				}
-				break;
-			}
-			case STRING_LITERAL:
-			{
-				w = LT(1);
-				match(STRING_LITERAL);
-				if ( inputState.guessing==0 ) {
-					trRight=w;
-				}
-				break;
-			}
-			default:
-			{
-				throw new NoViableAltException(LT(1), getFilename());
-			}
-			}
-			}
-			autoGen=ast_type_spec();
-			if ( inputState.guessing==0 ) {
-				behavior.refTokenRange(trLeft, trRight, label, autoGen, lastInRule());
-			}
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-	}
-
-	public final void terminal(
-		 Token label
-	) throws RecognitionException, TokenStreamException {
-
-		Token  cl = null;
-		Token  tr = null;
-		Token  aa = null;
-		Token  sl = null;
-		Token  wi = null;
-
-			int autoGen=GrammarElement.AUTO_GEN_NONE;
-			Token args=null;
-
-
-		switch ( LA(1)) {
-		case CHAR_LITERAL:
-		{
-			cl = LT(1);
-			match(CHAR_LITERAL);
-			{
-			switch ( LA(1)) {
-			case BANG:
-			{
-				match(BANG);
-				if ( inputState.guessing==0 ) {
-					autoGen = GrammarElement.AUTO_GEN_BANG;
-				}
-				break;
-			}
-			case STRING_LITERAL:
-			case ACTION:
-			case SEMI:
-			case CHAR_LITERAL:
-			case OR:
-			case TOKEN_REF:
-			case OPEN_ELEMENT_OPTION:
-			case LPAREN:
-			case RULE_REF:
-			case RPAREN:
-			case LITERAL_exception:
-			case NOT_OP:
-			case SEMPRED:
-			case TREE_BEGIN:
-			case WILDCARD:
-			{
-				break;
-			}
-			default:
-			{
-				throw new NoViableAltException(LT(1), getFilename());
-			}
-			}
-			}
-			if ( inputState.guessing==0 ) {
-				behavior.refCharLiteral(cl, label, false, autoGen, lastInRule());
-			}
-			break;
-		}
-		case TOKEN_REF:
-		{
-			tr = LT(1);
-			match(TOKEN_REF);
-			autoGen=ast_type_spec();
-			{
-			switch ( LA(1)) {
-			case ARG_ACTION:
-			{
-				aa = LT(1);
-				match(ARG_ACTION);
-				if ( inputState.guessing==0 ) {
-					args=aa;
-				}
-				break;
-			}
-			case STRING_LITERAL:
-			case ACTION:
-			case SEMI:
-			case CHAR_LITERAL:
-			case OR:
-			case TOKEN_REF:
-			case OPEN_ELEMENT_OPTION:
-			case LPAREN:
-			case RULE_REF:
-			case RPAREN:
-			case LITERAL_exception:
-			case NOT_OP:
-			case SEMPRED:
-			case TREE_BEGIN:
-			case WILDCARD:
-			{
-				break;
-			}
-			default:
-			{
-				throw new NoViableAltException(LT(1), getFilename());
-			}
-			}
-			}
-			if ( inputState.guessing==0 ) {
-				behavior.refToken(null, tr, label, args, false, autoGen, lastInRule());
-			}
-			break;
-		}
-		case STRING_LITERAL:
-		{
-			sl = LT(1);
-			match(STRING_LITERAL);
-			autoGen=ast_type_spec();
-			if ( inputState.guessing==0 ) {
-				behavior.refStringLiteral(sl, label, autoGen, lastInRule());
-			}
-			break;
-		}
-		case WILDCARD:
-		{
-			wi = LT(1);
-			match(WILDCARD);
-			autoGen=ast_type_spec();
-			if ( inputState.guessing==0 ) {
-				behavior.refWildcard(wi, label, autoGen);
-			}
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-	}
-
-	public final void notTerminal(
-		 Token label
-	) throws RecognitionException, TokenStreamException {
-
-		Token  cl = null;
-		Token  tr = null;
-		int autoGen=GrammarElement.AUTO_GEN_NONE;
-
-		switch ( LA(1)) {
-		case CHAR_LITERAL:
-		{
-			cl = LT(1);
-			match(CHAR_LITERAL);
-			{
-			switch ( LA(1)) {
-			case BANG:
-			{
-				match(BANG);
-				if ( inputState.guessing==0 ) {
-					autoGen = GrammarElement.AUTO_GEN_BANG;
-				}
-				break;
-			}
-			case STRING_LITERAL:
-			case ACTION:
-			case SEMI:
-			case CHAR_LITERAL:
-			case OR:
-			case TOKEN_REF:
-			case OPEN_ELEMENT_OPTION:
-			case LPAREN:
-			case RULE_REF:
-			case RPAREN:
-			case LITERAL_exception:
-			case NOT_OP:
-			case SEMPRED:
-			case TREE_BEGIN:
-			case WILDCARD:
-			{
-				break;
-			}
-			default:
-			{
-				throw new NoViableAltException(LT(1), getFilename());
-			}
-			}
-			}
-			if ( inputState.guessing==0 ) {
-				behavior.refCharLiteral(cl, label, true, autoGen, lastInRule());
-			}
-			break;
-		}
-		case TOKEN_REF:
-		{
-			tr = LT(1);
-			match(TOKEN_REF);
-			autoGen=ast_type_spec();
-			if ( inputState.guessing==0 ) {
-				behavior.refToken(null, tr, label, null, true, autoGen, lastInRule());
-			}
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-	}
-
-	public final void ebnf(
-		 Token label, boolean not
-	) throws RecognitionException, TokenStreamException {
-
-		Token  lp = null;
-		Token  aa = null;
-		Token  ab = null;
-
-		lp = LT(1);
-		match(LPAREN);
-		if ( inputState.guessing==0 ) {
-			behavior.beginSubRule(label, lp.getLine(), not);
-		}
-		{
-		if ((LA(1)==OPTIONS)) {
-			subruleOptionsSpec();
-			{
-			switch ( LA(1)) {
-			case ACTION:
-			{
-				aa = LT(1);
-				match(ACTION);
-				if ( inputState.guessing==0 ) {
-					behavior.refInitAction(aa);
-				}
-				break;
-			}
-			case COLON:
-			{
-				break;
-			}
-			default:
-			{
-				throw new NoViableAltException(LT(1), getFilename());
-			}
-			}
-			}
-			match(COLON);
-		}
-		else if ((LA(1)==ACTION) && (LA(2)==COLON)) {
-			ab = LT(1);
-			match(ACTION);
-			if ( inputState.guessing==0 ) {
-				behavior.refInitAction(ab);
-			}
-			match(COLON);
-		}
-		else if ((_tokenSet_9.member(LA(1))) && (_tokenSet_10.member(LA(2)))) {
-		}
-		else {
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-
-		}
-		block();
-		match(RPAREN);
-		{
-		switch ( LA(1)) {
-		case STRING_LITERAL:
-		case ACTION:
-		case SEMI:
-		case CHAR_LITERAL:
-		case OR:
-		case TOKEN_REF:
-		case OPEN_ELEMENT_OPTION:
-		case LPAREN:
-		case RULE_REF:
-		case RPAREN:
-		case BANG:
-		case LITERAL_exception:
-		case NOT_OP:
-		case SEMPRED:
-		case TREE_BEGIN:
-		case QUESTION:
-		case STAR:
-		case PLUS:
-		case WILDCARD:
-		{
-			{
-			switch ( LA(1)) {
-			case QUESTION:
-			{
-				match(QUESTION);
-				if ( inputState.guessing==0 ) {
-					behavior.optionalSubRule();
-				}
-				break;
-			}
-			case STAR:
-			{
-				match(STAR);
-				if ( inputState.guessing==0 ) {
-					behavior.zeroOrMoreSubRule();;
-				}
-				break;
-			}
-			case PLUS:
-			{
-				match(PLUS);
-				if ( inputState.guessing==0 ) {
-					behavior.oneOrMoreSubRule();
-				}
-				break;
-			}
-			case STRING_LITERAL:
-			case ACTION:
-			case SEMI:
-			case CHAR_LITERAL:
-			case OR:
-			case TOKEN_REF:
-			case OPEN_ELEMENT_OPTION:
-			case LPAREN:
-			case RULE_REF:
-			case RPAREN:
-			case BANG:
-			case LITERAL_exception:
-			case NOT_OP:
-			case SEMPRED:
-			case TREE_BEGIN:
-			case WILDCARD:
-			{
-				break;
-			}
-			default:
-			{
-				throw new NoViableAltException(LT(1), getFilename());
-			}
-			}
-			}
-			{
-			switch ( LA(1)) {
-			case BANG:
-			{
-				match(BANG);
-				if ( inputState.guessing==0 ) {
-					behavior.noASTSubRule();
-				}
-				break;
-			}
-			case STRING_LITERAL:
-			case ACTION:
-			case SEMI:
-			case CHAR_LITERAL:
-			case OR:
-			case TOKEN_REF:
-			case OPEN_ELEMENT_OPTION:
-			case LPAREN:
-			case RULE_REF:
-			case RPAREN:
-			case LITERAL_exception:
-			case NOT_OP:
-			case SEMPRED:
-			case TREE_BEGIN:
-			case WILDCARD:
-			{
-				break;
-			}
-			default:
-			{
-				throw new NoViableAltException(LT(1), getFilename());
-			}
-			}
-			}
-			break;
-		}
-		case IMPLIES:
-		{
-			match(IMPLIES);
-			if ( inputState.guessing==0 ) {
-				behavior.synPred();
-			}
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.endSubRule();
-		}
-	}
-
-	public final void tree() throws RecognitionException, TokenStreamException {
-
-		Token  lp = null;
-
-		lp = LT(1);
-		match(TREE_BEGIN);
-		if ( inputState.guessing==0 ) {
-			behavior.beginTree(lp.getLine());
-		}
-		rootNode();
-		if ( inputState.guessing==0 ) {
-			behavior.beginChildList();
-		}
-		{
-		int _cnt122=0;
-		_loop122:
-		do {
-			if ((_tokenSet_2.member(LA(1)))) {
-				element();
-			}
-			else {
-				if ( _cnt122>=1 ) { break _loop122; } else {throw new NoViableAltException(LT(1), getFilename());}
-			}
-
-			_cnt122++;
-		} while (true);
-		}
-		if ( inputState.guessing==0 ) {
-			behavior.endChildList();
-		}
-		match(RPAREN);
-		if ( inputState.guessing==0 ) {
-			behavior.endTree();
-		}
-	}
-
-	public final void rootNode() throws RecognitionException, TokenStreamException {
-
-		Token label = null;
-
-		{
-		if ((LA(1)==TOKEN_REF||LA(1)==RULE_REF) && (LA(2)==COLON)) {
-			label=id();
-			match(COLON);
-			if ( inputState.guessing==0 ) {
-				checkForMissingEndRule(label);
-			}
-		}
-		else if ((_tokenSet_7.member(LA(1))) && (_tokenSet_11.member(LA(2)))) {
-		}
-		else {
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-
-		}
-		terminal(label);
-	}
-
-	public final  int  ast_type_spec() throws RecognitionException, TokenStreamException {
-		 int autoGen ;
-
-		autoGen = GrammarElement.AUTO_GEN_NONE;
-
-		{
-		switch ( LA(1)) {
-		case CARET:
-		{
-			match(CARET);
-			if ( inputState.guessing==0 ) {
-				autoGen = GrammarElement.AUTO_GEN_CARET;
-			}
-			break;
-		}
-		case BANG:
-		{
-			match(BANG);
-			if ( inputState.guessing==0 ) {
-				autoGen = GrammarElement.AUTO_GEN_BANG;
-			}
-			break;
-		}
-		case STRING_LITERAL:
-		case ACTION:
-		case SEMI:
-		case CHAR_LITERAL:
-		case OR:
-		case TOKEN_REF:
-		case OPEN_ELEMENT_OPTION:
-		case LPAREN:
-		case RULE_REF:
-		case RPAREN:
-		case ARG_ACTION:
-		case LITERAL_exception:
-		case NOT_OP:
-		case SEMPRED:
-		case TREE_BEGIN:
-		case WILDCARD:
-		{
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltException(LT(1), getFilename());
-		}
-		}
-		}
-		return autoGen ;
-	}
-
-
-	public static final String[] _tokenNames = {
-		"<0>",
-		"EOF",
-		"<2>",
-		"NULL_TREE_LOOKAHEAD",
-		"\"tokens\"",
-		"\"header\"",
-		"STRING_LITERAL",
-		"ACTION",
-		"DOC_COMMENT",
-		"\"lexclass\"",
-		"\"class\"",
-		"\"extends\"",
-		"\"Lexer\"",
-		"\"TreeParser\"",
-		"OPTIONS",
-		"ASSIGN",
-		"SEMI",
-		"RCURLY",
-		"\"charVocabulary\"",
-		"CHAR_LITERAL",
-		"INT",
-		"OR",
-		"RANGE",
-		"TOKENS",
-		"TOKEN_REF",
-		"OPEN_ELEMENT_OPTION",
-		"CLOSE_ELEMENT_OPTION",
-		"LPAREN",
-		"RULE_REF",
-		"RPAREN",
-		"\"Parser\"",
-		"\"protected\"",
-		"\"public\"",
-		"\"private\"",
-		"BANG",
-		"ARG_ACTION",
-		"\"returns\"",
-		"COLON",
-		"\"throws\"",
-		"COMMA",
-		"\"exception\"",
-		"\"catch\"",
-		"NOT_OP",
-		"SEMPRED",
-		"TREE_BEGIN",
-		"QUESTION",
-		"STAR",
-		"PLUS",
-		"IMPLIES",
-		"CARET",
-		"WILDCARD",
-		"\"options\"",
-		"WS",
-		"COMMENT",
-		"SL_COMMENT",
-		"ML_COMMENT",
-		"ESC",
-		"DIGIT",
-		"XDIGIT",
-		"VOCAB",
-		"NESTED_ARG_ACTION",
-		"NESTED_ACTION",
-		"WS_LOOP",
-		"INTERNAL_RULE_REF",
-		"WS_OPT",
-		"NOT_USEFUL"
-	};
-
-	private static final long _tokenSet_0_data_[] = { 15317598464L, 0L };
-	public static final BitSet _tokenSet_0 = new BitSet(_tokenSet_0_data_);
-	private static final long _tokenSet_1_data_[] = { 547893559424L, 0L };
-	public static final BitSet _tokenSet_1 = new BitSet(_tokenSet_1_data_);
-	private static final long _tokenSet_2_data_[] = { 1156686652375232L, 0L };
-	public static final BitSet _tokenSet_2 = new BitSet(_tokenSet_2_data_);
-	private static final long _tokenSet_3_data_[] = { 1157838276198592L, 0L };
-	public static final BitSet _tokenSet_3 = new BitSet(_tokenSet_3_data_);
-	private static final long _tokenSet_4_data_[] = { 1130298373308480L, 0L };
-	public static final BitSet _tokenSet_4 = new BitSet(_tokenSet_4_data_);
-	private static final long _tokenSet_5_data_[] = { 1720925672784064L, 0L };
-	public static final BitSet _tokenSet_5 = new BitSet(_tokenSet_5_data_);
-	private static final long _tokenSet_6_data_[] = { 1720788233830592L, 0L };
-	public static final BitSet _tokenSet_6 = new BitSet(_tokenSet_6_data_);
-	private static final long _tokenSet_7_data_[] = { 1125899924144192L, 0L };
-	public static final BitSet _tokenSet_7 = new BitSet(_tokenSet_7_data_);
-	private static final long _tokenSet_8_data_[] = { 1720788229619904L, 0L };
-	public static final BitSet _tokenSet_8 = new BitSet(_tokenSet_8_data_);
-	private static final long _tokenSet_9_data_[] = { 1157803882840256L, 0L };
-	public static final BitSet _tokenSet_9 = new BitSet(_tokenSet_9_data_);
-	private static final long _tokenSet_10_data_[] = { 2250890277404864L, 0L };
-	public static final BitSet _tokenSet_10 = new BitSet(_tokenSet_10_data_);
-	private static final long _tokenSet_11_data_[] = { 1719688145404096L, 0L };
-	public static final BitSet _tokenSet_11 = new BitSet(_tokenSet_11_data_);
+    public static final BitSet _tokenSet_11 = new BitSet(_tokenSet_11_data_);
 
-	}
+}



1.4       +54 -35    e/src/jsrc/antlr/ANTLRStringBuffer.java

Index: ANTLRStringBuffer.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ANTLRStringBuffer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ANTLRStringBuffer.java	2001/10/26 03:08:50	1.3
+++ ANTLRStringBuffer.java	2001/12/02 06:01:28	1.4
@@ -4,56 +4,75 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: ANTLRStringBuffer.java,v 1.3 2001/10/26 03:08:50 markm Exp $
+ * $Id: ANTLRStringBuffer.java,v 1.4 2001/12/02 06:01:28 markm Exp $
  */
 
 // Implementation of a StringBuffer-like object that does not have the
 // unfortunate side-effect of creating Strings with very large buffers.
 
 public class ANTLRStringBuffer {
+
     protected char[] buffer = new char[8];
+
     protected int length = 0;		// length and also where to store next char
 
+
+    public ANTLRStringBuffer() {
+    }
 
-    public ANTLRStringBuffer() {}
     public final void append(char c) {
-	// This would normally be  an "ensureCapacity" method, but inlined
-	// here for speed.
-	if (length >= buffer.length) {
-	    // Compute a new length that is at least double old length
-	    int newSize = buffer.length;
-	    while (length >= newSize) {
-		newSize *= 2;
-	    }
-	    // Allocate new array and copy buffer
-	    char[] newBuffer = new char[newSize];
-	    for (int i = 0; i < length; i++) {
-		newBuffer[i] = buffer[i];
-	    }
-	    buffer = newBuffer;
-	}
-	buffer[length] = c;
-	length++;
+        // This would normally be  an "ensureCapacity" method, but inlined
+        // here for speed.
+        if (length >= buffer.length) {
+            // Compute a new length that is at least double old length
+            int newSize = buffer.length;
+            while (length >= newSize) {
+                newSize *= 2;
+            }
+            // Allocate new array and copy buffer
+            char[] newBuffer = new char[newSize];
+            for (int i = 0; i < length; i++) {
+                newBuffer[i] = buffer[i];
+            }
+            buffer = newBuffer;
+        }
+        buffer[length] = c;
+        length++;
     }
+
     public final void append(String s) {
-	for (int i = 0; i < s.length(); i++) {
-	    append(s.charAt(i));
-	}
-    }
-    public final char charAt(int index) { return buffer[index]; }
-    final public char[] getBuffer() { return buffer; }
-    public final int length() { return length; }
-    public final void setCharAt(int index, char  ch) { buffer[index] = ch; }
+        for (int i = 0; i < s.length(); i++) {
+            append(s.charAt(i));
+        }
+    }
+
+    public final char charAt(int index) {
+        return buffer[index];
+    }
+
+    final public char[] getBuffer() {
+        return buffer;
+    }
+
+    public final int length() {
+        return length;
+    }
+
+    public final void setCharAt(int index, char ch) {
+        buffer[index] = ch;
+    }
+
     public final void setLength(int newLength) {
-	if (newLength < length) {
-	    length = newLength;
-	} else {
-	    while (newLength > length) {
-		append('\0');
-	    }
-	}
+        if (newLength < length) {
+            length = newLength;
+        } else {
+            while (newLength > length) {
+                append('\0');
+            }
+        }
     }
+
     public final String toString() {
-	return new String(buffer, 0, length);
+        return new String(buffer, 0, length);
     }
 }



1.5       +1058 -685 e/src/jsrc/antlr/ANTLRTokdefLexer.java

Index: ANTLRTokdefLexer.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ANTLRTokdefLexer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ANTLRTokdefLexer.java	2001/11/29 20:33:25	1.4
+++ ANTLRTokdefLexer.java	2001/12/02 06:01:28	1.5
@@ -6,696 +6,1069 @@
  * Terence Parr, MageLang Institute
  * ANTLR Version 2.7.0a2; 1989-1999
  */
+
 import antlr.collections.impl.BitSet;
 
 import java.io.InputStream;
 import java.io.Reader;
 import java.util.Hashtable;
-public class ANTLRTokdefLexer extends antlr.CharScanner implements ANTLRTokdefParserTokenTypes, TokenStream
- {
-	private static final long _tokenSet_0_data_[] = { -9224L, 9223372036854775807L, 0L, 0L };
-	public static final BitSet _tokenSet_0 = new BitSet(_tokenSet_0_data_);
-	private static final long _tokenSet_1_data_[] = { -140737488355336L, 9223372036854775807L, 0L, 0L };
-	public static final BitSet _tokenSet_1 = new BitSet(_tokenSet_1_data_);
-
-
-public ANTLRTokdefLexer(InputBuffer ib) {
-	this(new LexerSharedInputState(ib));
-}
-public ANTLRTokdefLexer(LexerSharedInputState state) {
-	super(state);
-	literals = new Hashtable();
-caseSensitiveLiterals = true;
-setCaseSensitive(true);
-}
-public ANTLRTokdefLexer(InputStream in) {
-	this(new ByteBuffer(in));
-}
-public ANTLRTokdefLexer(Reader in) {
-	this(new CharBuffer(in));
-}
-	public final void mASSIGN(boolean _createToken) throws RecognitionException, CharStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = ASSIGN;
-		int _saveIndex;
-
-		match('=');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-	protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = DIGIT;
-		int _saveIndex;
-
-		matchRange('0','9');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-	protected final void mESC(boolean _createToken) throws RecognitionException, CharStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = ESC;
-		int _saveIndex;
-
-		match('\\');
-		{
-		switch ( LA(1)) {
-		case 'n':
-		{
-			match('n');
-			break;
-		}
-		case 'r':
-		{
-			match('r');
-			break;
-		}
-		case 't':
-		{
-			match('t');
-			break;
-		}
-		case 'b':
-		{
-			match('b');
-			break;
-		}
-		case 'f':
-		{
-			match('f');
-			break;
-		}
-		case '"':
-		{
-			match('"');
-			break;
-		}
-		case '\'':
-		{
-			match('\'');
-			break;
-		}
-		case '\\':
-		{
-			match('\\');
-			break;
-		}
-		case '0':  case '1':  case '2':  case '3':
-		{
-			{
-			matchRange('0','3');
-			}
-			{
-			if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\3' && LA(2) <= '~'))) {
-				mDIGIT(false);
-				{
-				if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\3' && LA(2) <= '~'))) {
-					mDIGIT(false);
-				}
-				else if (((LA(1) >= '\3' && LA(1) <= '~')) && (true)) {
-				}
-				else {
-					throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-				}
-
-				}
-			}
-			else if (((LA(1) >= '\3' && LA(1) <= '~')) && (true)) {
-			}
-			else {
-				throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-			}
-
-			}
-			break;
-		}
-		case '4':  case '5':  case '6':  case '7':
-		{
-			{
-			matchRange('4','7');
-			}
-			{
-			if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\3' && LA(2) <= '~'))) {
-				mDIGIT(false);
-			}
-			else if (((LA(1) >= '\3' && LA(1) <= '~')) && (true)) {
-			}
-			else {
-				throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-			}
-
-			}
-			break;
-		}
-		case 'u':
-		{
-			match('u');
-			mXDIGIT(false);
-			mXDIGIT(false);
-			mXDIGIT(false);
-			mXDIGIT(false);
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-		}
-		}
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-	public final void mID(boolean _createToken) throws RecognitionException, CharStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = ID;
-		int _saveIndex;
-
-		{
-		switch ( LA(1)) {
-		case 'a':  case 'b':  case 'c':  case 'd':
-		case 'e':  case 'f':  case 'g':  case 'h':
-		case 'i':  case 'j':  case 'k':  case 'l':
-		case 'm':  case 'n':  case 'o':  case 'p':
-		case 'q':  case 'r':  case 's':  case 't':
-		case 'u':  case 'v':  case 'w':  case 'x':
-		case 'y':  case 'z':
-		{
-			matchRange('a','z');
-			break;
-		}
-		case 'A':  case 'B':  case 'C':  case 'D':
-		case 'E':  case 'F':  case 'G':  case 'H':
-		case 'I':  case 'J':  case 'K':  case 'L':
-		case 'M':  case 'N':  case 'O':  case 'P':
-		case 'Q':  case 'R':  case 'S':  case 'T':
-		case 'U':  case 'V':  case 'W':  case 'X':
-		case 'Y':  case 'Z':
-		{
-			matchRange('A','Z');
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-		}
-		}
-		}
-		{
-		_loop37:
-		do {
-			switch ( LA(1)) {
-			case 'a':  case 'b':  case 'c':  case 'd':
-			case 'e':  case 'f':  case 'g':  case 'h':
-			case 'i':  case 'j':  case 'k':  case 'l':
-			case 'm':  case 'n':  case 'o':  case 'p':
-			case 'q':  case 'r':  case 's':  case 't':
-			case 'u':  case 'v':  case 'w':  case 'x':
-			case 'y':  case 'z':
-			{
-				matchRange('a','z');
-				break;
-			}
-			case 'A':  case 'B':  case 'C':  case 'D':
-			case 'E':  case 'F':  case 'G':  case 'H':
-			case 'I':  case 'J':  case 'K':  case 'L':
-			case 'M':  case 'N':  case 'O':  case 'P':
-			case 'Q':  case 'R':  case 'S':  case 'T':
-			case 'U':  case 'V':  case 'W':  case 'X':
-			case 'Y':  case 'Z':
-			{
-				matchRange('A','Z');
-				break;
-			}
-			case '_':
-			{
-				match('_');
-				break;
-			}
-			case '0':  case '1':  case '2':  case '3':
-			case '4':  case '5':  case '6':  case '7':
-			case '8':  case '9':
-			{
-				matchRange('0','9');
-				break;
-			}
-			default:
-			{
-				break _loop37;
-			}
-			}
-		} while (true);
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-	public final void mINT(boolean _createToken) throws RecognitionException, CharStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = INT;
-		int _saveIndex;
-
-		{
-		int _cnt40=0;
-		_loop40:
-		do {
-			if (((LA(1) >= '0' && LA(1) <= '9'))) {
-				mDIGIT(false);
-			}
-			else {
-				if ( _cnt40>=1 ) { break _loop40; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());}
-			}
-
-			_cnt40++;
-		} while (true);
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-	public final void mLPAREN(boolean _createToken) throws RecognitionException, CharStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = LPAREN;
-		int _saveIndex;
-
-		match('(');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-	public final void mML_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = ML_COMMENT;
-		int _saveIndex;
-
-		match("/*");
-		{
-		_loop17:
-		do {
-			switch ( LA(1)) {
-			case '\n':
-			{
-				match('\n');
-				newline();
-				break;
-			}
-			case '\3':  case '\4':  case '\5':  case '\6':
-			case '\7':  case '\10':  case '\t':  case '\13':
-			case '\14':  case '\r':  case '\16':  case '\17':
-			case '\20':  case '\21':  case '\22':  case '\23':
-			case '\24':  case '\25':  case '\26':  case '\27':
-			case '\30':  case '\31':  case '\32':  case '\33':
-			case '\34':  case '\35':  case '\36':  case '\37':
-			case ' ':  case '!':  case '"':  case '#':
-			case '$':  case '%':  case '&':  case '\'':
-			case '(':  case ')':  case '+':  case ',':
-			case '-':  case '.':  case '/':  case '0':
-			case '1':  case '2':  case '3':  case '4':
-			case '5':  case '6':  case '7':  case '8':
-			case '9':  case ':':  case ';':  case '<':
-			case '=':  case '>':  case '?':  case '@':
-			case 'A':  case 'B':  case 'C':  case 'D':
-			case 'E':  case 'F':  case 'G':  case 'H':
-			case 'I':  case 'J':  case 'K':  case 'L':
-			case 'M':  case 'N':  case 'O':  case 'P':
-			case 'Q':  case 'R':  case 'S':  case 'T':
-			case 'U':  case 'V':  case 'W':  case 'X':
-			case 'Y':  case 'Z':  case '[':  case '\\':
-			case ']':  case '^':  case '_':  case '`':
-			case 'a':  case 'b':  case 'c':  case 'd':
-			case 'e':  case 'f':  case 'g':  case 'h':
-			case 'i':  case 'j':  case 'k':  case 'l':
-			case 'm':  case 'n':  case 'o':  case 'p':
-			case 'q':  case 'r':  case 's':  case 't':
-			case 'u':  case 'v':  case 'w':  case 'x':
-			case 'y':  case 'z':  case '{':  case '|':
-			case '}':  case '~':
-			{
-				matchNot('*');
-				break;
-			}
-			default:
-				if ((LA(1)=='*') && (_tokenSet_1.member(LA(2)))) {
-					match('*');
-					matchNot('/');
-				}
-			else {
-				break _loop17;
-			}
-			}
-		} while (true);
-		}
-		match("*/");
-		_ttype = Token.SKIP;
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-	public final void mRPAREN(boolean _createToken) throws RecognitionException, CharStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = RPAREN;
-		int _saveIndex;
-
-		match(')');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-	public final void mSL_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = SL_COMMENT;
-		int _saveIndex;
-
-		match("//");
-		{
-		_loop12:
-		do {
-			if ((_tokenSet_0.member(LA(1)))) {
-				{
-				match(_tokenSet_0);
-				}
-			}
-			else {
-				break _loop12;
-			}
-
-		} while (true);
-		}
-		{
-		switch ( LA(1)) {
-		case '\n':
-		{
-			match('\n');
-			break;
-		}
-		case '\r':
-		{
-			match('\r');
-			{
-			if ((LA(1)=='\n')) {
-				match('\n');
-			}
-			else {
-			}
-
-			}
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-		}
-		}
-		}
-		_ttype = Token.SKIP; newline();
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-	public final void mSTRING(boolean _createToken) throws RecognitionException, CharStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = STRING;
-		int _saveIndex;
-
-		match('"');
-		{
-		_loop23:
-		do {
-			switch ( LA(1)) {
-			case '\\':
-			{
-				mESC(false);
-				break;
-			}
-			case '\3':  case '\4':  case '\5':  case '\6':
-			case '\7':  case '\10':  case '\t':  case '\n':
-			case '\13':  case '\14':  case '\r':  case '\16':
-			case '\17':  case '\20':  case '\21':  case '\22':
-			case '\23':  case '\24':  case '\25':  case '\26':
-			case '\27':  case '\30':  case '\31':  case '\32':
-			case '\33':  case '\34':  case '\35':  case '\36':
-			case '\37':  case ' ':  case '!':  case '#':
-			case '$':  case '%':  case '&':  case '\'':
-			case '(':  case ')':  case '*':  case '+':
-			case ',':  case '-':  case '.':  case '/':
-			case '0':  case '1':  case '2':  case '3':
-			case '4':  case '5':  case '6':  case '7':
-			case '8':  case '9':  case ':':  case ';':
-			case '<':  case '=':  case '>':  case '?':
-			case '@':  case 'A':  case 'B':  case 'C':
-			case 'D':  case 'E':  case 'F':  case 'G':
-			case 'H':  case 'I':  case 'J':  case 'K':
-			case 'L':  case 'M':  case 'N':  case 'O':
-			case 'P':  case 'Q':  case 'R':  case 'S':
-			case 'T':  case 'U':  case 'V':  case 'W':
-			case 'X':  case 'Y':  case 'Z':  case '[':
-			case ']':  case '^':  case '_':  case '`':
-			case 'a':  case 'b':  case 'c':  case 'd':
-			case 'e':  case 'f':  case 'g':  case 'h':
-			case 'i':  case 'j':  case 'k':  case 'l':
-			case 'm':  case 'n':  case 'o':  case 'p':
-			case 'q':  case 'r':  case 's':  case 't':
-			case 'u':  case 'v':  case 'w':  case 'x':
-			case 'y':  case 'z':  case '{':  case '|':
-			case '}':  case '~':
-			{
-				matchNot('"');
-				break;
-			}
-			default:
-			{
-				break _loop23;
-			}
-			}
-		} while (true);
-		}
-		match('"');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-	protected final void mVOCAB(boolean _createToken) throws RecognitionException, CharStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = VOCAB;
-		int _saveIndex;
-
-		matchRange('\3','\176');
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-	public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = WS;
-		int _saveIndex;
-
-		{
-		switch ( LA(1)) {
-		case ' ':
-		{
-			match(' ');
-			break;
-		}
-		case '\t':
-		{
-			match('\t');
-			break;
-		}
-		case '\r':
-		{
-			match('\r');
-			{
-			if ((LA(1)=='\n')) {
-				match('\n');
-			}
-			else {
-			}
-
-			}
-			newline();
-			break;
-		}
-		case '\n':
-		{
-			match('\n');
-			newline();
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-		}
-		}
-		}
-		_ttype = Token.SKIP;
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-	protected final void mXDIGIT(boolean _createToken) throws RecognitionException, CharStreamException {
-		int _ttype; Token _token=null; int _begin=text.length();
-		_ttype = XDIGIT;
-		int _saveIndex;
-
-		switch ( LA(1)) {
-		case '0':  case '1':  case '2':  case '3':
-		case '4':  case '5':  case '6':  case '7':
-		case '8':  case '9':
-		{
-			matchRange('0','9');
-			break;
-		}
-		case 'a':  case 'b':  case 'c':  case 'd':
-		case 'e':  case 'f':
-		{
-			matchRange('a','f');
-			break;
-		}
-		case 'A':  case 'B':  case 'C':  case 'D':
-		case 'E':  case 'F':
-		{
-			matchRange('A','F');
-			break;
-		}
-		default:
-		{
-			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
-		}
-		}
-		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
-			_token = makeToken(_ttype);
-			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
-		}
-		_returnToken = _token;
-	}
-public Token nextToken() throws TokenStreamException {
-	Token _rettoken=null;
-tryAgain:
-	for (;;) {
-		Token _token = null;
-		int _ttype = Token.INVALID_TYPE;
-		resetText();
-		try {
-			try {   // for error handling
-			switch ( LA(1)) {
-			case '\t':  case '\n':  case '\r':  case ' ':
-			{
-				mWS(true);
-				_rettoken=_returnToken;
-				break;
-			}
-			case '(':
-			{
-				mLPAREN(true);
-				_rettoken=_returnToken;
-				break;
-			}
-			case ')':
-			{
-				mRPAREN(true);
-				_rettoken=_returnToken;
-				break;
-			}
-			case '=':
-			{
-				mASSIGN(true);
-				_rettoken=_returnToken;
-				break;
-			}
-			case '"':
-			{
-				mSTRING(true);
-				_rettoken=_returnToken;
-				break;
-			}
-			case 'A':  case 'B':  case 'C':  case 'D':
-			case 'E':  case 'F':  case 'G':  case 'H':
-			case 'I':  case 'J':  case 'K':  case 'L':
-			case 'M':  case 'N':  case 'O':  case 'P':
-			case 'Q':  case 'R':  case 'S':  case 'T':
-			case 'U':  case 'V':  case 'W':  case 'X':
-			case 'Y':  case 'Z':  case 'a':  case 'b':
-			case 'c':  case 'd':  case 'e':  case 'f':
-			case 'g':  case 'h':  case 'i':  case 'j':
-			case 'k':  case 'l':  case 'm':  case 'n':
-			case 'o':  case 'p':  case 'q':  case 'r':
-			case 's':  case 't':  case 'u':  case 'v':
-			case 'w':  case 'x':  case 'y':  case 'z':
-			{
-				mID(true);
-				_rettoken=_returnToken;
-				break;
-			}
-			case '0':  case '1':  case '2':  case '3':
-			case '4':  case '5':  case '6':  case '7':
-			case '8':  case '9':
-			{
-				mINT(true);
-				_rettoken=_returnToken;
-				break;
-			}
-			default:
-				if ((LA(1)=='/') && (LA(2)=='/')) {
-					mSL_COMMENT(true);
-					_rettoken=_returnToken;
-				}
-				else if ((LA(1)=='/') && (LA(2)=='*')) {
-					mML_COMMENT(true);
-					_rettoken=_returnToken;
-				}
-			else {
-				if (LA(1)==EOF_CHAR) {_returnToken = makeToken(Token.EOF_TYPE);}
-				else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());}
-			}
-			}
-			if ( _returnToken==null ) continue tryAgain; // found SKIP token
-			_ttype = _returnToken.getType();
-			_returnToken.setType(_ttype);
-			return _returnToken;
-		}
-		catch (RecognitionException e) {
-			reportError(e);
-			consume();
-		}
-	}
-
-
-			catch (CharStreamException cse) {
-			if ( cse instanceof CharStreamIOException ) {
-				throw new TokenStreamIOException(((CharStreamIOException)cse).io);
-			}
-			else {
-				throw new TokenStreamException(cse.getMessage());
-			}
-		}
+
+public class ANTLRTokdefLexer extends antlr.CharScanner implements ANTLRTokdefParserTokenTypes, TokenStream {
+
+    private static final long _tokenSet_0_data_[] = { -9224L, 9223372036854775807L, 0L, 0L };
+
+    public static final BitSet _tokenSet_0 = new BitSet(_tokenSet_0_data_);
+
+    private static final long _tokenSet_1_data_[] = { -140737488355336L, 9223372036854775807L, 0L, 0L };
+
+    public static final BitSet _tokenSet_1 = new BitSet(_tokenSet_1_data_);
+
+
+    public ANTLRTokdefLexer(InputBuffer ib) {
+        this(new LexerSharedInputState(ib));
+    }
+
+    public ANTLRTokdefLexer(LexerSharedInputState state) {
+        super(state);
+        literals = new Hashtable();
+        caseSensitiveLiterals = true;
+        setCaseSensitive(true);
+    }
+
+    public ANTLRTokdefLexer(InputStream in) {
+        this(new ByteBuffer(in));
+    }
+
+    public ANTLRTokdefLexer(Reader in) {
+        this(new CharBuffer(in));
+    }
+
+    public final void mASSIGN(boolean _createToken) throws RecognitionException, CharStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = ASSIGN;
+        int _saveIndex;
+
+        match('=');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = DIGIT;
+        int _saveIndex;
+
+        matchRange('0', '9');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    protected final void mESC(boolean _createToken) throws RecognitionException, CharStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = ESC;
+        int _saveIndex;
+
+        match('\\');
+        {
+            switch (LA(1)) {
+                case 'n':
+                    {
+                        match('n');
+                        break;
+                    }
+                case 'r':
+                    {
+                        match('r');
+                        break;
+                    }
+                case 't':
+                    {
+                        match('t');
+                        break;
+                    }
+                case 'b':
+                    {
+                        match('b');
+                        break;
+                    }
+                case 'f':
+                    {
+                        match('f');
+                        break;
+                    }
+                case '"':
+                    {
+                        match('"');
+                        break;
+                    }
+                case '\'':
+                    {
+                        match('\'');
+                        break;
+                    }
+                case '\\':
+                    {
+                        match('\\');
+                        break;
+                    }
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                    {
+                        {
+                            matchRange('0', '3');
+                        }
+                        {
+                            if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\3' && LA(2) <= '~'))) {
+                                mDIGIT(false);
+                                {
+                                    if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\3' && LA(2) <= '~'))) {
+                                        mDIGIT(false);
+                                    } else if (((LA(1) >= '\3' && LA(1) <= '~')) && (true)) {
+                                    } else {
+                                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                                    }
+
+                                }
+                            } else if (((LA(1) >= '\3' && LA(1) <= '~')) && (true)) {
+                            } else {
+                                throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                            }
+
+                        }
+                        break;
+                    }
+                case '4':
+                case '5':
+                case '6':
+                case '7':
+                    {
+                        {
+                            matchRange('4', '7');
+                        }
+                        {
+                            if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\3' && LA(2) <= '~'))) {
+                                mDIGIT(false);
+                            } else if (((LA(1) >= '\3' && LA(1) <= '~')) && (true)) {
+                            } else {
+                                throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                            }
+
+                        }
+                        break;
+                    }
+                case 'u':
+                    {
+                        match('u');
+                        mXDIGIT(false);
+                        mXDIGIT(false);
+                        mXDIGIT(false);
+                        mXDIGIT(false);
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                    }
+            }
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mID(boolean _createToken) throws RecognitionException, CharStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = ID;
+        int _saveIndex;
+
+        {
+            switch (LA(1)) {
+                case 'a':
+                case 'b':
+                case 'c':
+                case 'd':
+                case 'e':
+                case 'f':
+                case 'g':
+                case 'h':
+                case 'i':
+                case 'j':
+                case 'k':
+                case 'l':
+                case 'm':
+                case 'n':
+                case 'o':
+                case 'p':
+                case 'q':
+                case 'r':
+                case 's':
+                case 't':
+                case 'u':
+                case 'v':
+                case 'w':
+                case 'x':
+                case 'y':
+                case 'z':
+                    {
+                        matchRange('a', 'z');
+                        break;
+                    }
+                case 'A':
+                case 'B':
+                case 'C':
+                case 'D':
+                case 'E':
+                case 'F':
+                case 'G':
+                case 'H':
+                case 'I':
+                case 'J':
+                case 'K':
+                case 'L':
+                case 'M':
+                case 'N':
+                case 'O':
+                case 'P':
+                case 'Q':
+                case 'R':
+                case 'S':
+                case 'T':
+                case 'U':
+                case 'V':
+                case 'W':
+                case 'X':
+                case 'Y':
+                case 'Z':
+                    {
+                        matchRange('A', 'Z');
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                    }
+            }
+        }
+        {
+            _loop37:
+            do {
+                switch (LA(1)) {
+                    case 'a':
+                    case 'b':
+                    case 'c':
+                    case 'd':
+                    case 'e':
+                    case 'f':
+                    case 'g':
+                    case 'h':
+                    case 'i':
+                    case 'j':
+                    case 'k':
+                    case 'l':
+                    case 'm':
+                    case 'n':
+                    case 'o':
+                    case 'p':
+                    case 'q':
+                    case 'r':
+                    case 's':
+                    case 't':
+                    case 'u':
+                    case 'v':
+                    case 'w':
+                    case 'x':
+                    case 'y':
+                    case 'z':
+                        {
+                            matchRange('a', 'z');
+                            break;
+                        }
+                    case 'A':
+                    case 'B':
+                    case 'C':
+                    case 'D':
+                    case 'E':
+                    case 'F':
+                    case 'G':
+                    case 'H':
+                    case 'I':
+                    case 'J':
+                    case 'K':
+                    case 'L':
+                    case 'M':
+                    case 'N':
+                    case 'O':
+                    case 'P':
+                    case 'Q':
+                    case 'R':
+                    case 'S':
+                    case 'T':
+                    case 'U':
+                    case 'V':
+                    case 'W':
+                    case 'X':
+                    case 'Y':
+                    case 'Z':
+                        {
+                            matchRange('A', 'Z');
+                            break;
+                        }
+                    case '_':
+                        {
+                            match('_');
+                            break;
+                        }
+                    case '0':
+                    case '1':
+                    case '2':
+                    case '3':
+                    case '4':
+                    case '5':
+                    case '6':
+                    case '7':
+                    case '8':
+                    case '9':
+                        {
+                            matchRange('0', '9');
+                            break;
+                        }
+                    default:
+                        {
+                            break _loop37;
+                        }
+                }
+            } while (true);
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mINT(boolean _createToken) throws RecognitionException, CharStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = INT;
+        int _saveIndex;
+
+        {
+            int _cnt40 = 0;
+            _loop40:
+            do {
+                if (((LA(1) >= '0' && LA(1) <= '9'))) {
+                    mDIGIT(false);
+                } else {
+                    if (_cnt40 >= 1) {
+                        break _loop40;
+                    } else {
+                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                    }
+                }
+
+                _cnt40++;
+            } while (true);
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mLPAREN(boolean _createToken) throws RecognitionException, CharStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = LPAREN;
+        int _saveIndex;
+
+        match('(');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mML_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = ML_COMMENT;
+        int _saveIndex;
+
+        match("/*");
+        {
+            _loop17:
+            do {
+                switch (LA(1)) {
+                    case '\n':
+                        {
+                            match('\n');
+                            newline();
+                            break;
+                        }
+                    case '\3':
+                    case '\4':
+                    case '\5':
+                    case '\6':
+                    case '\7':
+                    case '\10':
+                    case '\t':
+                    case '\13':
+                    case '\14':
+                    case '\r':
+                    case '\16':
+                    case '\17':
+                    case '\20':
+                    case '\21':
+                    case '\22':
+                    case '\23':
+                    case '\24':
+                    case '\25':
+                    case '\26':
+                    case '\27':
+                    case '\30':
+                    case '\31':
+                    case '\32':
+                    case '\33':
+                    case '\34':
+                    case '\35':
+                    case '\36':
+                    case '\37':
+                    case ' ':
+                    case '!':
+                    case '"':
+                    case '#':
+                    case '$':
+                    case '%':
+                    case '&':
+                    case '\'':
+                    case '(':
+                    case ')':
+                    case '+':
+                    case ',':
+                    case '-':
+                    case '.':
+                    case '/':
+                    case '0':
+                    case '1':
+                    case '2':
+                    case '3':
+                    case '4':
+                    case '5':
+                    case '6':
+                    case '7':
+                    case '8':
+                    case '9':
+                    case ':':
+                    case ';':
+                    case '<':
+                    case '=':
+                    case '>':
+                    case '?':
+                    case '@':
+                    case 'A':
+                    case 'B':
+                    case 'C':
+                    case 'D':
+                    case 'E':
+                    case 'F':
+                    case 'G':
+                    case 'H':
+                    case 'I':
+                    case 'J':
+                    case 'K':
+                    case 'L':
+                    case 'M':
+                    case 'N':
+                    case 'O':
+                    case 'P':
+                    case 'Q':
+                    case 'R':
+                    case 'S':
+                    case 'T':
+                    case 'U':
+                    case 'V':
+                    case 'W':
+                    case 'X':
+                    case 'Y':
+                    case 'Z':
+                    case '[':
+                    case '\\':
+                    case ']':
+                    case '^':
+                    case '_':
+                    case '`':
+                    case 'a':
+                    case 'b':
+                    case 'c':
+                    case 'd':
+                    case 'e':
+                    case 'f':
+                    case 'g':
+                    case 'h':
+                    case 'i':
+                    case 'j':
+                    case 'k':
+                    case 'l':
+                    case 'm':
+                    case 'n':
+                    case 'o':
+                    case 'p':
+                    case 'q':
+                    case 'r':
+                    case 's':
+                    case 't':
+                    case 'u':
+                    case 'v':
+                    case 'w':
+                    case 'x':
+                    case 'y':
+                    case 'z':
+                    case '{':
+                    case '|':
+                    case '}':
+                    case '~':
+                        {
+                            matchNot('*');
+                            break;
+                        }
+                    default:
+                        if ((LA(1) == '*') && (_tokenSet_1.member(LA(2)))) {
+                            match('*');
+                            matchNot('/');
+                        } else {
+                            break _loop17;
+                        }
+                }
+            } while (true);
+        }
+        match("*/");
+        _ttype = Token.SKIP;
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mRPAREN(boolean _createToken) throws RecognitionException, CharStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = RPAREN;
+        int _saveIndex;
+
+        match(')');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mSL_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = SL_COMMENT;
+        int _saveIndex;
+
+        match("//");
+        {
+            _loop12:
+            do {
+                if ((_tokenSet_0.member(LA(1)))) {
+                    {
+                        match(_tokenSet_0);
+                    }
+                } else {
+                    break _loop12;
+                }
+
+            } while (true);
+        }
+        {
+            switch (LA(1)) {
+                case '\n':
+                    {
+                        match('\n');
+                        break;
+                    }
+                case '\r':
+                    {
+                        match('\r');
+                        {
+                            if ((LA(1) == '\n')) {
+                                match('\n');
+                            } else {
+                            }
+
+                        }
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                    }
+            }
+        }
+        _ttype = Token.SKIP;
+        newline();
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mSTRING(boolean _createToken) throws RecognitionException, CharStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = STRING;
+        int _saveIndex;
+
+        match('"');
+        {
+            _loop23:
+            do {
+                switch (LA(1)) {
+                    case '\\':
+                        {
+                            mESC(false);
+                            break;
+                        }
+                    case '\3':
+                    case '\4':
+                    case '\5':
+                    case '\6':
+                    case '\7':
+                    case '\10':
+                    case '\t':
+                    case '\n':
+                    case '\13':
+                    case '\14':
+                    case '\r':
+                    case '\16':
+                    case '\17':
+                    case '\20':
+                    case '\21':
+                    case '\22':
+                    case '\23':
+                    case '\24':
+                    case '\25':
+                    case '\26':
+                    case '\27':
+                    case '\30':
+                    case '\31':
+                    case '\32':
+                    case '\33':
+                    case '\34':
+                    case '\35':
+                    case '\36':
+                    case '\37':
+                    case ' ':
+                    case '!':
+                    case '#':
+                    case '$':
+                    case '%':
+                    case '&':
+                    case '\'':
+                    case '(':
+                    case ')':
+                    case '*':
+                    case '+':
+                    case ',':
+                    case '-':
+                    case '.':
+                    case '/':
+                    case '0':
+                    case '1':
+                    case '2':
+                    case '3':
+                    case '4':
+                    case '5':
+                    case '6':
+                    case '7':
+                    case '8':
+                    case '9':
+                    case ':':
+                    case ';':
+                    case '<':
+                    case '=':
+                    case '>':
+                    case '?':
+                    case '@':
+                    case 'A':
+                    case 'B':
+                    case 'C':
+                    case 'D':
+                    case 'E':
+                    case 'F':
+                    case 'G':
+                    case 'H':
+                    case 'I':
+                    case 'J':
+                    case 'K':
+                    case 'L':
+                    case 'M':
+                    case 'N':
+                    case 'O':
+                    case 'P':
+                    case 'Q':
+                    case 'R':
+                    case 'S':
+                    case 'T':
+                    case 'U':
+                    case 'V':
+                    case 'W':
+                    case 'X':
+                    case 'Y':
+                    case 'Z':
+                    case '[':
+                    case ']':
+                    case '^':
+                    case '_':
+                    case '`':
+                    case 'a':
+                    case 'b':
+                    case 'c':
+                    case 'd':
+                    case 'e':
+                    case 'f':
+                    case 'g':
+                    case 'h':
+                    case 'i':
+                    case 'j':
+                    case 'k':
+                    case 'l':
+                    case 'm':
+                    case 'n':
+                    case 'o':
+                    case 'p':
+                    case 'q':
+                    case 'r':
+                    case 's':
+                    case 't':
+                    case 'u':
+                    case 'v':
+                    case 'w':
+                    case 'x':
+                    case 'y':
+                    case 'z':
+                    case '{':
+                    case '|':
+                    case '}':
+                    case '~':
+                        {
+                            matchNot('"');
+                            break;
+                        }
+                    default:
+                        {
+                            break _loop23;
+                        }
+                }
+            } while (true);
+        }
+        match('"');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    protected final void mVOCAB(boolean _createToken) throws RecognitionException, CharStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = VOCAB;
+        int _saveIndex;
+
+        matchRange('\3', '\176');
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = WS;
+        int _saveIndex;
+
+        {
+            switch (LA(1)) {
+                case ' ':
+                    {
+                        match(' ');
+                        break;
+                    }
+                case '\t':
+                    {
+                        match('\t');
+                        break;
+                    }
+                case '\r':
+                    {
+                        match('\r');
+                        {
+                            if ((LA(1) == '\n')) {
+                                match('\n');
+                            } else {
+                            }
+
+                        }
+                        newline();
+                        break;
+                    }
+                case '\n':
+                    {
+                        match('\n');
+                        newline();
+                        break;
+                    }
+                default:
+                    {
+                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                    }
+            }
+        }
+        _ttype = Token.SKIP;
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    protected final void mXDIGIT(boolean _createToken) throws RecognitionException, CharStreamException {
+        int _ttype;
+        Token _token = null;
+        int _begin = text.length();
+        _ttype = XDIGIT;
+        int _saveIndex;
+
+        switch (LA(1)) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                {
+                    matchRange('0', '9');
+                    break;
+                }
+            case 'a':
+            case 'b':
+            case 'c':
+            case 'd':
+            case 'e':
+            case 'f':
+                {
+                    matchRange('a', 'f');
+                    break;
+                }
+            case 'A':
+            case 'B':
+            case 'C':
+            case 'D':
+            case 'E':
+            case 'F':
+                {
+                    matchRange('A', 'F');
+                    break;
+                }
+            default:
+                {
+                    throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                }
+        }
+        if (_createToken && _token == null && _ttype != Token.SKIP) {
+            _token = makeToken(_ttype);
+            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
+        }
+        _returnToken = _token;
+    }
+
+    public Token nextToken() throws TokenStreamException {
+        Token _rettoken = null;
+        tryAgain:
+                for (; ;) {
+                    Token _token = null;
+                    int _ttype = Token.INVALID_TYPE;
+                    resetText();
+                    try {
+                        try { // for error handling
+                            switch (LA(1)) {
+                                case '\t':
+                                case '\n':
+                                case '\r':
+                                case ' ':
+                                    {
+                                        mWS(true);
+                                        _rettoken = _returnToken;
+                                        break;
+                                    }
+                                case '(':
+                                    {
+                                        mLPAREN(true);
+                                        _rettoken = _returnToken;
+                                        break;
+                                    }
+                                case ')':
+                                    {
+                                        mRPAREN(true);
+                                        _rettoken = _returnToken;
+                                        break;
+                                    }
+                                case '=':
+                                    {
+                                        mASSIGN(true);
+                                        _rettoken = _returnToken;
+                                        break;
+                                    }
+                                case '"':
+                                    {
+                                        mSTRING(true);
+                                        _rettoken = _returnToken;
+                                        break;
+                                    }
+                                case 'A':
+                                case 'B':
+                                case 'C':
+                                case 'D':
+                                case 'E':
+                                case 'F':
+                                case 'G':
+                                case 'H':
+                                case 'I':
+                                case 'J':
+                                case 'K':
+                                case 'L':
+                                case 'M':
+                                case 'N':
+                                case 'O':
+                                case 'P':
+                                case 'Q':
+                                case 'R':
+                                case 'S':
+                                case 'T':
+                                case 'U':
+                                case 'V':
+                                case 'W':
+                                case 'X':
+                                case 'Y':
+                                case 'Z':
+                                case 'a':
+                                case 'b':
+                                case 'c':
+                                case 'd':
+                                case 'e':
+                                case 'f':
+                                case 'g':
+                                case 'h':
+                                case 'i':
+                                case 'j':
+                                case 'k':
+                                case 'l':
+                                case 'm':
+                                case 'n':
+                                case 'o':
+                                case 'p':
+                                case 'q':
+                                case 'r':
+                                case 's':
+                                case 't':
+                                case 'u':
+                                case 'v':
+                                case 'w':
+                                case 'x':
+                                case 'y':
+                                case 'z':
+                                    {
+                                        mID(true);
+                                        _rettoken = _returnToken;
+                                        break;
+                                    }
+                                case '0':
+                                case '1':
+                                case '2':
+                                case '3':
+                                case '4':
+                                case '5':
+                                case '6':
+                                case '7':
+                                case '8':
+                                case '9':
+                                    {
+                                        mINT(true);
+                                        _rettoken = _returnToken;
+                                        break;
+                                    }
+                                default:
+                                    if ((LA(1) == '/') && (LA(2) == '/')) {
+                                        mSL_COMMENT(true);
+                                        _rettoken = _returnToken;
+                                    } else if ((LA(1) == '/') && (LA(2) == '*')) {
+                                        mML_COMMENT(true);
+                                        _rettoken = _returnToken;
+                                    } else {
+                                        if (LA(1) == EOF_CHAR) {
+                                            _returnToken = makeToken(Token.EOF_TYPE);
+                                        } else {
+                                            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
+                                        }
+                                    }
+                            }
+                            if (_returnToken == null) continue tryAgain; // found SKIP token
+                            _ttype = _returnToken.getType();
+                            _returnToken.setType(_ttype);
+                            return _returnToken;
+                        } catch (RecognitionException e) {
+                            reportError(e);
+                            consume();
+                        }
+                    } catch (CharStreamException cse) {
+                        if (cse instanceof CharStreamIOException) {
+                            throw new TokenStreamIOException(((CharStreamIOException)cse).io);
+                        } else {
+                            throw new TokenStreamException(cse.getMessage());
+                        }
+                    }
 
 
-		}
-}
+                }
+    }
 }



1.5       +160 -156  e/src/jsrc/antlr/ANTLRTokdefParser.java

Index: ANTLRTokdefParser.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ANTLRTokdefParser.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ANTLRTokdefParser.java	2001/11/29 20:33:25	1.4
+++ ANTLRTokdefParser.java	2001/12/02 06:01:28	1.5
@@ -6,163 +6,167 @@
  * Terence Parr, MageLang Institute
  * ANTLR Version 2.7.0a2; 1989-1999
  */
+
 import antlr.collections.impl.BitSet;
+
 public class ANTLRTokdefParser extends antlr.LLkParser
-	   implements ANTLRTokdefParserTokenTypes
- {
+  implements ANTLRTokdefParserTokenTypes {
 
-	public static final String[] _tokenNames = {
-		"<0>",
-		"EOF",
-		"<2>",
-		"NULL_TREE_LOOKAHEAD",
-		"ID",
-		"STRING",
-		"ASSIGN",
-		"LPAREN",
-		"RPAREN",
-		"INT",
-		"WS",
-		"SL_COMMENT",
-		"ML_COMMENT",
-		"ESC",
-		"DIGIT",
-		"XDIGIT",
-		"VOCAB"
-	};
-
-	private static final long _tokenSet_0_data_[] = { 2L, 0L };
-	public static final BitSet _tokenSet_0 = new BitSet(_tokenSet_0_data_);
-	private static final long _tokenSet_1_data_[] = { 50L, 0L };
-	public static final BitSet _tokenSet_1 = new BitSet(_tokenSet_1_data_);
-
-
-public ANTLRTokdefParser(ParserSharedInputState state) {
-  super(state,3);
-  tokenNames = _tokenNames;
-}
-public ANTLRTokdefParser(TokenBuffer tokenBuf) {
-  this(tokenBuf,3);
-}
-protected ANTLRTokdefParser(TokenBuffer tokenBuf, int k) {
-  super(tokenBuf,k);
-  tokenNames = _tokenNames;
-}
-public ANTLRTokdefParser(TokenStream lexer) {
-  this(lexer,3);
-}
-protected ANTLRTokdefParser(TokenStream lexer, int k) {
-  super(lexer,k);
-  tokenNames = _tokenNames;
-}
-	public final void file(
-		ImportVocabTokenManager tm
-	) throws RecognitionException, TokenStreamException {
-
-		Token  name = null;
-
-		try {      // for error handling
-			name = LT(1);
-			match(ID);
-			{
-			_loop3:
-			do {
-				if ((LA(1)==ID||LA(1)==STRING)) {
-					line(tm);
-				}
-				else {
-					break _loop3;
-				}
-
-			} while (true);
-			}
-		}
-		catch (RecognitionException ex) {
-			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_0);
-		}
-	}
-	public final void line(
-		ImportVocabTokenManager tm
-	) throws RecognitionException, TokenStreamException {
-
-		Token  s1 = null;
-		Token  lab = null;
-		Token  s2 = null;
-		Token  id = null;
-		Token  para = null;
-		Token  id2 = null;
-		Token  i = null;
-		Token t=null; Token s=null;
-
-		try {      // for error handling
-			{
-			if ((LA(1)==STRING)) {
-				s1 = LT(1);
-				match(STRING);
-				s = s1;
-			}
-			else if ((LA(1)==ID) && (LA(2)==ASSIGN) && (LA(3)==STRING)) {
-				lab = LT(1);
-				match(ID);
-				t = lab;
-				match(ASSIGN);
-				s2 = LT(1);
-				match(STRING);
-				s = s2;
-			}
-			else if ((LA(1)==ID) && (LA(2)==LPAREN)) {
-				id = LT(1);
-				match(ID);
-				t=id;
-				match(LPAREN);
-				para = LT(1);
-				match(STRING);
-				match(RPAREN);
-			}
-			else if ((LA(1)==ID) && (LA(2)==ASSIGN) && (LA(3)==INT)) {
-				id2 = LT(1);
-				match(ID);
-				t=id2;
-			}
-			else {
-				throw new NoViableAltException(LT(1), getFilename());
-			}
-
-			}
-			match(ASSIGN);
-			i = LT(1);
-			match(INT);
-
-					Integer value = Integer.valueOf(i.getText());
-					// if literal found, define as a string literal
-					if ( s!=null ) {
-						tm.define(s.getText(), value.intValue());
-						// if label, then label the string and map label to token symbol also
-						if ( t!=null ) {
-							StringLiteralSymbol sl =
-								(StringLiteralSymbol) tm.getTokenSymbol(s.getText());
-							sl.setLabel(t.getText());
-							tm.mapToTokenSymbol(t.getText(), sl);
-						}
-					}
-					// define token (not a literal)
-					else if ( t!=null ) {
-						tm.define(t.getText(), value.intValue());
-						if ( para!=null ) {
-							TokenSymbol ts = tm.getTokenSymbol(t.getText());
-							ts.setParaphrase(
-								para.getText()
-							);
-						}
-					}
-
-		}
-		catch (RecognitionException ex) {
-			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_1);
-		}
-	}
+    public static final String[] _tokenNames = {
+        "<0>",
+        "EOF",
+        "<2>",
+        "NULL_TREE_LOOKAHEAD",
+        "ID",
+        "STRING",
+        "ASSIGN",
+        "LPAREN",
+        "RPAREN",
+        "INT",
+        "WS",
+        "SL_COMMENT",
+        "ML_COMMENT",
+        "ESC",
+        "DIGIT",
+        "XDIGIT",
+        "VOCAB"
+    };
+
+    private static final long _tokenSet_0_data_[] = { 2L, 0L };
+
+    public static final BitSet _tokenSet_0 = new BitSet(_tokenSet_0_data_);
+
+    private static final long _tokenSet_1_data_[] = { 50L, 0L };
+
+    public static final BitSet _tokenSet_1 = new BitSet(_tokenSet_1_data_);
+
+
+    public ANTLRTokdefParser(ParserSharedInputState state) {
+        super(state, 3);
+        tokenNames = _tokenNames;
+    }
+
+    public ANTLRTokdefParser(TokenBuffer tokenBuf) {
+        this(tokenBuf, 3);
+    }
+
+    protected ANTLRTokdefParser(TokenBuffer tokenBuf, int k) {
+        super(tokenBuf, k);
+        tokenNames = _tokenNames;
+    }
+
+    public ANTLRTokdefParser(TokenStream lexer) {
+        this(lexer, 3);
+    }
+
+    protected ANTLRTokdefParser(TokenStream lexer, int k) {
+        super(lexer, k);
+        tokenNames = _tokenNames;
+    }
+
+    public final void file(
+      ImportVocabTokenManager tm
+      ) throws RecognitionException, TokenStreamException {
+
+        Token name = null;
+
+        try { // for error handling
+            name = LT(1);
+            match(ID);
+            {
+                _loop3:
+                do {
+                    if ((LA(1) == ID || LA(1) == STRING)) {
+                        line(tm);
+                    } else {
+                        break _loop3;
+                    }
+
+                } while (true);
+            }
+        } catch (RecognitionException ex) {
+            reportError(ex);
+            consume();
+            consumeUntil(_tokenSet_0);
+        }
+    }
+
+    public final void line(
+      ImportVocabTokenManager tm
+      ) throws RecognitionException, TokenStreamException {
+
+        Token s1 = null;
+        Token lab = null;
+        Token s2 = null;
+        Token id = null;
+        Token para = null;
+        Token id2 = null;
+        Token i = null;
+        Token t = null;
+        Token s = null;
+
+        try { // for error handling
+            {
+                if ((LA(1) == STRING)) {
+                    s1 = LT(1);
+                    match(STRING);
+                    s = s1;
+                } else if ((LA(1) == ID) && (LA(2) == ASSIGN) && (LA(3) == STRING)) {
+                    lab = LT(1);
+                    match(ID);
+                    t = lab;
+                    match(ASSIGN);
+                    s2 = LT(1);
+                    match(STRING);
+                    s = s2;
+                } else if ((LA(1) == ID) && (LA(2) == LPAREN)) {
+                    id = LT(1);
+                    match(ID);
+                    t = id;
+                    match(LPAREN);
+                    para = LT(1);
+                    match(STRING);
+                    match(RPAREN);
+                } else if ((LA(1) == ID) && (LA(2) == ASSIGN) && (LA(3) == INT)) {
+                    id2 = LT(1);
+                    match(ID);
+                    t = id2;
+                } else {
+                    throw new NoViableAltException(LT(1), getFilename());
+                }
+
+            }
+            match(ASSIGN);
+            i = LT(1);
+            match(INT);
+
+            Integer value = Integer.valueOf(i.getText());
+            // if literal found, define as a string literal
+            if (s != null) {
+                tm.define(s.getText(), value.intValue());
+                // if label, then label the string and map label to token symbol also
+                if (t != null) {
+                    StringLiteralSymbol sl =
+                      (StringLiteralSymbol)tm.getTokenSymbol(s.getText());
+                    sl.setLabel(t.getText());
+                    tm.mapToTokenSymbol(t.getText(), sl);
+                }
+            }
+            // define token (not a literal)
+            else if (t != null) {
+                tm.define(t.getText(), value.intValue());
+                if (para != null) {
+                    TokenSymbol ts = tm.getTokenSymbol(t.getText());
+                    ts.setParaphrase(
+                      para.getText()
+                    );
+                }
+            }
+
+        } catch (RecognitionException ex) {
+            reportError(ex);
+            consume();
+            consumeUntil(_tokenSet_1);
+        }
+    }
 }



1.5       +31 -16    e/src/jsrc/antlr/ANTLRTokdefParserTokenTypes.java

Index: ANTLRTokdefParserTokenTypes.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ANTLRTokdefParserTokenTypes.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ANTLRTokdefParserTokenTypes.java	2001/11/29 20:33:25	1.4
+++ ANTLRTokdefParserTokenTypes.java	2001/12/02 06:01:28	1.5
@@ -6,20 +6,35 @@
  * Terence Parr, MageLang Institute
  * ANTLR Version 2.7.0a2; 1989-1999
  */
- public interface ANTLRTokdefParserTokenTypes {
-	int EOF = 1;
-	int NULL_TREE_LOOKAHEAD = 3;
-	int ID = 4;
-	int STRING = 5;
-	int ASSIGN = 6;
-	int LPAREN = 7;
-	int RPAREN = 8;
-	int INT = 9;
-	int WS = 10;
-	int SL_COMMENT = 11;
-	int ML_COMMENT = 12;
-	int ESC = 13;
-	int DIGIT = 14;
-	int XDIGIT = 15;
-	int VOCAB = 16;
+public interface ANTLRTokdefParserTokenTypes {
+
+    int EOF = 1;
+
+    int NULL_TREE_LOOKAHEAD = 3;
+
+    int ID = 4;
+
+    int STRING = 5;
+
+    int ASSIGN = 6;
+
+    int LPAREN = 7;
+
+    int RPAREN = 8;
+
+    int INT = 9;
+
+    int WS = 10;
+
+    int SL_COMMENT = 11;
+
+    int ML_COMMENT = 12;
+
+    int ESC = 13;
+
+    int DIGIT = 14;
+
+    int XDIGIT = 15;
+
+    int VOCAB = 16;
 }



1.4       +128 -64   e/src/jsrc/antlr/ANTLRTokenTypes.java

Index: ANTLRTokenTypes.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ANTLRTokenTypes.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ANTLRTokenTypes.java	2001/10/26 03:08:50	1.3
+++ ANTLRTokenTypes.java	2001/12/02 06:01:28	1.4
@@ -3,68 +3,132 @@
 package antlr;
 
 public interface ANTLRTokenTypes {
-	int EOF = 1;
-	int NULL_TREE_LOOKAHEAD = 3;
-	int LITERAL_tokens = 4;
-	int LITERAL_header = 5;
-	int STRING_LITERAL = 6;
-	int ACTION = 7;
-	int DOC_COMMENT = 8;
-	int LITERAL_lexclass = 9;
-	int LITERAL_class = 10;
-	int LITERAL_extends = 11;
-	int LITERAL_Lexer = 12;
-	int LITERAL_TreeParser = 13;
-	int OPTIONS = 14;
-	int ASSIGN = 15;
-	int SEMI = 16;
-	int RCURLY = 17;
-	int LITERAL_charVocabulary = 18;
-	int CHAR_LITERAL = 19;
-	int INT = 20;
-	int OR = 21;
-	int RANGE = 22;
-	int TOKENS = 23;
-	int TOKEN_REF = 24;
-	int OPEN_ELEMENT_OPTION = 25;
-	int CLOSE_ELEMENT_OPTION = 26;
-	int LPAREN = 27;
-	int RULE_REF = 28;
-	int RPAREN = 29;
-	int LITERAL_Parser = 30;
-	int LITERAL_protected = 31;
-	int LITERAL_public = 32;
-	int LITERAL_private = 33;
-	int BANG = 34;
-	int ARG_ACTION = 35;
-	int LITERAL_returns = 36;
-	int COLON = 37;
-	int LITERAL_throws = 38;
-	int COMMA = 39;
-	int LITERAL_exception = 40;
-	int LITERAL_catch = 41;
-	int NOT_OP = 42;
-	int SEMPRED = 43;
-	int TREE_BEGIN = 44;
-	int QUESTION = 45;
-	int STAR = 46;
-	int PLUS = 47;
-	int IMPLIES = 48;
-	int CARET = 49;
-	int WILDCARD = 50;
-	int LITERAL_options = 51;
-	int WS = 52;
-	int COMMENT = 53;
-	int SL_COMMENT = 54;
-	int ML_COMMENT = 55;
-	int ESC = 56;
-	int DIGIT = 57;
-	int XDIGIT = 58;
-	int VOCAB = 59;
-	int NESTED_ARG_ACTION = 60;
-	int NESTED_ACTION = 61;
-	int WS_LOOP = 62;
-	int INTERNAL_RULE_REF = 63;
-	int WS_OPT = 64;
-	int NOT_USEFUL = 65;
+
+    int EOF = 1;
+
+    int NULL_TREE_LOOKAHEAD = 3;
+
+    int LITERAL_tokens = 4;
+
+    int LITERAL_header = 5;
+
+    int STRING_LITERAL = 6;
+
+    int ACTION = 7;
+
+    int DOC_COMMENT = 8;
+
+    int LITERAL_lexclass = 9;
+
+    int LITERAL_class = 10;
+
+    int LITERAL_extends = 11;
+
+    int LITERAL_Lexer = 12;
+
+    int LITERAL_TreeParser = 13;
+
+    int OPTIONS = 14;
+
+    int ASSIGN = 15;
+
+    int SEMI = 16;
+
+    int RCURLY = 17;
+
+    int LITERAL_charVocabulary = 18;
+
+    int CHAR_LITERAL = 19;
+
+    int INT = 20;
+
+    int OR = 21;
+
+    int RANGE = 22;
+
+    int TOKENS = 23;
+
+    int TOKEN_REF = 24;
+
+    int OPEN_ELEMENT_OPTION = 25;
+
+    int CLOSE_ELEMENT_OPTION = 26;
+
+    int LPAREN = 27;
+
+    int RULE_REF = 28;
+
+    int RPAREN = 29;
+
+    int LITERAL_Parser = 30;
+
+    int LITERAL_protected = 31;
+
+    int LITERAL_public = 32;
+
+    int LITERAL_private = 33;
+
+    int BANG = 34;
+
+    int ARG_ACTION = 35;
+
+    int LITERAL_returns = 36;
+
+    int COLON = 37;
+
+    int LITERAL_throws = 38;
+
+    int COMMA = 39;
+
+    int LITERAL_exception = 40;
+
+    int LITERAL_catch = 41;
+
+    int NOT_OP = 42;
+
+    int SEMPRED = 43;
+
+    int TREE_BEGIN = 44;
+
+    int QUESTION = 45;
+
+    int STAR = 46;
+
+    int PLUS = 47;
+
+    int IMPLIES = 48;
+
+    int CARET = 49;
+
+    int WILDCARD = 50;
+
+    int LITERAL_options = 51;
+
+    int WS = 52;
+
+    int COMMENT = 53;
+
+    int SL_COMMENT = 54;
+
+    int ML_COMMENT = 55;
+
+    int ESC = 56;
+
+    int DIGIT = 57;
+
+    int XDIGIT = 58;
+
+    int VOCAB = 59;
+
+    int NESTED_ARG_ACTION = 60;
+
+    int NESTED_ACTION = 61;
+
+    int WS_LOOP = 62;
+
+    int INTERNAL_RULE_REF = 63;
+
+    int WS_OPT = 64;
+
+    int NOT_USEFUL = 65;
 }



1.5       +105 -105  e/src/jsrc/antlr/ASTFactory.java

Index: ASTFactory.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ASTFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ASTFactory.java	2001/11/29 20:33:25	1.4
+++ ASTFactory.java	2001/12/02 06:01:28	1.5
@@ -4,7 +4,7 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: ASTFactory.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: ASTFactory.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 import antlr.collections.AST;
@@ -21,78 +21,80 @@
  *  create to make heterogeneous nodes etc...
  */
 public class ASTFactory {
+
     /** Name of AST class to create during tree construction.
      *  Null implies that the create method should create
      *  a default AST type such as CommonAST.
      */
     protected String theASTNodeType = null;
+
     protected Class theASTNodeTypeClass = null;
 
 
     /** Add a child to the current AST */
     public void addASTChild(ASTPair currentAST, AST child) {
-	if (child != null) {
-	    if (currentAST.root == null) {
-				// Make new child the current root
-		currentAST.root = child;
-	    }
-	    else {
-		if (currentAST.child == null) {
-		    // Add new child to current root
-		    currentAST.root.setFirstChild(child);
-		}
-		else {
-		    currentAST.child.setNextSibling(child);
-		}
-	    }
-	    // Make new child the current child
-	    currentAST.child = child;
-	    currentAST.advanceChildToEnd();
-	}
+        if (child != null) {
+            if (currentAST.root == null) {
+                // Make new child the current root
+                currentAST.root = child;
+            } else {
+                if (currentAST.child == null) {
+                    // Add new child to current root
+                    currentAST.root.setFirstChild(child);
+                } else {
+                    currentAST.child.setNextSibling(child);
+                }
+            }
+            // Make new child the current child
+            currentAST.child = child;
+            currentAST.advanceChildToEnd();
+        }
     }
 
     /** Create a new empty AST node; if the user did not specify
      *  an AST node type, then create a default one: CommonAST.
      */
     public AST create() {
-	AST t = null;
-	if (theASTNodeTypeClass == null) {
-	    t = new CommonAST();
-	} else {
-	    try {
-		t = (AST) theASTNodeTypeClass.newInstance(); // make a new one
-	    } catch (Exception e) {
-		antlr.Tool.warning("Can't create AST Node " + theASTNodeType);
-		return null;
-	    }
-	}
-	return t;
+        AST t = null;
+        if (theASTNodeTypeClass == null) {
+            t = new CommonAST();
+        } else {
+            try {
+                t = (AST)theASTNodeTypeClass.newInstance(); // make a new one
+            } catch (Exception e) {
+                antlr.Tool.warning("Can't create AST Node " + theASTNodeType);
+                return null;
+            }
+        }
+        return t;
     }
+
     public AST create(int type) {
-	AST t = create();
-	t.initialize(type,"");
-	return t;
+        AST t = create();
+        t.initialize(type, "");
+        return t;
     }
+
     public AST create(int type, String txt) {
-	AST t = create();
-	t.initialize(type,txt);
-	return t;
+        AST t = create();
+        t.initialize(type, txt);
+        return t;
     }
 
     /** Create a new empty AST node; if the user did not specify
      *  an AST node type, then create a default one: CommonAST.
      */
     public AST create(AST tr) {
-	if ( tr==null ) return null;		// create(null) == null
-	AST t = create();
-	t.initialize(tr);
-	return t;
+        if (tr == null) return null;		// create(null) == null
+        AST t = create();
+        t.initialize(tr);
+        return t;
     }
 
     public AST create(Token tok) {
-	AST t = create();
-	t.initialize(tok);
-	return t;
+        AST t = create();
+        t.initialize(tok);
+        return t;
     }
 
     /** Copy a single node.  clone() is not used because
@@ -102,31 +104,31 @@
      *  tracked.  Returns null if t is null.
      */
     public AST dup(AST t) {
-	return create(t);		// if t==null, create returns null
+        return create(t);		// if t==null, create returns null
     }
 
     /** Duplicate tree including siblings of root. */
     public AST dupList(AST t) {
-	AST result = dupTree(t);            // if t == null, then result==null
-	AST nt = result;
-	while (t != null) {						// for each sibling of the root
-	    t = t.getNextSibling();
-	    nt.setNextSibling(dupTree(t));	// dup each subtree, building new tree
-	    nt = nt.getNextSibling();
-	}
-	return result;
+        AST result = dupTree(t);            // if t == null, then result==null
+        AST nt = result;
+        while (t != null) { // for each sibling of the root
+            t = t.getNextSibling();
+            nt.setNextSibling(dupTree(t));	// dup each subtree, building new tree
+            nt = nt.getNextSibling();
+        }
+        return result;
     }
 
     /**Duplicate a tree, assuming this is a root node of a tree--
      * duplicate that node and what's below; ignore siblings of root node.
      */
     public AST dupTree(AST t) {
-	AST result = dup(t);		// make copy of root
-	// copy all children of root.
-	if ( t!=null ) {
-	    result.setFirstChild( dupList(t.getFirstChild()) );
-	}
-	return result;
+        AST result = dup(t);		// make copy of root
+        // copy all children of root.
+        if (t != null) {
+            result.setFirstChild(dupList(t.getFirstChild()));
+        }
+        return result;
     }
 
     /** Make a tree from a list of nodes.  The first element in the
@@ -136,64 +138,62 @@
      *  yields tree (nil a b).
      */
     public AST make(AST[] nodes) {
-	if ( nodes==null || nodes.length==0 ) return null;
-	AST root = nodes[0];
-	AST tail = null;
-	if (root != null) {
-	    root.setFirstChild(null);	// don't leave any old pointers set
-	}
-	// link in children;
-	for (int i=1; i<nodes.length; i++) {
-	    if ( nodes[i]==null ) continue;	// ignore null nodes
-	    if (root == null) {
-				// Set the root and set it up for a flat list
-		root = tail = nodes[i];
-	    }
-	    else if ( tail==null ) {
-		root.setFirstChild(nodes[i]);
-		tail = root.getFirstChild();
-	    }
-	    else {
-		tail.setNextSibling(nodes[i]);
-		tail = tail.getNextSibling();
-	    }
-	    // Chase tail to last sibling
-	    while (tail.getNextSibling() != null) {
-		tail = tail.getNextSibling();
-	    }
-	}
-	return root;
+        if (nodes == null || nodes.length == 0) return null;
+        AST root = nodes[0];
+        AST tail = null;
+        if (root != null) {
+            root.setFirstChild(null);	// don't leave any old pointers set
+        }
+        // link in children;
+        for (int i = 1; i < nodes.length; i++) {
+            if (nodes[i] == null) continue;	// ignore null nodes
+            if (root == null) {
+                // Set the root and set it up for a flat list
+                root = tail = nodes[i];
+            } else if (tail == null) {
+                root.setFirstChild(nodes[i]);
+                tail = root.getFirstChild();
+            } else {
+                tail.setNextSibling(nodes[i]);
+                tail = tail.getNextSibling();
+            }
+            // Chase tail to last sibling
+            while (tail.getNextSibling() != null) {
+                tail = tail.getNextSibling();
+            }
+        }
+        return root;
     }
 
     /** Make a tree from a list of nodes, where the nodes are contained
      * in an ASTArray object
      */
     public AST make(ASTArray nodes) {
-	return make(nodes.array);
+        return make(nodes.array);
     }
 
     /** Make an AST the root of current AST */
     public void makeASTRoot(ASTPair currentAST, AST root) {
-	if (root != null) {
-	    // Add the current root as a child of new root
-	    root.addChild(currentAST.root);
-	    // The new current child is the last sibling of the old root
-	    currentAST.child = currentAST.root;
-	    currentAST.advanceChildToEnd();
-	    // Set the new root
-	    currentAST.root = root;
-	}
+        if (root != null) {
+            // Add the current root as a child of new root
+            root.addChild(currentAST.root);
+            // The new current child is the last sibling of the old root
+            currentAST.child = currentAST.root;
+            currentAST.advanceChildToEnd();
+            // Set the new root
+            currentAST.root = root;
+        }
     }
 
     public void setASTNodeType(String t) {
-	theASTNodeType = t;
-	try {
-	    theASTNodeTypeClass = Class.forName(t); // get class def
-	} catch (Exception e) {
-	    // either class not found,
-	    // class is interface/abstract, or
-	    // class or initializer is not accessible.
-	    antlr.Tool.warning("Can't find/access AST Node type"+t);
-	}
+        theASTNodeType = t;
+        try {
+            theASTNodeTypeClass = Class.forName(t); // get class def
+        } catch (Exception e) {
+            // either class not found,
+            // class is interface/abstract, or
+            // class or initializer is not accessible.
+            antlr.Tool.warning("Can't find/access AST Node type" + t);
+        }
     }
 }



1.5       +50 -49    e/src/jsrc/antlr/ASTIterator.java

Index: ASTIterator.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ASTIterator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ASTIterator.java	2001/11/29 20:33:25	1.4
+++ ASTIterator.java	2001/12/02 06:01:28	1.5
@@ -4,73 +4,74 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: ASTIterator.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: ASTIterator.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 import antlr.collections.AST;
 
 public class ASTIterator {
+
     protected AST cursor = null;
+
     protected AST original = null;
 
 
     public ASTIterator(AST t) {
-	original = cursor = t;
+        original = cursor = t;
     }
 
     /** Is 'sub' a subtree of 't' beginning at the root? */
     public boolean isSubtree(AST t, AST sub) {
-	AST sibling;
+        AST sibling;
 
-	// the empty tree is always a subset of any tree.
-	if ( sub==null ) {
-	    return true;
-	}
-
-	// if the tree is empty, return true if the subtree template is too.
-	if ( t==null ) {
-	    if ( sub!=null ) return false;
-	    return true;
-	}
-
-	// Otherwise, start walking sibling lists.  First mismatch, return false.
-	for (sibling=t;
-	     sibling!=null&&sub!=null;
-	     sibling=sibling.getNextSibling(), sub=sub.getNextSibling())
-	    {
-		// as a quick optimization, check roots first.
-		if ( sibling.getType() != sub.getType() ) return false;
-		// if roots match, do full match test on children.
-		if ( sibling.getFirstChild()!=null ) {
-		    if ( !isSubtree(sibling.getFirstChild(), sub.getFirstChild()) ) return false;
-		}
-	    }
-	return true;
+        // the empty tree is always a subset of any tree.
+        if (sub == null) {
+            return true;
+        }
+
+        // if the tree is empty, return true if the subtree template is too.
+        if (t == null) {
+            if (sub != null) return false;
+            return true;
+        }
+
+        // Otherwise, start walking sibling lists.  First mismatch, return false.
+        for (sibling = t;
+             sibling != null && sub != null;
+             sibling = sibling.getNextSibling(), sub = sub.getNextSibling()) {
+            // as a quick optimization, check roots first.
+            if (sibling.getType() != sub.getType()) return false;
+            // if roots match, do full match test on children.
+            if (sibling.getFirstChild() != null) {
+                if (!isSubtree(sibling.getFirstChild(), sub.getFirstChild())) return false;
+            }
+        }
+        return true;
     }
+
     /** Find the next subtree with structure and token types equal to
-	 * those of 'template'.
-	 */
+     * those of 'template'.
+     */
     public AST next(AST template) {
-	AST t = null;
-	AST sibling = null;
+        AST t = null;
+        AST sibling = null;
 
-	if ( cursor==null ) {	// do nothing if no tree to work on
-	    return null;
-	}
-
-	// Start walking sibling list looking for subtree matches.
-	for ( ; cursor!=null; cursor=cursor.getNextSibling())
-	    {
-		// as a quick optimization, check roots first.
-		if ( cursor.getType() == template.getType() ) {
-				// if roots match, do full match test on children.
-		    if ( cursor.getFirstChild()!=null ) {
-			if ( isSubtree(cursor.getFirstChild(), template.getFirstChild()) ) {
-			    return cursor;
-			}
-		    }
-		}
-	    }
-	return t;
+        if (cursor == null) { // do nothing if no tree to work on
+            return null;
+        }
+
+        // Start walking sibling list looking for subtree matches.
+        for (; cursor != null; cursor = cursor.getNextSibling()) {
+            // as a quick optimization, check roots first.
+            if (cursor.getType() == template.getType()) {
+                // if roots match, do full match test on children.
+                if (cursor.getFirstChild() != null) {
+                    if (isSubtree(cursor.getFirstChild(), template.getFirstChild())) {
+                        return cursor;
+                    }
+                }
+            }
+        }
+        return t;
     }
 }



1.5       +84 -23    e/src/jsrc/antlr/ASTNULLType.java

Index: ASTNULLType.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ASTNULLType.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ASTNULLType.java	2001/11/29 20:33:25	1.4
+++ ASTNULLType.java	2001/12/02 06:01:28	1.5
@@ -4,7 +4,7 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: ASTNULLType.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: ASTNULLType.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 import antlr.collections.AST;
@@ -12,28 +12,89 @@
 
 /** There is only one instance of this class **/
 public class ASTNULLType implements AST {
-    public void addChild(AST c) {;}
-    public boolean equals(AST t) {return false;}
-    public boolean equalsList(AST t) {return false;}
-    public boolean equalsListPartial(AST t) {return false;}
-    public boolean equalsTree(AST t) {return false;}
-    public boolean equalsTreePartial(AST t) {return false;}
-    public ASTEnumeration findAll(AST tree) {return null;}
+
+    public void addChild(AST c) {
+        ;
+    }
+
+    public boolean equals(AST t) {
+        return false;
+    }
+
+    public boolean equalsList(AST t) {
+        return false;
+    }
+
+    public boolean equalsListPartial(AST t) {
+        return false;
+    }
+
+    public boolean equalsTree(AST t) {
+        return false;
+    }
+
+    public boolean equalsTreePartial(AST t) {
+        return false;
+    }
+
+    public ASTEnumeration findAll(AST tree) {
+        return null;
+    }
+
     public ASTEnumeration findAllPartial(AST subtree) {
-	return null;
+        return null;
+    }
+
+    public AST getFirstChild() {
+        return this;
+    }
+
+    public AST getNextSibling() {
+        return this;
+    }
+
+    public String getText() {
+        return "<ASTNULL>";
+    }
+
+    public int getType() {
+        return Token.NULL_TREE_LOOKAHEAD;
+    }
+
+    public void initialize(int t, String txt) {
+    }
+
+    public void initialize(AST t) {
+    }
+
+    public void initialize(Token t) {
+    }
+
+    public void setFirstChild(AST c) {
+        ;
+    }
+
+    public void setNextSibling(AST n) {
+        ;
+    }
+
+    public void setText(String text) {
+        ;
+    }
+
+    public void setType(int ttype) {
+        ;
+    }
+
+    public String toString() {
+        return getText();
+    }
+
+    public String toStringList() {
+        return getText();
+    }
+
+    public String toStringTree() {
+        return getText();
     }
-    public AST getFirstChild() { return this; }
-    public AST getNextSibling() { return this; }
-    public String getText() { return "<ASTNULL>"; }
-    public int getType() { return Token.NULL_TREE_LOOKAHEAD; }
-    public void initialize(int t, String txt) {}
-    public void initialize(AST t) {}
-    public void initialize(Token t) {}
-    public void setFirstChild(AST c) {;}
-    public void setNextSibling(AST n) {;}
-    public void setText(String text) {;}
-    public void setType(int ttype) {;}
-    public String toString() {return getText();}
-    public String toStringList() {return getText();}
-    public String toStringTree() {return getText();}
 }



1.4       +21 -19    e/src/jsrc/antlr/ASTPair.java

Index: ASTPair.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ASTPair.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ASTPair.java	2001/10/26 03:08:50	1.3
+++ ASTPair.java	2001/12/02 06:01:28	1.4
@@ -4,40 +4,42 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: ASTPair.java,v 1.3 2001/10/26 03:08:50 markm Exp $
+ * $Id: ASTPair.java,v 1.4 2001/12/02 06:01:28 markm Exp $
  */
 
 import antlr.collections.AST;
 
 /** ASTPair:  utility class used for manipulating a pair of ASTs
-  * representing the current AST root and current AST sibling.
-  * This exists to compensate for the lack of pointers or 'var'
-  * arguments in Java.
-  */
+ * representing the current AST root and current AST sibling.
+ * This exists to compensate for the lack of pointers or 'var'
+ * arguments in Java.
+ */
 public class ASTPair {
-	public AST root;		// current root of tree
-	public AST child;		// current child to which siblings are added
+
+    public AST root;		// current root of tree
+
+    public AST child;		// current child to which siblings are added
 
     /** Make sure that child is the last sibling */
     public final void advanceChildToEnd() {
-	if (child != null) {
-	    while (child.getNextSibling() != null) {
-		child = child.getNextSibling();
-	    }
-	}
+        if (child != null) {
+            while (child.getNextSibling() != null) {
+                child = child.getNextSibling();
+            }
+        }
     }
 
     /** Copy an ASTPair.  Don't call it clone() because we want type-safety */
     public ASTPair copy() {
-	ASTPair tmp = new ASTPair();
-	tmp.root = root;
-	tmp.child = child;
-	return tmp;
+        ASTPair tmp = new ASTPair();
+        tmp.root = root;
+        tmp.child = child;
+        return tmp;
     }
 
     public String toString() {
-	String r = root==null ? "null" : root.getText();
-	String c = child==null ? "null" : child.getText();
-	return "["+r+","+c+"]";
+        String r = root == null ? "null" : root.getText();
+        String c = child == null ? "null" : child.getText();
+        return "[" + r + "," + c + "]";
     }
 }



1.4       +3 -2      e/src/jsrc/antlr/ASTVisitor.java

Index: ASTVisitor.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ASTVisitor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ASTVisitor.java	2001/10/26 03:08:50	1.3
+++ ASTVisitor.java	2001/12/02 06:01:28	1.4
@@ -4,11 +4,12 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: ASTVisitor.java,v 1.3 2001/10/26 03:08:50 markm Exp $
+ * $Id: ASTVisitor.java,v 1.4 2001/12/02 06:01:28 markm Exp $
  */
 
 import antlr.collections.AST;
 
-public interface ASTVisitor{
+public interface ASTVisitor {
+
     public void visit(AST node);
 }



1.4       +22 -17    e/src/jsrc/antlr/ActionElement.java

Index: ActionElement.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ActionElement.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ActionElement.java	2001/10/26 03:08:50	1.3
+++ ActionElement.java	2001/12/02 06:01:28	1.4
@@ -4,26 +4,31 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: ActionElement.java,v 1.3 2001/10/26 03:08:50 markm Exp $
+ * $Id: ActionElement.java,v 1.4 2001/12/02 06:01:28 markm Exp $
  */
 
 class ActionElement extends AlternativeElement {
-	protected String actionText;
-	protected boolean isSemPred = false;
 
+    protected String actionText;
 
-	public ActionElement(Grammar g, Token t) {
-		super(g);
-		actionText = t.getText();
-		line = t.getLine();
-	}
-	public void generate() {
-		grammar.generator.gen(this);
-	}
-	public Lookahead look(int k) {
-		return grammar.theLLkAnalyzer.look(k, this);
-	}
-	public String toString() {
-		return " "+actionText + (isSemPred?"?":"");
-	}
+    protected boolean isSemPred = false;
+
+
+    public ActionElement(Grammar g, Token t) {
+        super(g);
+        actionText = t.getText();
+        line = t.getLine();
+    }
+
+    public void generate() {
+        grammar.generator.gen(this);
+    }
+
+    public Lookahead look(int k) {
+        return grammar.theLLkAnalyzer.look(k, this);
+    }
+
+    public String toString() {
+        return " " + actionText + (isSemPred?"?":"");
+    }
 }



1.4       +8 -6      e/src/jsrc/antlr/ActionTransInfo.java

Index: ActionTransInfo.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ActionTransInfo.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ActionTransInfo.java	2001/10/26 03:08:50	1.3
+++ ActionTransInfo.java	2001/12/02 06:01:28	1.4
@@ -4,7 +4,7 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: ActionTransInfo.java,v 1.3 2001/10/26 03:08:50 markm Exp $
+ * $Id: ActionTransInfo.java,v 1.4 2001/12/02 06:01:28 markm Exp $
  */
 
 /**
@@ -12,11 +12,13 @@
  * was translated (using the AST conversion rules).
  */
 public class ActionTransInfo {
-	public boolean assignToRoot = false;	// somebody did a "#rule = "
-	public String refRuleRoot = null;		// somebody referenced #rule; string is translated var
 
+    public boolean assignToRoot = false;	// somebody did a "#rule = "
 
-	public String toString() {
-		return "assignToRoot:"+assignToRoot+", refRuleRoot:"+refRuleRoot;
-	}
+    public String refRuleRoot = null;		// somebody referenced #rule; string is translated var
+
+
+    public String toString() {
+        return "assignToRoot:" + assignToRoot + ", refRuleRoot:" + refRuleRoot;
+    }
 }



1.5       +67 -54    e/src/jsrc/antlr/Alternative.java

Index: Alternative.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/Alternative.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Alternative.java	2001/11/29 20:33:25	1.4
+++ Alternative.java	2001/12/02 06:01:28	1.5
@@ -4,63 +4,76 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: Alternative.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: Alternative.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 
-
 /** Intermediate data class holds information about an alternative */
 class Alternative {
-	// Tracking alternative linked list
-	AlternativeElement head;   // head of alt element list
-	AlternativeElement tail;  // last element added
-
-	// Syntactic predicate block if non-null
-	protected SynPredBlock synPred;
-	// Semantic predicate action if non-null
-	protected String semPred;
-	// Exception specification if non-null
-	protected ExceptionSpec exceptionSpec;
-	// Init action if non-null;
-	protected Lookahead[] cache;	// lookahead for alt.  Filled in by
-									// deterministic() only!!!!!!!  Used for
-									// code gen after calls to deterministic()
-									// and used by deterministic for (...)*, (..)+,
-									// and (..)? blocks.  1..k
-	protected int lookaheadDepth;	// each alt has different look depth possibly.
-									// depth can be NONDETERMINISTIC too.
-									// 0..n-1
-	// If non-null, Tree specification ala -> A B C (not implemented)
-	protected Token treeSpecifier = null;
-	// True of AST generation is on for this alt
-	private boolean doAutoGen;
-
-
-	public Alternative() {
-	}
-	public Alternative(AlternativeElement firstElement) {
-		addElement(firstElement);
-	}
-	public void addElement(AlternativeElement e)
-	{
-		// Link the element into the list
-		if ( head == null ) {
-			head = tail = e;
-		}
-		else {
-			tail.next = e;
-			tail = e;
-		}
-	}
-	public boolean atStart() { return head == null; }
-	public boolean getAutoGen() {
-		// Don't build an AST if there is a tree-rewrite-specifier
-		return doAutoGen && treeSpecifier == null;
-	}
-	public Token getTreeSpecifier() {
-		return treeSpecifier;
-	}
-	public void setAutoGen(boolean doAutoGen_) {
-		doAutoGen = doAutoGen_;
-	}
+
+    // Tracking alternative linked list
+    AlternativeElement head;   // head of alt element list
+
+    AlternativeElement tail;  // last element added
+
+    // Syntactic predicate block if non-null
+    protected SynPredBlock synPred;
+
+    // Semantic predicate action if non-null
+    protected String semPred;
+
+    // Exception specification if non-null
+    protected ExceptionSpec exceptionSpec;
+
+    // Init action if non-null;
+    protected Lookahead[] cache;	// lookahead for alt.  Filled in by
+
+    // deterministic() only!!!!!!!  Used for
+    // code gen after calls to deterministic()
+    // and used by deterministic for (...)*, (..)+,
+    // and (..)? blocks.  1..k
+    protected int lookaheadDepth;	// each alt has different look depth possibly.
+
+    // depth can be NONDETERMINISTIC too.
+    // 0..n-1
+// If non-null, Tree specification ala -> A B C (not implemented)
+    protected Token treeSpecifier = null;
+
+    // True of AST generation is on for this alt
+    private boolean doAutoGen;
+
+
+    public Alternative() {
+    }
+
+    public Alternative(AlternativeElement firstElement) {
+        addElement(firstElement);
+    }
+
+    public void addElement(AlternativeElement e) {
+        // Link the element into the list
+        if (head == null) {
+            head = tail = e;
+        } else {
+            tail.next = e;
+            tail = e;
+        }
+    }
+
+    public boolean atStart() {
+        return head == null;
+    }
+
+    public boolean getAutoGen() {
+        // Don't build an AST if there is a tree-rewrite-specifier
+        return doAutoGen && treeSpecifier == null;
+    }
+
+    public Token getTreeSpecifier() {
+        return treeSpecifier;
+    }
+
+    public void setAutoGen(boolean doAutoGen_) {
+        doAutoGen = doAutoGen_;
+    }
 }



1.5       +140 -128  e/src/jsrc/antlr/AlternativeBlock.java

Index: AlternativeBlock.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/AlternativeBlock.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AlternativeBlock.java	2001/11/29 20:33:25	1.4
+++ AlternativeBlock.java	2001/12/02 06:01:28	1.5
@@ -4,201 +4,213 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: AlternativeBlock.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: AlternativeBlock.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 import antlr.collections.impl.Vector;
 
 /**A list of alternatives */
 class AlternativeBlock extends AlternativeElement {
+
     protected String initAction = null;	// string for init action {...}
+
     protected Vector alternatives;	// Contains Alternatives
 
     protected String label;			// can label a looping block to break out of it.
 
     protected int alti, altj;		// which alts are being compared at the moment with
-									// deterministic()?
+
+    // deterministic()?
     protected int analysisAlt;		// which alt are we computing look on?  Must be alti or altj
 
     protected boolean hasAnAction = false;	// does any alt have an action?
+
     protected boolean hasASynPred = false;	// does any alt have a syntactic predicate?
+
+    protected int ID = 0;				// used to generate unique variables
 
-    protected int ID=0;				// used to generate unique variables
     protected static int nblks;	// how many blocks have we allocated?
+
     boolean not = false;				// true if block is inverted.
 
     boolean greedy = true;			// Blocks are greedy by default
-    boolean greedySet=false;		// but, if not explicitly greedy, warning might be generated
+
+    boolean greedySet = false;		// but, if not explicitly greedy, warning might be generated
 
-    protected boolean doAutoGen=true;	// false if no AST (or text) to be generated for block
+    protected boolean doAutoGen = true;	// false if no AST (or text) to be generated for block
 
     protected boolean warnWhenFollowAmbig = true; // warn when an empty path or exit path
 
     protected boolean generateAmbigWarnings = true;  // the general warning "shut-up" mechanism
 
-																	// conflicts with alt of subrule.
-																	// Turning this off will suppress stuff
-																	// like the if-then-else ambig.
+    // conflicts with alt of subrule.
+    // Turning this off will suppress stuff
+    // like the if-then-else ambig.
 
     public AlternativeBlock(Grammar g) {
-	this(g,0,false);
+        this(g, 0, false);
     }
 
     public AlternativeBlock(Grammar g, int line, boolean not) {
-	super(g);
-	alternatives = new Vector(5);
-	this.line = line;
-	this.not = not;
-	nblks++;
-	ID = nblks;
+        super(g);
+        alternatives = new Vector(5);
+        this.line = line;
+        this.not = not;
+        nblks++;
+        ID = nblks;
     }
 
     public void addAlternative(Alternative alt) {
-	alternatives.appendElement(alt);
+        alternatives.appendElement(alt);
     }
+
     public void generate() {
-	grammar.generator.gen(this);
+        grammar.generator.gen(this);
     }
-    public Alternative getAlternativeAt(int i)
-    {
-	return (Alternative)alternatives.elementAt(i);
+
+    public Alternative getAlternativeAt(int i) {
+        return (Alternative)alternatives.elementAt(i);
     }
+
     public Vector getAlternatives() {
-	return alternatives;
+        return alternatives;
     }
+
     public boolean getAutoGen() {
-	return doAutoGen;
+        return doAutoGen;
     }
+
     public String getInitAction() {
-	return initAction;
+        return initAction;
     }
+
     public String getLabel() {
-	return label;
+        return label;
     }
+
     public Lookahead look(int k) {
-	return grammar.theLLkAnalyzer.look(k, this);
+        return grammar.theLLkAnalyzer.look(k, this);
     }
+
     public void prepareForAnalysis() {
-	for (int i=0; i<alternatives.size(); i++) {
-	    // deterministic() uses an alternative cache and sets lookahead depth
-	    Alternative a = (Alternative)alternatives.elementAt(i);
-	    a.cache = new Lookahead[grammar.maxk+1];
-	    a.lookaheadDepth = GrammarAnalyzer.LOOKAHEAD_DEPTH_INIT;
-	}
+        for (int i = 0; i < alternatives.size(); i++) {
+            // deterministic() uses an alternative cache and sets lookahead depth
+            Alternative a = (Alternative)alternatives.elementAt(i);
+            a.cache = new Lookahead[grammar.maxk + 1];
+            a.lookaheadDepth = GrammarAnalyzer.LOOKAHEAD_DEPTH_INIT;
+        }
     }
+
     /**Walk the syntactic predicate and, for a rule ref R, remove
-	 * the ref from the list of FOLLOW references for R (stored
-	 * in the symbol table.
-	 */
+     * the ref from the list of FOLLOW references for R (stored
+     * in the symbol table.
+     */
     public void removeTrackingOfRuleRefs(Grammar g) {
-	for (int i=0; i<alternatives.size(); i++) {
-	    Alternative alt = getAlternativeAt(i);
-	    AlternativeElement elem = alt.head;
-	    while ( elem!=null ) {
-		if ( elem instanceof RuleRefElement ) {
-		    RuleRefElement rr = (RuleRefElement)elem;
-		    RuleSymbol rs = (RuleSymbol)g.getSymbol(rr.targetRule);
-		    if ( rs==null ) {
-			grammar.tool.error("rule "+rr.targetRule+" referenced in (...)=>, but not defined");
-		    }
-		    else {
-			rs.references.removeElement(rr);
-		    }
-		}
-		else if ( elem instanceof AlternativeBlock ) {// recurse into subrules
-		    ((AlternativeBlock)elem).removeTrackingOfRuleRefs(g);
-		}
-		elem = elem.next;
-	    }
-	}
+        for (int i = 0; i < alternatives.size(); i++) {
+            Alternative alt = getAlternativeAt(i);
+            AlternativeElement elem = alt.head;
+            while (elem != null) {
+                if (elem instanceof RuleRefElement) {
+                    RuleRefElement rr = (RuleRefElement)elem;
+                    RuleSymbol rs = (RuleSymbol)g.getSymbol(rr.targetRule);
+                    if (rs == null) {
+                        grammar.tool.error("rule " + rr.targetRule + " referenced in (...)=>, but not defined");
+                    } else {
+                        rs.references.removeElement(rr);
+                    }
+                } else if (elem instanceof AlternativeBlock) { // recurse into subrules
+                    ((AlternativeBlock)elem).removeTrackingOfRuleRefs(g);
+                }
+                elem = elem.next;
+            }
+        }
     }
+
     public void setAlternatives(Vector v) {
-	alternatives = v;
+        alternatives = v;
     }
+
     public void setAutoGen(boolean doAutoGen_) {
-	doAutoGen = doAutoGen_;
+        doAutoGen = doAutoGen_;
     }
+
     public void setInitAction(String initAction_) {
-	initAction = initAction_;
+        initAction = initAction_;
     }
+
     public void setLabel(String label_) {
-	label = label_;
+        label = label_;
     }
 
     public void setOption(Token key, Token value) {
-	if (key.getText().equals("warnWhenFollowAmbig")) {
-	    if (value.getText().equals("true")) {
-		warnWhenFollowAmbig = true;
-	    } else if (value.getText().equals("false")) {
-		warnWhenFollowAmbig = false;
-	    } else {
-		grammar.tool.error("Value for warnWhenFollowAmbig must be true or false", grammar.getFilename(), key.getLine());
-	    }
-	}
-	else if (key.getText().equals("generateAmbigWarnings")) {
-	    if (value.getText().equals("true")) {
-		generateAmbigWarnings = true;
-	    } else if (value.getText().equals("false")) {
-		generateAmbigWarnings = false;
-	    } else {
-		grammar.tool.error("Value for generateAmbigWarnings must be true or false", grammar.getFilename(), key.getLine());
-	    }
-	}
-	else if (key.getText().equals("greedy")) {
-	    if (value.getText().equals("true")) {
-		greedy = true;
-		greedySet = true;
-	    } else if (value.getText().equals("false")) {
-		greedy = false;
-		greedySet = true;
-	    } else {
-		grammar.tool.error("Value for greedy must be true or false", grammar.getFilename(), key.getLine());
-	    }
-	}
-	else {
-	    grammar.tool.error("Invalid subrule option: " + key.getText(), grammar.getFilename(), key.getLine());
-	}
+        if (key.getText().equals("warnWhenFollowAmbig")) {
+            if (value.getText().equals("true")) {
+                warnWhenFollowAmbig = true;
+            } else if (value.getText().equals("false")) {
+                warnWhenFollowAmbig = false;
+            } else {
+                grammar.tool.error("Value for warnWhenFollowAmbig must be true or false", grammar.getFilename(), key.getLine());
+            }
+        } else if (key.getText().equals("generateAmbigWarnings")) {
+            if (value.getText().equals("true")) {
+                generateAmbigWarnings = true;
+            } else if (value.getText().equals("false")) {
+                generateAmbigWarnings = false;
+            } else {
+                grammar.tool.error("Value for generateAmbigWarnings must be true or false", grammar.getFilename(), key.getLine());
+            }
+        } else if (key.getText().equals("greedy")) {
+            if (value.getText().equals("true")) {
+                greedy = true;
+                greedySet = true;
+            } else if (value.getText().equals("false")) {
+                greedy = false;
+                greedySet = true;
+            } else {
+                grammar.tool.error("Value for greedy must be true or false", grammar.getFilename(), key.getLine());
+            }
+        } else {
+            grammar.tool.error("Invalid subrule option: " + key.getText(), grammar.getFilename(), key.getLine());
+        }
     }
 
     public String toString() {
-	String s=" (";
-	if ( initAction!=null ) {
-	    s += initAction;
-	}
-	for (int i=0; i<alternatives.size(); i++) {
-	    Alternative alt = getAlternativeAt(i);
-	    Lookahead cache[] = alt.cache;
-	    int k = alt.lookaheadDepth;
-	    // dump lookahead set
-	    if ( k==GrammarAnalyzer.LOOKAHEAD_DEPTH_INIT ) {
-	    }
-	    else if ( k==GrammarAnalyzer.NONDETERMINISTIC ) {
-		s += "{?}:";
-	    }
-	    else {
-		s += " {";
-		for (int j=1; j<=k; j++) {
-		    s += cache[j].toString(",",grammar.tokenManager.getVocabulary());
-		    if ( j<k && cache[j+1]!=null ) s += ";";
-		}
-		s += "}:";
-	    }
-	    // dump alternative including pred (if any)
-	    AlternativeElement p = alt.head;
-	    String pred = alt.semPred;
-	    if ( pred!=null ) {
-		s += pred;
-	    }
-	    while (p!=null ) {
-		s += p;
-		p = p.next;
-	    }
-	    if ( i<(alternatives.size()-1) ) {
-		s += " |";
-	    }
-	}
-	s += " )";
-	return s;
+        String s = " (";
+        if (initAction != null) {
+            s += initAction;
+        }
+        for (int i = 0; i < alternatives.size(); i++) {
+            Alternative alt = getAlternativeAt(i);
+            Lookahead cache[] = alt.cache;
+            int k = alt.lookaheadDepth;
+            // dump lookahead set
+            if (k == GrammarAnalyzer.LOOKAHEAD_DEPTH_INIT) {
+            } else if (k == GrammarAnalyzer.NONDETERMINISTIC) {
+                s += "{?}:";
+            } else {
+                s += " {";
+                for (int j = 1; j <= k; j++) {
+                    s += cache[j].toString(",", grammar.tokenManager.getVocabulary());
+                    if (j < k && cache[j + 1] != null) s += ";";
+                }
+                s += "}:";
+            }
+            // dump alternative including pred (if any)
+            AlternativeElement p = alt.head;
+            String pred = alt.semPred;
+            if (pred != null) {
+                s += pred;
+            }
+            while (p != null) {
+                s += p;
+                p = p.next;
+            }
+            if (i < (alternatives.size() - 1)) {
+                s += " |";
+            }
+        }
+        s += " )";
+        return s;
     }
 
 }



1.4       +25 -18    e/src/jsrc/antlr/AlternativeElement.java

Index: AlternativeElement.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/AlternativeElement.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AlternativeElement.java	2001/10/26 03:08:50	1.3
+++ AlternativeElement.java	2001/12/02 06:01:28	1.4
@@ -4,28 +4,35 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: AlternativeElement.java,v 1.3 2001/10/26 03:08:50 markm Exp $
+ * $Id: AlternativeElement.java,v 1.4 2001/12/02 06:01:28 markm Exp $
  */
 
 abstract class AlternativeElement extends GrammarElement {
-	AlternativeElement next;
-	protected int autoGenType = AUTO_GEN_NONE;
 
-	protected String enclosingRuleName;
+    AlternativeElement next;
 
+    protected int autoGenType = AUTO_GEN_NONE;
 
-	public AlternativeElement(Grammar g) {
-		super(g);
-	}
-	public AlternativeElement(Grammar g, int autoGenType_) {
-		super(g);
-		autoGenType = autoGenType_;
-	}
-	public int getAutoGenType() {
-		return autoGenType;
-	}
-	public String getLabel() {
-		return null;
-	}
-	public void setLabel(String label) {}
+    protected String enclosingRuleName;
+
+
+    public AlternativeElement(Grammar g) {
+        super(g);
+    }
+
+    public AlternativeElement(Grammar g, int autoGenType_) {
+        super(g);
+        autoGenType = autoGenType_;
+    }
+
+    public int getAutoGenType() {
+        return autoGenType;
+    }
+
+    public String getLabel() {
+        return null;
+    }
+
+    public void setLabel(String label) {
+    }
 }



1.5       +292 -272  e/src/jsrc/antlr/BaseAST.java

Index: BaseAST.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/BaseAST.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BaseAST.java	2001/11/29 20:33:25	1.4
+++ BaseAST.java	2001/12/02 06:01:28	1.5
@@ -4,7 +4,7 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: BaseAST.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: BaseAST.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 import antlr.collections.AST;
@@ -42,153 +42,153 @@
  * BaseAST or of CommonAST.
  */
 public abstract class BaseAST implements AST, Serializable {
+
     protected BaseAST down;
+
     protected BaseAST right;
 
     private static boolean verboseStringConversion = false;
+
     private static String[] tokenNames = null;
 
     /**Add a node to the end of the child list for this node */
     public void addChild(AST node) {
-	if ( node==null ) return;
-	BaseAST t = this.down;
-	if ( t!=null ) {
-	    while ( t.right!=null ) {
-		t = t.right;
-	    }
-	    t.right = (BaseAST)node;
-	}
-	else {
-	    this.down = (BaseAST)node;
-	}
+        if (node == null) return;
+        BaseAST t = this.down;
+        if (t != null) {
+            while (t.right != null) {
+                t = t.right;
+            }
+            t.right = (BaseAST)node;
+        } else {
+            this.down = (BaseAST)node;
+        }
     }
 
     private void doWorkForFindAll(Vector v, AST target, boolean partialMatch) {
-	AST sibling;
+        AST sibling;
 
-	// Start walking sibling lists, looking for matches.
-    siblingWalk:
-	for (sibling=this;
-	     sibling!=null;
-	     sibling=sibling.getNextSibling())
-	    {
-		if ( (partialMatch && sibling.equalsTreePartial(target)) ||
-		     (!partialMatch && sibling.equalsTree(target)) ) {
-		    v.appendElement(sibling);
-		}
-		// regardless of match or not, check any children for matches
-		if ( sibling.getFirstChild()!=null ) {
-		    ((BaseAST)sibling.getFirstChild()).doWorkForFindAll(v, target, partialMatch);
-		}
-	    }
+        // Start walking sibling lists, looking for matches.
+        siblingWalk:
+            for (sibling = this;
+                 sibling != null;
+                 sibling = sibling.getNextSibling()) {
+                if ((partialMatch && sibling.equalsTreePartial(target)) ||
+                  (!partialMatch && sibling.equalsTree(target))) {
+                    v.appendElement(sibling);
+                }
+                // regardless of match or not, check any children for matches
+                if (sibling.getFirstChild() != null) {
+                    ((BaseAST)sibling.getFirstChild()).doWorkForFindAll(v, target, partialMatch);
+                }
+            }
     }
 
     /** Is node t equal to this in terms of token type and text? */
     public boolean equals(AST t) {
-	if ( t==null ) return false;
-	return this.getText().equals(t.getText()) &&
-	    this.getType() == t.getType();
+        if (t == null) return false;
+        return this.getText().equals(t.getText()) &&
+          this.getType() == t.getType();
     }
 
     /** Is t an exact structural and equals() match of this tree.  The
- *  'this' reference is considered the start of a sibling list.
- */
+     *  'this' reference is considered the start of a sibling list.
+     */
     public boolean equalsList(AST t) {
-	AST sibling;
+        AST sibling;
 
-	// the empty tree is not a match of any non-null tree.
-	if (t == null) {
-	    return false;
-	}
-
-	// Otherwise, start walking sibling lists.  First mismatch, return false.
-	for (sibling = this; sibling != null && t != null; sibling = sibling.getNextSibling(), t = t.getNextSibling()) {
-	    // as a quick optimization, check roots first.
-	    if (!sibling.equals(t)) {
-		return false;
-	    }
-	    // if roots match, do full list match test on children.
-	    if (sibling.getFirstChild() != null) {
-		if (!sibling.getFirstChild().equalsList(t.getFirstChild())) {
-		    return false;
-		}
-	    }
-	    // sibling has no kids, make sure t doesn't either
-	    else if (t.getFirstChild() != null) {
-		return false;
-	    }
-	}
-	if (sibling == null && t == null) {
-	    return true;
-	}
-	// one sibling list has more than the other
-	return false;
+        // the empty tree is not a match of any non-null tree.
+        if (t == null) {
+            return false;
+        }
+
+        // Otherwise, start walking sibling lists.  First mismatch, return false.
+        for (sibling = this; sibling != null && t != null; sibling = sibling.getNextSibling(), t = t.getNextSibling()) {
+            // as a quick optimization, check roots first.
+            if (!sibling.equals(t)) {
+                return false;
+            }
+            // if roots match, do full list match test on children.
+            if (sibling.getFirstChild() != null) {
+                if (!sibling.getFirstChild().equalsList(t.getFirstChild())) {
+                    return false;
+                }
+            }
+            // sibling has no kids, make sure t doesn't either
+            else if (t.getFirstChild() != null) {
+                return false;
+            }
+        }
+        if (sibling == null && t == null) {
+            return true;
+        }
+        // one sibling list has more than the other
+        return false;
     }
 
     /** Is 'sub' a subtree of this list?
      *  The siblings of the root are NOT ignored.
      */
     public boolean equalsListPartial(AST sub) {
-	AST sibling;
+        AST sibling;
 
-	// the empty tree is always a subset of any tree.
-	if ( sub==null ) {
-	    return true;
-	}
-
-	// Otherwise, start walking sibling lists.  First mismatch, return false.
-	for (sibling=this;
-	     sibling!=null&&sub!=null;
-	     sibling=sibling.getNextSibling(), sub=sub.getNextSibling())
-	    {
-		// as a quick optimization, check roots first.
-		if ( !sibling.equals(sub) ) return false;
-		// if roots match, do partial list match test on children.
-		if ( sibling.getFirstChild()!=null ) {
-		    if ( !sibling.getFirstChild().equalsListPartial(sub.getFirstChild()) ) return false;
-		}
-	    }
-	if ( sibling==null && sub!=null ) {
-	    // nothing left to match in this tree, but subtree has more
-	    return false;
-	}
-	// either both are null or sibling has more, but subtree doesn't
-	return true;
+        // the empty tree is always a subset of any tree.
+        if (sub == null) {
+            return true;
+        }
+
+        // Otherwise, start walking sibling lists.  First mismatch, return false.
+        for (sibling = this;
+             sibling != null && sub != null;
+             sibling = sibling.getNextSibling(), sub = sub.getNextSibling()) {
+            // as a quick optimization, check roots first.
+            if (!sibling.equals(sub)) return false;
+            // if roots match, do partial list match test on children.
+            if (sibling.getFirstChild() != null) {
+                if (!sibling.getFirstChild().equalsListPartial(sub.getFirstChild())) return false;
+            }
+        }
+        if (sibling == null && sub != null) {
+            // nothing left to match in this tree, but subtree has more
+            return false;
+        }
+        // either both are null or sibling has more, but subtree doesn't
+        return true;
     }
 
     /** Is tree rooted at 'this' equal to 't'?  The siblings
      *  of 'this' are ignored.
      */
     public boolean equalsTree(AST t) {
-	// check roots first.
-	if ( !this.equals(t) ) return false;
-	// if roots match, do full list match test on children.
-	if ( this.getFirstChild()!=null ) {
-	    if ( !this.getFirstChild().equalsList(t.getFirstChild()) ) return false;
-	}
-	// sibling has no kids, make sure t doesn't either
-	else if (t.getFirstChild() != null) {
-	    return false;
-	}
-	return true;
+        // check roots first.
+        if (!this.equals(t)) return false;
+        // if roots match, do full list match test on children.
+        if (this.getFirstChild() != null) {
+            if (!this.getFirstChild().equalsList(t.getFirstChild())) return false;
+        }
+        // sibling has no kids, make sure t doesn't either
+        else if (t.getFirstChild() != null) {
+            return false;
+        }
+        return true;
     }
 
     /** Is 't' a subtree of the tree rooted at 'this'?  The siblings
      *  of 'this' are ignored.
      */
     public boolean equalsTreePartial(AST sub) {
-	// the empty tree is always a subset of any tree.
-	if ( sub==null ) {
-	    return true;
-	}
-
-	// check roots first.
-	if ( !this.equals(sub) ) return false;
-	// if roots match, do full list partial match test on children.
-	if ( this.getFirstChild()!=null ) {
-	    if ( !this.getFirstChild().equalsListPartial(sub.getFirstChild()) ) return false;
-	}
-	return true;
+        // the empty tree is always a subset of any tree.
+        if (sub == null) {
+            return true;
+        }
+
+        // check roots first.
+        if (!this.equals(sub)) return false;
+        // if roots match, do full list partial match test on children.
+        if (this.getFirstChild() != null) {
+            if (!this.getFirstChild().equalsListPartial(sub.getFirstChild())) return false;
+        }
+        return true;
     }
 
     /** Walk the tree looking for all exact subtree matches.  Return
@@ -196,17 +196,17 @@
      *  of subtree roots found herein.
      */
     public ASTEnumeration findAll(AST target) {
-	Vector roots = new Vector(10);
-	AST sibling;
+        Vector roots = new Vector(10);
+        AST sibling;
 
-	// the empty tree cannot result in an enumeration
-	if ( target==null ) {
-	    return null;
-	}
+        // the empty tree cannot result in an enumeration
+        if (target == null) {
+            return null;
+        }
 
-	doWorkForFindAll(roots, target, false);  // find all matches recursively
+        doWorkForFindAll(roots, target, false);  // find all matches recursively
 
-	return new ASTEnumerator(roots);
+        return new ASTEnumerator(roots);
     }
 
     /** Walk the tree looking for all subtrees.  Return
@@ -214,34 +214,38 @@
      *  of subtree roots found herein.
      */
     public ASTEnumeration findAllPartial(AST sub) {
-	Vector roots = new Vector(10);
-	AST sibling;
+        Vector roots = new Vector(10);
+        AST sibling;
 
-	// the empty tree cannot result in an enumeration
-	if ( sub==null ) {
-	    return null;
-	}
+        // the empty tree cannot result in an enumeration
+        if (sub == null) {
+            return null;
+        }
 
-	doWorkForFindAll(roots, sub, true);  // find all matches recursively
+        doWorkForFindAll(roots, sub, true);  // find all matches recursively
 
-	return new ASTEnumerator(roots);
+        return new ASTEnumerator(roots);
     }
 
     /** Get the first child of this node; null if not children */
     public AST getFirstChild() {
-	return down;
+        return down;
     }
 
     /** Get the next sibling in line after this one */
     public AST getNextSibling() {
-	return right;
+        return right;
     }
 
     /** Get the token text for this node */
-    public String getText() { return ""; }
+    public String getText() {
+        return "";
+    }
 
     /** Get the token type for this node */
-    public int getType() { return 0; }
+    public int getType() {
+        return 0;
+    }
 
     public abstract void initialize(int t, String txt);
 
@@ -249,183 +253,199 @@
 
     public abstract void initialize(Token t);
 
-	/** Remove all children */
+    /** Remove all children */
     public void removeChildren() {
-	down = null;
+        down = null;
     }
 
     public void setFirstChild(AST c) {
-	down = (BaseAST)c;
+        down = (BaseAST)c;
     }
 
     public void setNextSibling(AST n) {
-	right = (BaseAST)n;
+        right = (BaseAST)n;
     }
 
     /** Set the token text for this node */
-    public void setText(String text) {;}
+    public void setText(String text) {
+        ;
+    }
 
     /** Set the token type for this node */
-    public void setType(int ttype) {;}
+    public void setType(int ttype) {
+        ;
+    }
 
     public static void setVerboseStringConversion(boolean verbose, String[] names) {
-	verboseStringConversion = verbose;
-	tokenNames = names;
+        verboseStringConversion = verbose;
+        tokenNames = names;
     }
 
     public String toString() {
-	StringBuffer b = new StringBuffer();
-	// if verbose and type name not same as text (keyword probably)
-	if ( verboseStringConversion &&
-	     !getText().equalsIgnoreCase(tokenNames[getType()]) &&
-	     !getText().equalsIgnoreCase(Tool.stripFrontBack(tokenNames[getType()],"\"","\"")) ) {
-	    b.append('[');
-	    b.append(getText());
-	    b.append(",<");
-	    b.append(tokenNames[getType()]);
-	    b.append(">]");
-	    return b.toString();
-	}
-	return getText();
+        StringBuffer b = new StringBuffer();
+        // if verbose and type name not same as text (keyword probably)
+        if (verboseStringConversion &&
+          !getText().equalsIgnoreCase(tokenNames[getType()]) &&
+          !getText().equalsIgnoreCase(Tool.stripFrontBack(tokenNames[getType()], "\"", "\""))) {
+            b.append('[');
+            b.append(getText());
+            b.append(",<");
+            b.append(tokenNames[getType()]);
+            b.append(">]");
+            return b.toString();
+        }
+        return getText();
     }
 
     /** Print out a child-sibling tree in LISP notation */
     public String toStringList() {
-	AST t = this;
-	String ts="";
-	if ( t.getFirstChild()!=null ) ts+=" (";
-	ts += " "+this.toString();
-	if ( t.getFirstChild()!=null ) {
-	    ts += ((BaseAST)t.getFirstChild()).toStringList();
-	}
-	if ( t.getFirstChild()!=null ) ts+=" )";
-	if ( t.getNextSibling()!=null ) {
-	    ts += ((BaseAST)t.getNextSibling()).toStringList();
-	}
-	return ts;
+        AST t = this;
+        String ts = "";
+        if (t.getFirstChild() != null) ts += " (";
+        ts += " " + this.toString();
+        if (t.getFirstChild() != null) {
+            ts += ((BaseAST)t.getFirstChild()).toStringList();
+        }
+        if (t.getFirstChild() != null) ts += " )";
+        if (t.getNextSibling() != null) {
+            ts += ((BaseAST)t.getNextSibling()).toStringList();
+        }
+        return ts;
     }
 
     public String toStringTree() {
-	AST t = this;
-	String ts="";
-	if ( t.getFirstChild()!=null ) ts+=" (";
-	ts += " "+this.toString();
-	if ( t.getFirstChild()!=null ) {
-	    ts += ((BaseAST)t.getFirstChild()).toStringList();
-	}
-	if ( t.getFirstChild()!=null ) ts+=" )";
-	return ts;
-    }
-
-    public static String decode(String text)
-    {
-	char c, c1, c2, c3, c4, c5;
-	StringBuffer n = new StringBuffer();
-	for (int i=0; i < text.length(); i++)
-	    {
-		c = text.charAt(i);
-		if (c == '&') {
-		    c1 = text.charAt(i+1); c2 = text.charAt(i+2);
-		    c3 = text.charAt(i+3); c4 = text.charAt(i+4);
-		    c5 = text.charAt(i+5);
-
-		    if ( c1 == 'a' && c2 == 'm' && c3 == 'p' && c4 == ';') {
-			n.append("&");
-			i += 5;
-		    }
-		    else if ( c1 == 'l' && c2 == 't' && c3 == ';') {
-			n.append("<");
-			i += 4;
-		    }
-		    else if ( c1 == 'g' && c2 == 't' && c3 == ';') {
-			n.append(">");
-			i += 4;
-		    }
-		    else if ( c1 == 'q' && c2 == 'u' && c3 == 'o' &&
-			      c4 == 't' && c5 == ';') {
-			n.append("\"");
-			i += 6;
-		    }
-		    else if ( c1 == 'a' && c2 == 'p' && c3 == 'o' &&
-			      c4 == 's' && c5 == ';') {
-			n.append("'");
-			i += 6;
-		    }
-		    else n.append("&");
-		}
-		else n.append(c);
-	    }
-	return new String(n);
-    }
-
-    public static String encode(String text)
-    {
-	char c;
-	StringBuffer n = new StringBuffer();
-	for (int i=0; i < text.length(); i++)
-	    {
-		c = text.charAt(i);
-		switch (c) {
-		case '&' : { n.append("&amp;"); break; }
-		case '<' : { n.append("&lt;"); break; }
-		case '>' : { n.append("&gt;"); break; }
-		case '"' : { n.append("&quot;"); break; }
-		case '\'' : { n.append("&apos;"); break; }
-		default : { n.append(c); break; }
-		}
-	    }
-	return new String(n);
+        AST t = this;
+        String ts = "";
+        if (t.getFirstChild() != null) ts += " (";
+        ts += " " + this.toString();
+        if (t.getFirstChild() != null) {
+            ts += ((BaseAST)t.getFirstChild()).toStringList();
+        }
+        if (t.getFirstChild() != null) ts += " )";
+        return ts;
+    }
+
+    public static String decode(String text) {
+        char c, c1, c2, c3, c4, c5;
+        StringBuffer n = new StringBuffer();
+        for (int i = 0; i < text.length(); i++) {
+            c = text.charAt(i);
+            if (c == '&') {
+                c1 = text.charAt(i + 1);
+                c2 = text.charAt(i + 2);
+                c3 = text.charAt(i + 3);
+                c4 = text.charAt(i + 4);
+                c5 = text.charAt(i + 5);
+
+                if (c1 == 'a' && c2 == 'm' && c3 == 'p' && c4 == ';') {
+                    n.append("&");
+                    i += 5;
+                } else if (c1 == 'l' && c2 == 't' && c3 == ';') {
+                    n.append("<");
+                    i += 4;
+                } else if (c1 == 'g' && c2 == 't' && c3 == ';') {
+                    n.append(">");
+                    i += 4;
+                } else if (c1 == 'q' && c2 == 'u' && c3 == 'o' &&
+                  c4 == 't' && c5 == ';') {
+                    n.append("\"");
+                    i += 6;
+                } else if (c1 == 'a' && c2 == 'p' && c3 == 'o' &&
+                  c4 == 's' && c5 == ';') {
+                    n.append("'");
+                    i += 6;
+                } else
+                    n.append("&");
+            } else
+                n.append(c);
+        }
+        return new String(n);
+    }
+
+    public static String encode(String text) {
+        char c;
+        StringBuffer n = new StringBuffer();
+        for (int i = 0; i < text.length(); i++) {
+            c = text.charAt(i);
+            switch (c) {
+                case '&':
+                    {
+                        n.append("&amp;");
+                        break;
+                    }
+                case '<':
+                    {
+                        n.append("&lt;");
+                        break;
+                    }
+                case '>':
+                    {
+                        n.append("&gt;");
+                        break;
+                    }
+                case '"':
+                    {
+                        n.append("&quot;");
+                        break;
+                    }
+                case '\'':
+                    {
+                        n.append("&apos;");
+                        break;
+                    }
+                default :
+                    {
+                        n.append(c);
+                        break;
+                    }
+            }
+        }
+        return new String(n);
     }
 
     public void xmlSerializeNode(Writer out)
-	throws IOException
-    {
-	StringBuffer buf = new StringBuffer(100);
-	buf.append("<");
-	buf.append(getClass().getName()+" ");
-	buf.append("text=\""+encode(getText())+"\" type=\""+
-		   getType()+"\"/>");
-	out.write(buf.toString());
+      throws IOException {
+        StringBuffer buf = new StringBuffer(100);
+        buf.append("<");
+        buf.append(getClass().getName() + " ");
+        buf.append("text=\"" + encode(getText()) + "\" type=\"" +
+                   getType() + "\"/>");
+        out.write(buf.toString());
     }
 
     public void xmlSerializeRootOpen(Writer out)
-	throws IOException
-    {
-	StringBuffer buf = new StringBuffer(100);
-	buf.append("<");
-	buf.append(getClass().getName()+" ");
-	buf.append("text=\""+encode(getText())+"\" type=\""+
-		   getType()+"\">\n");
-	out.write(buf.toString());
+      throws IOException {
+        StringBuffer buf = new StringBuffer(100);
+        buf.append("<");
+        buf.append(getClass().getName() + " ");
+        buf.append("text=\"" + encode(getText()) + "\" type=\"" +
+                   getType() + "\">\n");
+        out.write(buf.toString());
     }
 
     public void xmlSerializeRootClose(Writer out)
-	throws IOException
-    {
-	out.write("</"+getClass().getName()+">\n");
-    }
-
-    public void xmlSerialize(Writer out) throws IOException
-    {
-	// print out this node and all siblings
-	for (AST node = this;
-	     node != null;
-	     node = node.getNextSibling())
-	{
-	    if (node.getFirstChild() == null) {
-		// print guts (class name, attributes)
-		((BaseAST)node).xmlSerializeNode(out);
-	    }
-	    else {
-		((BaseAST)node).xmlSerializeRootOpen(out);
-
-		// print children
-		((BaseAST)node.getFirstChild()).xmlSerialize(out);
-
-		// print end tag
-		((BaseAST)node).xmlSerializeRootClose(out);
-	    }
-	}
+      throws IOException {
+        out.write("</" + getClass().getName() + ">\n");
+    }
+
+    public void xmlSerialize(Writer out) throws IOException {
+        // print out this node and all siblings
+        for (AST node = this;
+             node != null;
+             node = node.getNextSibling()) {
+            if (node.getFirstChild() == null) {
+                // print guts (class name, attributes)
+                ((BaseAST)node).xmlSerializeNode(out);
+            } else {
+                ((BaseAST)node).xmlSerializeRootOpen(out);
+
+                // print children
+                ((BaseAST)node.getFirstChild()).xmlSerialize(out);
+
+                // print end tag
+                ((BaseAST)node).xmlSerializeRootClose(out);
+            }
+        }
     }
 
 }



1.4       +18 -13    e/src/jsrc/antlr/BlockContext.java

Index: BlockContext.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/BlockContext.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BlockContext.java	2001/10/26 03:08:50	1.3
+++ BlockContext.java	2001/12/02 06:01:28	1.4
@@ -4,7 +4,7 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: BlockContext.java,v 1.3 2001/10/26 03:08:50 markm Exp $
+ * $Id: BlockContext.java,v 1.4 2001/12/02 06:01:28 markm Exp $
  */
 
 /**BlockContext stores the information needed when creating an
@@ -13,18 +13,23 @@
  * requires state such as "tail of current alternative."
  */
 class BlockContext {
-	AlternativeBlock block; // current block of alternatives
-	int altNum;				// which alt are we accepting 0..n-1
-	BlockEndElement blockEnd; // used if nested
 
+    AlternativeBlock block; // current block of alternatives
 
-	public void addAlternativeElement(AlternativeElement e) {
-		currentAlt().addElement(e);
-	}
-	public Alternative currentAlt() {
-		return (Alternative)block.alternatives.elementAt(altNum);
-	}
-	public AlternativeElement currentElement() {
-		return currentAlt().tail;
-	}
+    int altNum;				// which alt are we accepting 0..n-1
+
+    BlockEndElement blockEnd; // used if nested
+
+
+    public void addAlternativeElement(AlternativeElement e) {
+        currentAlt().addElement(e);
+    }
+
+    public Alternative currentAlt() {
+        return (Alternative)block.alternatives.elementAt(altNum);
+    }
+
+    public AlternativeElement currentElement() {
+        return currentAlt().tail;
+    }
 }



1.4       +18 -14    e/src/jsrc/antlr/BlockEndElement.java

Index: BlockEndElement.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/BlockEndElement.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BlockEndElement.java	2001/10/26 03:08:50	1.3
+++ BlockEndElement.java	2001/12/02 06:01:28	1.4
@@ -4,26 +4,30 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: BlockEndElement.java,v 1.3 2001/10/26 03:08:50 markm Exp $
+ * $Id: BlockEndElement.java,v 1.4 2001/12/02 06:01:28 markm Exp $
  */
 
 /**All alternative blocks are "terminated" by BlockEndElements unless
  * they are rule blocks (in which case they use RuleEndElement).
  */
 class BlockEndElement extends AlternativeElement {
-	protected boolean[] lock;	// for analysis; used to avoid infinite loops
-	protected AlternativeBlock block;// ending blocks know what block they terminate
 
+    protected boolean[] lock;	// for analysis; used to avoid infinite loops
 
-	public BlockEndElement(Grammar g) {
-		super(g);
-		lock = new boolean[g.maxk+1];
-	}
-	public Lookahead look(int k) {
-		return grammar.theLLkAnalyzer.look(k, this);
-	}
-	public String toString() {
-		//return " [BlkEnd]";
-		return "";
-	}
+    protected AlternativeBlock block;// ending blocks know what block they terminate
+
+
+    public BlockEndElement(Grammar g) {
+        super(g);
+        lock = new boolean[g.maxk + 1];
+    }
+
+    public Lookahead look(int k) {
+        return grammar.theLLkAnalyzer.look(k, this);
+    }
+
+    public String toString() {
+        //return " [BlkEnd]";
+        return "";
+    }
 }



1.4       +15 -12    e/src/jsrc/antlr/BlockWithImpliedExitPath.java

Index: BlockWithImpliedExitPath.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/BlockWithImpliedExitPath.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BlockWithImpliedExitPath.java	2001/10/26 03:08:50	1.3
+++ BlockWithImpliedExitPath.java	2001/12/02 06:01:28	1.4
@@ -4,21 +4,24 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: BlockWithImpliedExitPath.java,v 1.3 2001/10/26 03:08:50 markm Exp $
+ * $Id: BlockWithImpliedExitPath.java,v 1.4 2001/12/02 06:01:28 markm Exp $
  */
 
 abstract class BlockWithImpliedExitPath extends AlternativeBlock {
-	protected int exitLookaheadDepth;	// lookahead needed to handle optional path
-	/** lookahead to bypass block; set
-	 * by deterministic().  1..k of Lookahead
-	 */
-	protected Lookahead[] exitCache = new Lookahead[grammar.maxk+1];
 
+    protected int exitLookaheadDepth;	// lookahead needed to handle optional path
 
-	public BlockWithImpliedExitPath(Grammar g) {
-		super(g);
-	}
-public BlockWithImpliedExitPath(Grammar g, int line) {
-	super(g, line, false);
-}
+    /** lookahead to bypass block; set
+     * by deterministic().  1..k of Lookahead
+     */
+    protected Lookahead[] exitCache = new Lookahead[grammar.maxk + 1];
+
+
+    public BlockWithImpliedExitPath(Grammar g) {
+        super(g);
+    }
+
+    public BlockWithImpliedExitPath(Grammar g, int line) {
+        super(g, line, false);
+    }
 }



1.5       +15 -14    e/src/jsrc/antlr/ByteBuffer.java

Index: ByteBuffer.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/ByteBuffer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ByteBuffer.java	2001/11/29 20:33:25	1.4
+++ ByteBuffer.java	2001/12/02 06:01:28	1.5
@@ -4,7 +4,7 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: ByteBuffer.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: ByteBuffer.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 /**A Stream of characters fed to the lexer from a InputStream that can
@@ -20,10 +20,11 @@
  * @see antlr.CharQueue
  */
 // SAS: added this class to handle Binary input w/ FileInputStream
+
 import java.io.IOException;
 import java.io.InputStream;
 
-public class ByteBuffer extends InputBuffer{
+public class ByteBuffer extends InputBuffer {
 
     // char source
     transient InputStream input;
@@ -31,21 +32,21 @@
 
     /** Create a character buffer */
     public ByteBuffer(InputStream input_) {
-	super();
-	input = input_;
+        super();
+        input = input_;
     }
 
     /** Ensure that the character buffer is sufficiently full */
     public void fill(int amount) throws CharStreamException {
-	try {
-	    syncConsume();
-	    // Fill the buffer sufficiently to hold needed characters
-	    while (queue.nbrEntries < amount + markerOffset) {
-		// Append the next character
-		queue.append((char) input.read());
-	    }
-	} catch (IOException io) {
-	    throw new CharStreamIOException(io);
-	}
+        try {
+            syncConsume();
+            // Fill the buffer sufficiently to hold needed characters
+            while (queue.nbrEntries < amount + markerOffset) {
+                // Append the next character
+                queue.append((char)input.read());
+            }
+        } catch (IOException io) {
+            throw new CharStreamIOException(io);
+        }
     }
 }



1.5       +14 -13    e/src/jsrc/antlr/CharBuffer.java

Index: CharBuffer.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/CharBuffer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CharBuffer.java	2001/11/29 20:33:25	1.4
+++ CharBuffer.java	2001/12/02 06:01:28	1.5
@@ -4,7 +4,7 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: CharBuffer.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: CharBuffer.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 /**A Stream of characters fed to the lexer from a InputStream that can
@@ -26,26 +26,27 @@
 // SAS: Move most functionality into InputBuffer -- just the file-specific
 //      stuff is in here
 public class CharBuffer extends InputBuffer {
+
     // char source
     transient Reader input;
 
     /** Create a character buffer */
     public CharBuffer(Reader input_) { // SAS: for proper text i/o
-	super();
-	input = input_;
+        super();
+        input = input_;
     }
 
     /** Ensure that the character buffer is sufficiently full */
     public void fill(int amount) throws CharStreamException {
-	try {
-	    syncConsume();
-	    // Fill the buffer sufficiently to hold needed characters
-	    while (queue.nbrEntries < amount + markerOffset) {
-		// Append the next character
-		queue.append((char) input.read());
-	    }
-	} catch (IOException io) {
-	    throw new CharStreamIOException(io);
-	}
+        try {
+            syncConsume();
+            // Fill the buffer sufficiently to hold needed characters
+            while (queue.nbrEntries < amount + markerOffset) {
+                // Append the next character
+                queue.append((char)input.read());
+            }
+        } catch (IOException io) {
+            throw new CharStreamIOException(io);
+        }
     }
 }



1.4       +10 -7     e/src/jsrc/antlr/CharFormatter.java

Index: CharFormatter.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/CharFormatter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CharFormatter.java	2001/10/26 03:08:50	1.3
+++ CharFormatter.java	2001/12/02 06:01:28	1.4
@@ -4,17 +4,20 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: CharFormatter.java,v 1.3 2001/10/26 03:08:50 markm Exp $
+ * $Id: CharFormatter.java,v 1.4 2001/12/02 06:01:28 markm Exp $
  */
 
 /** Interface used by BitSet to format elements of the set when
-  * converting to string
-  */
+ * converting to string
+ */
 public interface CharFormatter {
 
+
+    public String escapeChar(int c, boolean forCharLiteral);
+
+    public String escapeString(String s);
+
+    public String literalChar(int c);
 
-	public String escapeChar(int c, boolean forCharLiteral);
-	public String escapeString(String s);
-	public String literalChar(int c);
-	public String literalString(String s);
+    public String literalString(String s);
 }



1.4       +17 -15    e/src/jsrc/antlr/CharLiteralElement.java

Index: CharLiteralElement.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/CharLiteralElement.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CharLiteralElement.java	2001/10/26 03:08:50	1.3
+++ CharLiteralElement.java	2001/12/02 06:01:28	1.4
@@ -4,24 +4,26 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: CharLiteralElement.java,v 1.3 2001/10/26 03:08:50 markm Exp $
+ * $Id: CharLiteralElement.java,v 1.4 2001/12/02 06:01:28 markm Exp $
  */
 
 class CharLiteralElement extends GrammarAtom {
 
 
-	public CharLiteralElement(LexerGrammar g, Token t, boolean inverted, int autoGenType) {
-		super(g, t, AUTO_GEN_NONE);
-		tokenType = ANTLRLexer.tokenTypeForCharLiteral(t.getText());
-		g.charVocabulary.add(tokenType);
-		line = t.getLine();
-		not = inverted;
-		this.autoGenType = autoGenType;
-	}
-	public void generate() {
-		grammar.generator.gen(this);
-	}
-	public Lookahead look(int k) {
-		return grammar.theLLkAnalyzer.look(k, this);
-	}
+    public CharLiteralElement(LexerGrammar g, Token t, boolean inverted, int autoGenType) {
+        super(g, t, AUTO_GEN_NONE);
+        tokenType = ANTLRLexer.tokenTypeForCharLiteral(t.getText());
+        g.charVocabulary.add(tokenType);
+        line = t.getLine();
+        not = inverted;
+        this.autoGenType = autoGenType;
+    }
+
+    public void generate() {
+        grammar.generator.gen(this);
+    }
+
+    public Lookahead look(int k) {
+        return grammar.theLLkAnalyzer.look(k, this);
+    }
 }



1.5       +74 -67    e/src/jsrc/antlr/CharQueue.java

Index: CharQueue.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/CharQueue.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CharQueue.java	2001/11/29 20:33:25	1.4
+++ CharQueue.java	2001/12/02 06:01:28	1.5
@@ -4,75 +4,82 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: CharQueue.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: CharQueue.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 /** A circular buffer object used by CharBuffer */
 public class CharQueue {
-	// Physical circular buffer of characters
-	protected char[] buffer;
-	// buffer.length-1 for quick modulous
-	protected int sizeLessOne;
-	// physical index of front token
-	protected int offset;
-	// number of characters in the queue
-	protected int nbrEntries;
-
-
-	public CharQueue(int minSize) {
-		// Find first power of 2 >= to requested size
-		int size;
-		for (size = 2; size < minSize; size *= 2) {;}
-		init(size);
-	}
-	/** Add token to end of the queue
-	 * @param tok The token to add
-	 */
-	public final void append(char tok)
-	{
-		if (nbrEntries == buffer.length)
-		{
-			expand();
-		}
-		buffer[(offset + nbrEntries) & sizeLessOne] = tok;
-		nbrEntries++;
-	}
-	/** Fetch a token from the queue by index
-	 * @param idx The index of the token to fetch, where zero is the token at the front of the queue
-	 */
-	public final char elementAt(int idx) {
-		return buffer[(offset + idx) & sizeLessOne];
-	}
-	/** Expand the token buffer by doubling its capacity */
-	private final void expand()
-	{
-		char[] newBuffer = new char[buffer.length * 2];
-		// Copy the contents to the new buffer
-		// Note that this will store the first logical item in the
-		// first physical array element.
-		for (int i = 0; i < buffer.length; i++)
-		{
-			newBuffer[i] = elementAt(i);
-		}
-		// Re-initialize with new contents, keep old nbrEntries
-		buffer = newBuffer;
-		sizeLessOne = buffer.length - 1;
-		offset = 0;
-	}
-	/** Initialize the queue.
-	 * @param size The initial size of the queue
-	 */
-	private final void init(int size) {
-		// Allocate buffer
-		buffer = new char[size];
-		// Other initialization
-		sizeLessOne = size - 1;
-		offset = 0;
-		nbrEntries = 0;
-	}
-	/** Remove char from front of queue */
-	public final void removeFirst() {
-		offset = (offset+1) & sizeLessOne;
-		nbrEntries--;
-	}
+
+    // Physical circular buffer of characters
+    protected char[] buffer;
+
+    // buffer.length-1 for quick modulous
+    protected int sizeLessOne;
+
+    // physical index of front token
+    protected int offset;
+
+    // number of characters in the queue
+    protected int nbrEntries;
+
+
+    public CharQueue(int minSize) {
+        // Find first power of 2 >= to requested size
+        int size;
+        for (size = 2; size < minSize; size *= 2) {
+            ;
+        }
+        init(size);
+    }
+
+    /** Add token to end of the queue
+     * @param tok The token to add
+     */
+    public final void append(char tok) {
+        if (nbrEntries == buffer.length) {
+            expand();
+        }
+        buffer[(offset + nbrEntries) & sizeLessOne] = tok;
+        nbrEntries++;
+    }
+
+    /** Fetch a token from the queue by index
+     * @param idx The index of the token to fetch, where zero is the token at the front of the queue
+     */
+    public final char elementAt(int idx) {
+        return buffer[(offset + idx) & sizeLessOne];
+    }
+
+    /** Expand the token buffer by doubling its capacity */
+    private final void expand() {
+        char[] newBuffer = new char[buffer.length * 2];
+        // Copy the contents to the new buffer
+        // Note that this will store the first logical item in the
+        // first physical array element.
+        for (int i = 0; i < buffer.length; i++) {
+            newBuffer[i] = elementAt(i);
+        }
+        // Re-initialize with new contents, keep old nbrEntries
+        buffer = newBuffer;
+        sizeLessOne = buffer.length - 1;
+        offset = 0;
+    }
+
+    /** Initialize the queue.
+     * @param size The initial size of the queue
+     */
+    private final void init(int size) {
+        // Allocate buffer
+        buffer = new char[size];
+        // Other initialization
+        sizeLessOne = size - 1;
+        offset = 0;
+        nbrEntries = 0;
+    }
+
+    /** Remove char from front of queue */
+    public final void removeFirst() {
+        offset = (offset + 1) & sizeLessOne;
+        nbrEntries--;
+    }
 }



1.5       +49 -37    e/src/jsrc/antlr/CharRangeElement.java

Index: CharRangeElement.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/CharRangeElement.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CharRangeElement.java	2001/11/29 20:33:25	1.4
+++ CharRangeElement.java	2001/12/02 06:01:28	1.5
@@ -4,44 +4,56 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: CharRangeElement.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: CharRangeElement.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 class CharRangeElement extends AlternativeElement {
-	String label;
-	protected char begin=0;
-	protected char end  =0;
-	protected String beginText;
-	protected String endText;
-
-
-	public CharRangeElement(LexerGrammar g, Token t1, Token t2, int autoGenType) {
-		super(g);
-		begin = (char)ANTLRLexer.tokenTypeForCharLiteral(t1.getText());
-		beginText = t1.getText();
-		end   = (char)ANTLRLexer.tokenTypeForCharLiteral(t2.getText());
-		endText = t2.getText();
-		line = t1.getLine();
-		// track which characters are referenced in the grammar
-		for (int i=begin; i<=end; i++) {
-			g.charVocabulary.add(i);
-		}
-		this.autoGenType = autoGenType;
-	}
-	public void generate() {
-		grammar.generator.gen(this);
-	}
-	public String getLabel() {
-		return label;
-	}
-	public Lookahead look(int k) {
-		return grammar.theLLkAnalyzer.look(k, this);
-	}
-	public void setLabel(String label_) {
-		label = label_;
-	}
-	public String toString() {
-		if ( label!=null ) return " "+label+":"+beginText+".."+endText;
-		else return " "+beginText+".."+endText;
-	}
+
+    String label;
+
+    protected char begin = 0;
+
+    protected char end = 0;
+
+    protected String beginText;
+
+    protected String endText;
+
+
+    public CharRangeElement(LexerGrammar g, Token t1, Token t2, int autoGenType) {
+        super(g);
+        begin = (char)ANTLRLexer.tokenTypeForCharLiteral(t1.getText());
+        beginText = t1.getText();
+        end = (char)ANTLRLexer.tokenTypeForCharLiteral(t2.getText());
+        endText = t2.getText();
+        line = t1.getLine();
+        // track which characters are referenced in the grammar
+        for (int i = begin; i <= end; i++) {
+            g.charVocabulary.add(i);
+        }
+        this.autoGenType = autoGenType;
+    }
+
+    public void generate() {
+        grammar.generator.gen(this);
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public Lookahead look(int k) {
+        return grammar.theLLkAnalyzer.look(k, this);
+    }
+
+    public void setLabel(String label_) {
+        label = label_;
+    }
+
+    public String toString() {
+        if (label != null)
+            return " " + label + ":" + beginText + ".." + endText;
+        else
+            return " " + beginText + ".." + endText;
+    }
 }



1.5       +192 -165  e/src/jsrc/antlr/CharScanner.java

Index: CharScanner.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/CharScanner.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CharScanner.java	2001/11/29 20:33:25	1.4
+++ CharScanner.java	2001/12/02 06:01:28	1.5
@@ -4,21 +4,29 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: CharScanner.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: CharScanner.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 import antlr.collections.impl.BitSet;
 
 import java.util.Hashtable;
+
 public abstract class CharScanner implements TokenStream {
+
     static final char NO_CHAR = 0;
-    public static final char EOF_CHAR = (char) - 1;
+
+    public static final char EOF_CHAR = (char)-1;
+
     protected ANTLRStringBuffer text; // text of current token
 
     protected boolean saveConsumedInput = true; // does consume() save characters?
+
     protected Class tokenObjectClass; // what kind of tokens to create?
+
     protected boolean caseSensitive = true;
+
     protected boolean caseSensitiveLiterals = true;
+
     protected Hashtable literals; // set by subclass
 
     protected Token _returnToken = null; // used to return tokens w/o using return val.
@@ -33,179 +41,192 @@
      *  acceptPath=true;
      */
     protected boolean commitToPath = false;
-	/** Used to keep track of indentdepth for traceIn/Out */
-	protected int traceDepth = 0;
 
+    /** Used to keep track of indentdepth for traceIn/Out */
+    protected int traceDepth = 0;
+
     public CharScanner() {
-	text = new ANTLRStringBuffer();
-	hashString = new ANTLRHashString(this);
-	setTokenObjectClass("antlr.CommonToken");
+        text = new ANTLRStringBuffer();
+        hashString = new ANTLRHashString(this);
+        setTokenObjectClass("antlr.CommonToken");
     }
 
     public CharScanner(InputBuffer cb) { // SAS: use generic buffer
-	this();
-	inputState = new LexerSharedInputState(cb);
+        this();
+        inputState = new LexerSharedInputState(cb);
     }
 
     public CharScanner(LexerSharedInputState sharedState) {
-	this();
-	inputState = sharedState;
+        this();
+        inputState = sharedState;
     }
 
     public void append(char c) {
-	if ( saveConsumedInput ) {
-	    text.append(c);
-	}
+        if (saveConsumedInput) {
+            text.append(c);
+        }
     }
 
     public void append(String s) {
-	if ( saveConsumedInput ) {
-	    text.append(s);
-	}
+        if (saveConsumedInput) {
+            text.append(s);
+        }
     }
 
     public void commit() {
-	inputState.input.commit();
+        inputState.input.commit();
     }
 
     public void consume() throws CharStreamException {
-	if (inputState.guessing == 0) {
-	    char c = LA(1);
-	    if (caseSensitive) {
-		append(c);
-	    } else {
-		// use input.LA(), not LA(), to get original case
-		// CharScanner.LA() would toLower it.
-		append(inputState.input.LA(1));
-	    }
-	    if ( c=='\t' ) {
-		tab();
-	    }
-	    else {
-		inputState.column++;
-	    }
-	}
-	inputState.input.consume();
+        if (inputState.guessing == 0) {
+            char c = LA(1);
+            if (caseSensitive) {
+                append(c);
+            } else {
+                // use input.LA(), not LA(), to get original case
+                // CharScanner.LA() would toLower it.
+                append(inputState.input.LA(1));
+            }
+            if (c == '\t') {
+                tab();
+            } else {
+                inputState.column++;
+            }
+        }
+        inputState.input.consume();
     }
 
     /** Consume chars until one matches the given char */
     public void consumeUntil(int c) throws CharStreamException {
-	while (LA(1) != EOF_CHAR && LA(1) != c)
-	    {
-		consume();
-	    }
+        while (LA(1) != EOF_CHAR && LA(1) != c) {
+            consume();
+        }
     }
 
     /** Consume chars until one matches the given set */
     public void consumeUntil(BitSet set) throws CharStreamException {
-	while (LA(1) != EOF_CHAR && !set.member(LA(1))) {
-	    consume();
-	}
+        while (LA(1) != EOF_CHAR && !set.member(LA(1))) {
+            consume();
+        }
     }
 
-    public boolean getCaseSensitive() { return caseSensitive; }
+    public boolean getCaseSensitive() {
+        return caseSensitive;
+    }
 
-    public final boolean getCaseSensitiveLiterals() { return caseSensitiveLiterals; }
+    public final boolean getCaseSensitiveLiterals() {
+        return caseSensitiveLiterals;
+    }
 
     public int getColumn() {
-	return inputState.column;
+        return inputState.column;
     }
 
     public void setColumn(int c) {
-	inputState.column = c;
+        inputState.column = c;
     }
 
-    public boolean getCommitToPath() { return commitToPath; }
+    public boolean getCommitToPath() {
+        return commitToPath;
+    }
 
-    public String getFilename() {return inputState.filename;}
+    public String getFilename() {
+        return inputState.filename;
+    }
 
     public InputBuffer getInputBuffer() {
-	return inputState.input;
+        return inputState.input;
     }
 
     public LexerSharedInputState getInputState() {
-	return inputState;
+        return inputState;
     }
 
     public void setInputState(LexerSharedInputState state) {
-	inputState = state;
+        inputState = state;
     }
 
-    public int getLine() { return inputState.line; }
+    public int getLine() {
+        return inputState.line;
+    }
 
     /** return a copy of the current text buffer */
     public String getText() {
-	return text.toString();
+        return text.toString();
     }
 
     public Token getTokenObject() {
-	return _returnToken;
+        return _returnToken;
     }
 
     public char LA(int i) throws CharStreamException {
-	if (caseSensitive) {
-	    return inputState.input.LA(i);
-	} else {
-	    return toLower(inputState.input.LA(i));
-	}
+        if (caseSensitive) {
+            return inputState.input.LA(i);
+        } else {
+            return toLower(inputState.input.LA(i));
+        }
     }
 
     protected Token makeToken(int t) {
-	try {
-	    Token tok = (Token)tokenObjectClass.newInstance();
-	    tok.setType(t);
-	    tok.setColumn(inputState.tokenStartColumn);
-	    tok.setLine(inputState.tokenStartLine);
-	    // tracking real start line now: tok.setLine(inputState.line);
-	    return tok;
-	}
-	catch (InstantiationException ie) {
-	    panic("can't instantiate token: "+tokenObjectClass);
-	}
-	catch (IllegalAccessException iae) {
-	    panic("Token class is not accessible"+tokenObjectClass);
-	}
-	return Token.badToken;
+        try {
+            Token tok = (Token)tokenObjectClass.newInstance();
+            tok.setType(t);
+            tok.setColumn(inputState.tokenStartColumn);
+            tok.setLine(inputState.tokenStartLine);
+            // tracking real start line now: tok.setLine(inputState.line);
+            return tok;
+        } catch (InstantiationException ie) {
+            panic("can't instantiate token: " + tokenObjectClass);
+        } catch (IllegalAccessException iae) {
+            panic("Token class is not accessible" + tokenObjectClass);
+        }
+        return Token.badToken;
     }
+
     public int mark() {
-	return inputState.input.mark();
+        return inputState.input.mark();
     }
+
     public void match(char c) throws MismatchedCharException, CharStreamException {
-	if ( LA(1) != c ) {
-	    throw new MismatchedCharException(LA(1), c, false, this);
-	}
-	consume();
+        if (LA(1) != c) {
+            throw new MismatchedCharException(LA(1), c, false, this);
+        }
+        consume();
     }
+
     public void match(BitSet b) throws MismatchedCharException, CharStreamException {
-	if ( !b.member(LA(1)) ) {
-	    throw new MismatchedCharException(LA(1), b, false, this);
-	} else {
-	    consume();
-	}
+        if (!b.member(LA(1))) {
+            throw new MismatchedCharException(LA(1), b, false, this);
+        } else {
+            consume();
+        }
     }
+
     public void match(String s) throws MismatchedCharException, CharStreamException {
-	int len = s.length();
-	for (int i=0; i<len; i++) {
-	    if ( LA(1) != s.charAt(i) ) {
-		throw new MismatchedCharException(LA(1), s.charAt(i), false, this);
-	    }
-	    consume();
-	}
+        int len = s.length();
+        for (int i = 0; i < len; i++) {
+            if (LA(1) != s.charAt(i)) {
+                throw new MismatchedCharException(LA(1), s.charAt(i), false, this);
+            }
+            consume();
+        }
     }
+
     public void matchNot(char c) throws MismatchedCharException, CharStreamException {
-	if ( LA(1) == c ) {
-	    throw new MismatchedCharException(LA(1), c, true, this);
-	}
-	consume();
+        if (LA(1) == c) {
+            throw new MismatchedCharException(LA(1), c, true, this);
+        }
+        consume();
     }
+
     public void matchRange(char c1, char c2) throws MismatchedCharException, CharStreamException {
-	if ( LA(1) < c1 || LA(1) > c2 ) throw new MismatchedCharException(LA(1), c1, c2, false, this);
-	consume();
+        if (LA(1) < c1 || LA(1) > c2) throw new MismatchedCharException(LA(1), c1, c2, false, this);
+        consume();
     }
 
     public void newline() {
-	inputState.line++;
-	inputState.column = 1;
+        inputState.line++;
+        inputState.column = 1;
     }
 
     /** advance the current column number by an appropriate amount.
@@ -214,89 +235,94 @@
      *  called from consume().
      */
     public void tab() {
-	// update inputState.column as function of
-	// inputState.column and tab stops.
-	// For example, if tab stops are columns 1 and 5 etc...
-	// and column is 3, then add 2 to column.
-	inputState.column++;
+        // update inputState.column as function of
+        // inputState.column and tab stops.
+        // For example, if tab stops are columns 1 and 5 etc...
+        // and column is 3, then add 2 to column.
+        inputState.column++;
     }
 
     public void panic() {
-	System.err.println("CharScanner: panic");
-	System.exit(1);
+        System.err.println("CharScanner: panic");
+        System.exit(1);
     }
 
     public void panic(String s) {
-	System.err.println("CharScanner; panic: "+s);
-	System.exit(1);
+        System.err.println("CharScanner; panic: " + s);
+        System.exit(1);
     }
 
     /** Parser error-reporting function can be overridden in subclass */
     public void reportError(RecognitionException ex) {
-	System.err.println(ex);
+        System.err.println(ex);
     }
 
     /** Parser error-reporting function can be overridden in subclass */
     public void reportError(String s) {
-	if ( getFilename()==null ) {
-	    System.err.println("error: " + s);
-	}
-	else {
-	    System.err.println(getFilename()+": error: " + s);
-	}
+        if (getFilename() == null) {
+            System.err.println("error: " + s);
+        } else {
+            System.err.println(getFilename() + ": error: " + s);
+        }
     }
 
     /** Parser warning-reporting function can be overridden in subclass */
     public void reportWarning(String s) {
-	if ( getFilename()==null ) {
-	    System.err.println("warning: "+s);
-	}
-	else {
-	    System.err.println(getFilename()+": warning: " + s);
-	}
+        if (getFilename() == null) {
+            System.err.println("warning: " + s);
+        } else {
+            System.err.println(getFilename() + ": warning: " + s);
+        }
     }
 
     public void resetText() {
-	text.setLength(0);
-	inputState.tokenStartColumn = inputState.column;
-	inputState.tokenStartLine = inputState.line;
+        text.setLength(0);
+        inputState.tokenStartColumn = inputState.column;
+        inputState.tokenStartLine = inputState.line;
     }
 
     public void rewind(int pos) {
-	inputState.input.rewind(pos);
+        inputState.input.rewind(pos);
     }
 
-    public void setCaseSensitive(boolean t) { caseSensitive = t; }
+    public void setCaseSensitive(boolean t) {
+        caseSensitive = t;
+    }
 
-    public void setCommitToPath(boolean commit) { commitToPath = commit; }
+    public void setCommitToPath(boolean commit) {
+        commitToPath = commit;
+    }
 
-    public void setFilename(String f) {inputState.filename=f;}
+    public void setFilename(String f) {
+        inputState.filename = f;
+    }
 
-    public void setLine(int line) { inputState.line = line; }
+    public void setLine(int line) {
+        inputState.line = line;
+    }
 
     public void setText(String s) {
-	resetText();
-	text.append(s);
+        resetText();
+        text.append(s);
     }
 
     public void setTokenObjectClass(String cl) {
-	try {
-	    tokenObjectClass = Class.forName(cl);
-	}
-	catch (ClassNotFoundException ce) {
-	    panic("ClassNotFoundException: "+cl);
-	}
+        try {
+            tokenObjectClass = Class.forName(cl);
+        } catch (ClassNotFoundException ce) {
+            panic("ClassNotFoundException: " + cl);
+        }
     }
 
     // Test the token text against the literals table
     // Override this method to perform a different literals test
     public int testLiteralsTable(int ttype) {
-	hashString.setBuffer(text.getBuffer(), text.length());
-	Integer literalsIndex = (Integer)literals.get(hashString);
-	if (literalsIndex != null) {
-	    ttype = literalsIndex.intValue();
-	}
-	return ttype;
+        hashString.setBuffer(text.getBuffer(), text.length());
+        Integer literalsIndex = (Integer)literals.get(hashString);
+        if (literalsIndex != null) {
+            ttype = literalsIndex.intValue();
+        }
+        return ttype;
     }
 
     /** Test the text passed in against the literals table
@@ -305,34 +331,35 @@
      * a token.
      */
     public int testLiteralsTable(String text, int ttype) {
-	ANTLRHashString s = new ANTLRHashString(text, this);
-	Integer literalsIndex = (Integer)literals.get(s);
-	if (literalsIndex != null) {
-	    ttype = literalsIndex.intValue();
-	}
-	return ttype;
+        ANTLRHashString s = new ANTLRHashString(text, this);
+        Integer literalsIndex = (Integer)literals.get(s);
+        if (literalsIndex != null) {
+            ttype = literalsIndex.intValue();
+        }
+        return ttype;
     }
 
     // Override this method to get more specific case handling
     public char toLower(char c) {
-	return Character.toLowerCase(c);
+        return Character.toLowerCase(c);
+    }
+
+    public void traceIndent() {
+        for (int i = 0; i < traceDepth; i++)
+            System.out.print(" ");
     }
 
-	public void traceIndent() {
-		for( int i = 0; i < traceDepth; i++ )
-			System.out.print(" ");
-	}
-	public void traceIn(String rname) throws CharStreamException {
-		traceDepth += 1;
-		traceIndent();
-		System.out.println("> lexer "+rname+"; c==" + LA(1));
-	}
-
-	public void traceOut(String rname) throws CharStreamException {
-		traceIndent();
-		System.out.println("< lexer "+rname+"; c==" + LA(1));
-		traceDepth -= 1;
-	}
+    public void traceIn(String rname) throws CharStreamException {
+        traceDepth += 1;
+        traceIndent();
+        System.out.println("> lexer " + rname + "; c==" + LA(1));
+    }
+
+    public void traceOut(String rname) throws CharStreamException {
+        traceIndent();
+        System.out.println("< lexer " + rname + "; c==" + LA(1));
+        traceDepth -= 1;
+    }
 
     /** This method is called by YourLexer.nextToken() when the lexer has
      *  hit EOF condition.  EOF is NOT a character.



1.4       +3 -2      e/src/jsrc/antlr/CharStreamException.java

Index: CharStreamException.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/CharStreamException.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CharStreamException.java	2001/10/26 03:08:50	1.3
+++ CharStreamException.java	2001/12/02 06:01:28	1.4
@@ -4,18 +4,19 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: CharStreamException.java,v 1.3 2001/10/26 03:08:50 markm Exp $
+ * $Id: CharStreamException.java,v 1.4 2001/12/02 06:01:28 markm Exp $
  */
 
 /**
  * Anything that goes wrong while generating a stream of characters
  */
 public class CharStreamException extends ANTLRException {
+
     /**
      * CharStreamException constructor comment.
      * @param s java.lang.String
      */
     public CharStreamException(String s) {
-	super(s);
+        super(s);
     }
 }



1.4       +4 -3      e/src/jsrc/antlr/CharStreamIOException.java

Index: CharStreamIOException.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/CharStreamIOException.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CharStreamIOException.java	2001/10/26 03:08:50	1.3
+++ CharStreamIOException.java	2001/12/02 06:01:28	1.4
@@ -4,7 +4,7 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: CharStreamIOException.java,v 1.3 2001/10/26 03:08:50 markm Exp $
+ * $Id: CharStreamIOException.java,v 1.4 2001/12/02 06:01:28 markm Exp $
  */
 
 import java.io.IOException;
@@ -13,10 +13,11 @@
  * Wrap an IOException in a CharStreamException
  */
 public class CharStreamIOException extends CharStreamException {
+
     public IOException io;
 
     public CharStreamIOException(IOException io) {
-	super(io.getMessage());
-	this.io = io;
+        super(io.getMessage());
+        this.io = io;
     }
 }



1.5       +296 -302  e/src/jsrc/antlr/CodeGenerator.java

Index: CodeGenerator.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/CodeGenerator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CodeGenerator.java	2001/11/29 20:33:25	1.4
+++ CodeGenerator.java	2001/12/02 06:01:28	1.5
@@ -4,7 +4,7 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: CodeGenerator.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: CodeGenerator.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 import antlr.collections.impl.BitSet;
@@ -47,20 +47,28 @@
  * @see     antlr.Lookahead
  */
 public abstract class CodeGenerator {
+
     /** Current tab indentation for code output */
-    protected int tabs=0;
+    protected int tabs = 0;
+
     /** Current output Stream */
     transient protected PrintWriter currentOutput; // SAS: for proper text i/o
+
     /** The grammar for which we generate code */
     protected Grammar grammar = null;
+
     /** List of all bitsets that must be dumped.  These are Vectors of BitSet. */
     protected Vector bitsetsUsed;
+
     /** The antlr Tool */
     protected Tool tool;
+
     /** The grammar behavior */
     protected DefineGrammarSymbols behavior;
+
     /** The LLk analyzer */
     protected LLkGrammarAnalyzer analyzer;
+
     /** Object used to format characters in the target language.
      * subclass must initialize this to the language-specific formatter
      */
@@ -71,6 +79,7 @@
 
     /** Default values for code-generation thresholds */
     protected static final int DEFAULT_MAKE_SWITCH_THRESHOLD = 2;
+
     protected static final int DEFAULT_BITSET_TEST_THRESHOLD = 4;
 
     /** This is a hint for the language-specific code generator.
@@ -92,19 +101,21 @@
     private static boolean OLD_ACTION_TRANSLATOR = true;
 
     public static String TokenTypesFileSuffix = "TokenTypes";
+
     public static String TokenTypesFileExt = ".txt";
 
     /** Construct code generator base class */
-    public CodeGenerator() {}
+    public CodeGenerator() {
+    }
 
     /** Output a String to the currentOutput stream.
      * Ignored if string is null.
      * @param s The string to output
      */
     protected void _print(String s) {
-	if (s != null) {
-	    currentOutput.print(s);
-	}
+        if (s != null) {
+            currentOutput.print(s);
+        }
     }
 
     /** Print an action without leading tabs, attempting to
@@ -113,56 +124,52 @@
      * @param s The action string to output
      */
     protected void _printAction(String s) {
-	if (s == null) {
-	    return;
-	}
-
-	// Skip leading newlines, tabs and spaces
-	int start = 0;
-	while (start < s.length() && Character.isSpaceChar(s.charAt(start)) )
-	    {
-		start++;
-	    }
-
-	// Skip leading newlines, tabs and spaces
-	int end = s.length()-1;
-	while ( end > start && Character.isSpaceChar(s.charAt(end)) )
-	    {
-		end--;
-	    }
-
-	char c=0;
-	for (int i = start; i <= end;)
-	    {
-		c = s.charAt(i);
-		i++;
-		boolean newline = false;
-		switch (c)
-		    {
-		    case '\n':
-			newline=true;
-			break;
-		    case '\r':
-			if ( i<=end && s.charAt(i)=='\n' ) {
-			    i++;
-			}
-			newline=true;
-			break;
-		    default:
-			currentOutput.print(c);
-			break;
-		    }
-		if ( newline ) {
-		    currentOutput.println();
-		    printTabs();
-				// Absorb leading whitespace
-		    while (i <= end && Character.isSpaceChar(s.charAt(i)) ) {
-			i++;
-		    }
-		    newline=false;
-		}
-	    }
-	currentOutput.println();
+        if (s == null) {
+            return;
+        }
+
+        // Skip leading newlines, tabs and spaces
+        int start = 0;
+        while (start < s.length() && Character.isSpaceChar(s.charAt(start))) {
+            start++;
+        }
+
+        // Skip leading newlines, tabs and spaces
+        int end = s.length() - 1;
+        while (end > start && Character.isSpaceChar(s.charAt(end))) {
+            end--;
+        }
+
+        char c = 0;
+        for (int i = start; i <= end;) {
+            c = s.charAt(i);
+            i++;
+            boolean newline = false;
+            switch (c) {
+                case '\n':
+                    newline = true;
+                    break;
+                case '\r':
+                    if (i <= end && s.charAt(i) == '\n') {
+                        i++;
+                    }
+                    newline = true;
+                    break;
+                default:
+                    currentOutput.print(c);
+                    break;
+            }
+            if (newline) {
+                currentOutput.println();
+                printTabs();
+                // Absorb leading whitespace
+                while (i <= end && Character.isSpaceChar(s.charAt(i))) {
+                    i++;
+                }
+                newline = false;
+            }
+        }
+        currentOutput.println();
     }
 
     /** Output a String followed by newline, to the currentOutput stream.
@@ -170,9 +177,9 @@
      * @param s The string to output
      */
     protected void _println(String s) {
-	if (s != null) {
-	    currentOutput.println(s);
-	}
+        if (s != null) {
+            currentOutput.println(s);
+        }
     }
 
     /** Test if a set element array represents a contiguous range.
@@ -180,28 +187,28 @@
      * @return true if the elements are a contiguous range (with two or more).
      */
     public static boolean elementsAreRange(int[] elems) {
-	if (elems.length==0) {
-	    return false;
-	}
-	int begin = elems[0];
-	int end = elems[elems.length-1];
-	if ( elems.length<=2 ) {
-	    // Not enough elements for a range expression
-	    return false;
-	}
-	if ( end-begin+1 > elems.length ) {
-	    // The set does not represent a contiguous range
-	    return false;
-	}
-	int v = begin+1;
-	for (int i=1; i<elems.length-1; i++) {
-	    if ( v != elems[i] ) {
-				// The set does not represent a contiguous range
-		return false;
-	    }
-	    v++;
-	}
-	return true;
+        if (elems.length == 0) {
+            return false;
+        }
+        int begin = elems[0];
+        int end = elems[elems.length - 1];
+        if (elems.length <= 2) {
+            // Not enough elements for a range expression
+            return false;
+        }
+        if (end - begin + 1 > elems.length) {
+            // The set does not represent a contiguous range
+            return false;
+        }
+        int v = begin + 1;
+        for (int i = 1; i < elems.length - 1; i++) {
+            if (v != elems[i]) {
+                // The set does not represent a contiguous range
+                return false;
+            }
+            v++;
+        }
+        return true;
     }
 
     /** Get the identifier portion of an argument-action token.
@@ -212,7 +219,7 @@
      * @return A string containing the text of the identifier
      */
     protected String extractIdOfAction(Token t) {
-	return extractIdOfAction(t.getText(), t.getLine());
+        return extractIdOfAction(t.getText(), t.getLine());
     }
 
     /** Get the identifier portion of an argument-action.
@@ -224,22 +231,20 @@
      * @return A string containing the text of the identifier
      */
     protected String extractIdOfAction(String s, int line) {
-	s = removeAssignmentFromDeclaration(s);
-	// Search back from the end for a non alphanumeric.  That marks the
-	// beginning of the identifier
-	for (int i = s.length()-2; i >=0; i--)
-	    {
-		// TODO: make this work for language-independent identifiers?
-		if (!Character.isLetterOrDigit(s.charAt(i)) && s.charAt(i) != '_')
-		    {
-				// Found end of type part
-			return s.substring(i+1);
-		    }
-	    }
-	// Something is bogus, but we cannot parse the language-specific
-	// actions any better.  The compiler will have to catch the problem.
-	tool.warning("Ill-formed action", grammar.getFilename(), line);
-	return "";
+        s = removeAssignmentFromDeclaration(s);
+        // Search back from the end for a non alphanumeric.  That marks the
+        // beginning of the identifier
+        for (int i = s.length() - 2; i >= 0; i--) {
+            // TODO: make this work for language-independent identifiers?
+            if (!Character.isLetterOrDigit(s.charAt(i)) && s.charAt(i) != '_') {
+                // Found end of type part
+                return s.substring(i + 1);
+            }
+        }
+        // Something is bogus, but we cannot parse the language-specific
+        // actions any better.  The compiler will have to catch the problem.
+        tool.warning("Ill-formed action", grammar.getFilename(), line);
+        return "";
     }
 
     /** Get the type string out of an argument-action token.
@@ -250,7 +255,7 @@
      * @return A string containing the text of the type
      */
     protected String extractTypeOfAction(Token t) {
-	return extractTypeOfAction(t.getText(), t.getLine());
+        return extractTypeOfAction(t.getText(), t.getLine());
     }
 
     /** Get the type portion of an argument-action.
@@ -262,22 +267,20 @@
      * @return A string containing the text of the type
      */
     protected String extractTypeOfAction(String s, int line) {
-	s = removeAssignmentFromDeclaration(s);
-	// Search back from the end for a non alphanumeric.  That marks the
-	// beginning of the identifier
-	for (int i = s.length()-2; i >=0; i--)
-	    {
-		// TODO: make this work for language-independent identifiers?
-		if (!Character.isLetterOrDigit(s.charAt(i)) && s.charAt(i) != '_')
-		    {
-				// Found end of type part
-			return s.substring(0,i+1);
-		    }
-	    }
-	// Something is bogus, but we cannot parse the language-specific
-	// actions any better.  The compiler will have to catch the problem.
-	tool.warning("Ill-formed action", grammar.getFilename(), line);
-	return "";
+        s = removeAssignmentFromDeclaration(s);
+        // Search back from the end for a non alphanumeric.  That marks the
+        // beginning of the identifier
+        for (int i = s.length() - 2; i >= 0; i--) {
+            // TODO: make this work for language-independent identifiers?
+            if (!Character.isLetterOrDigit(s.charAt(i)) && s.charAt(i) != '_') {
+                // Found end of type part
+                return s.substring(0, i + 1);
+            }
+        }
+        // Something is bogus, but we cannot parse the language-specific
+        // actions any better.  The compiler will have to catch the problem.
+        tool.warning("Ill-formed action", grammar.getFilename(), line);
+        return "";
     }
 
     /** Generate the code for all grammars
@@ -362,68 +365,66 @@
 
     /** Generate the token types as a text file for persistence across shared lexer/parser */
     protected void genTokenInterchange(TokenManager tm) throws IOException {
-	// Open the token output Java file and set the currentOutput stream
-	String fName = tm.getName() + TokenTypesFileSuffix+TokenTypesFileExt;
-	currentOutput = antlr.Tool.openOutputFile(fName);
-
-	println("// $ANTLR "+Tool.version+": "+
-		Tool.fileMinusPath(tool.grammarFile)+
-		" -> "+
-		fName+
-		"$");
-
-	tabs = 0;
-
-	// Header
-	println(tm.getName() + "    // output token vocab name");
-
-	// Generate a definition for each token type
-	Vector v = tm.getVocabulary();
-	for (int i = Token.MIN_USER_TYPE; i < v.size(); i++) {
-	    String s = (String)v.elementAt(i);
-	    if ( DEBUG_CODE_GENERATOR ) {
-		System.out.println("gen persistence file entry for: "+s);
-	    }
-	    if (s != null && !s.startsWith("<") ) {
-				// if literal, find label
-		if ( s.startsWith("\"") ) {
-		    StringLiteralSymbol sl = (StringLiteralSymbol)tm.getTokenSymbol(s);
-		    if ( sl!=null && sl.label != null ) {
-			print(sl.label+"=");
-		    }
-		    println(s + "=" + i);
-		}
-		else {
-		    print(s);
-		    // check for a paraphrase
-		    TokenSymbol ts = (TokenSymbol)tm.getTokenSymbol(s);
-		    if ( ts==null ) {
-			tool.warning("undefined token symbol: "+s);
-		    }
-		    else {
-			if ( ts.getParaphrase()!=null ) {
-			    print("("+ts.getParaphrase()+")");
-			}
-		    }
-		    println("=" + i);
-		}
-	    }
-	}
-
-	// Close the tokens output file
-	currentOutput.close();
-	currentOutput = null;
-    }
-
-	/** Process a string for an simple expression for use in xx/action.g
-	 * it is used to cast simple tokens/references to the right type for
-	 * the generated language.
-	 * @param str A String.
-	 */
-	public String processStringForASTConstructor( String str )
-	{
-		return str;
-	}
+        // Open the token output Java file and set the currentOutput stream
+        String fName = tm.getName() + TokenTypesFileSuffix + TokenTypesFileExt;
+        currentOutput = antlr.Tool.openOutputFile(fName);
+
+        println("// $ANTLR " + Tool.version + ": " +
+                Tool.fileMinusPath(tool.grammarFile) +
+                " -> " +
+                fName +
+                "$");
+
+        tabs = 0;
+
+        // Header
+        println(tm.getName() + "    // output token vocab name");
+
+        // Generate a definition for each token type
+        Vector v = tm.getVocabulary();
+        for (int i = Token.MIN_USER_TYPE; i < v.size(); i++) {
+            String s = (String)v.elementAt(i);
+            if (DEBUG_CODE_GENERATOR) {
+                System.out.println("gen persistence file entry for: " + s);
+            }
+            if (s != null && !s.startsWith("<")) {
+                // if literal, find label
+                if (s.startsWith("\"")) {
+                    StringLiteralSymbol sl = (StringLiteralSymbol)tm.getTokenSymbol(s);
+                    if (sl != null && sl.label != null) {
+                        print(sl.label + "=");
+                    }
+                    println(s + "=" + i);
+                } else {
+                    print(s);
+                    // check for a paraphrase
+                    TokenSymbol ts = (TokenSymbol)tm.getTokenSymbol(s);
+                    if (ts == null) {
+                        tool.warning("undefined token symbol: " + s);
+                    } else {
+                        if (ts.getParaphrase() != null) {
+                            print("(" + ts.getParaphrase() + ")");
+                        }
+                    }
+                    println("=" + i);
+                }
+            }
+        }
+
+        // Close the tokens output file
+        currentOutput.close();
+        currentOutput = null;
+    }
+
+    /** Process a string for an simple expression for use in xx/action.g
+     * it is used to cast simple tokens/references to the right type for
+     * the generated language.
+     * @param str A String.
+     */
+    public String processStringForASTConstructor(String str) {
+        return str;
+    }
+
     /** Get a string for an expression to generate creation of an AST subtree.
      * @param v A Vector of String, where each element is an expression in the target language yielding an AST node.
      */
@@ -439,13 +440,12 @@
      * if the language does not allow '_' or numerals in identifiers.
      * @param index  The index of the bitset in the bitset list.
      */
-    protected String getBitsetName(int index)
-    {
-	return "_tokenSet_" + index;
+    protected String getBitsetName(int index) {
+        return "_tokenSet_" + index;
     }
 
     public static String lexerRuleName(String id) {
-	return "m"+id;
+        return "m" + id;
     }
 
     /** Map an identifier to it's corresponding tree-node variable.
@@ -468,20 +468,18 @@
      * @return The position of the bitset in the list.
      */
     protected int markBitsetForGen(BitSet p) {
-	// Is the bitset (or an identical one) already marked for gen?
-	for (int i = 0; i < bitsetsUsed.size(); i++)
-	    {
-		BitSet set = (BitSet)bitsetsUsed.elementAt(i);
-		if (p.equals(set))
-		    {
-				// Use the identical one already stored
-			return i;
-		    }
-	    }
-
-	// Add the new bitset
-	bitsetsUsed.appendElement(p.clone());
-	return bitsetsUsed.size()-1;
+        // Is the bitset (or an identical one) already marked for gen?
+        for (int i = 0; i < bitsetsUsed.size(); i++) {
+            BitSet set = (BitSet)bitsetsUsed.elementAt(i);
+            if (p.equals(set)) {
+                // Use the identical one already stored
+                return i;
+            }
+        }
+
+        // Add the new bitset
+        bitsetsUsed.appendElement(p.clone());
+        return bitsetsUsed.size() - 1;
     }
 
     /** Output tab indent followed by a String, to the currentOutput stream.
@@ -489,10 +487,10 @@
      * @param s The string to output.
      */
     protected void print(String s) {
-	if (s != null) {
-	    printTabs();
-	    currentOutput.print(s);
-	}
+        if (s != null) {
+            printTabs();
+            currentOutput.print(s);
+        }
     }
 
     /** Print an action with leading tabs, attempting to
@@ -501,10 +499,10 @@
      * @param s The action string to output
      */
     protected void printAction(String s) {
-	if (s != null) {
-	    printTabs();
-	    _printAction(s);
-	}
+        if (s != null) {
+            printTabs();
+            _printAction(s);
+        }
     }
 
     /** Output tab indent followed by a String followed by newline,
@@ -512,19 +510,19 @@
      * @param s The string to output
      */
     protected void println(String s) {
-	if (s != null) {
-	    printTabs();
-	    currentOutput.println(s);
-	}
+        if (s != null) {
+            printTabs();
+            currentOutput.println(s);
+        }
     }
 
     /** Output the current tab indentation.  This outputs the number of tabs
      * indicated by the "tabs" variable to the currentOutput stream.
      */
     protected void printTabs() {
-	for (int i=1; i<=tabs; i++) {
-	    currentOutput.print("\t");
-	}
+        for (int i = 1; i <= tabs; i++) {
+            currentOutput.print("\t");
+        }
     }
 
     /** Lexically process tree-specifiers in the action.
@@ -535,37 +533,34 @@
      *  it work for C++ also.
      */
     protected String processActionForTreeSpecifiers(String actionStr, int line, RuleBlock currentRule, ActionTransInfo tInfo) {
-	if ( actionStr==null || actionStr.length()==0 ) return null;
-	// The action trans info tells us (at the moment) whether an
-	// assignment was done to the rule's tree root.
-	if (grammar==null) return actionStr;
-	if ( (grammar.buildAST && actionStr.indexOf('#') != -1) ||
-	     grammar instanceof TreeWalkerGrammar ||
-	     (grammar instanceof LexerGrammar && actionStr.indexOf('$') != -1) ) {
-	    // Create a lexer to read an action and return the translated version
-	    antlr.actions.java.ActionLexer lexer = new antlr.actions.java.ActionLexer(actionStr, currentRule, this, tInfo);
-	    lexer.setLineOffset(line);
-	    lexer.setTool(tool);
-	    try {
-		lexer.mACTION(true);
-		actionStr = lexer.getTokenObject().getText();
-				// System.out.println("action translated: "+actionStr);
-				// System.out.println("trans info is "+tInfo);
-	    }
-	    catch (RecognitionException ex) {
-		lexer.reportError(ex);
-		return actionStr;
-	    }
-	    catch (TokenStreamException tex) {
-		antlr.Tool.panic("Error reading action:"+actionStr);
-		return actionStr;
-	    }
-	    catch (CharStreamException io) {
-		antlr.Tool.panic("Error reading action:"+actionStr);
-		return actionStr;
-	    }
-	}
-	return actionStr;
+        if (actionStr == null || actionStr.length() == 0) return null;
+        // The action trans info tells us (at the moment) whether an
+        // assignment was done to the rule's tree root.
+        if (grammar == null) return actionStr;
+        if ((grammar.buildAST && actionStr.indexOf('#') != -1) ||
+          grammar instanceof TreeWalkerGrammar ||
+          (grammar instanceof LexerGrammar && actionStr.indexOf('$') != -1)) {
+            // Create a lexer to read an action and return the translated version
+            antlr.actions.java.ActionLexer lexer = new antlr.actions.java.ActionLexer(actionStr, currentRule, this, tInfo);
+            lexer.setLineOffset(line);
+            lexer.setTool(tool);
+            try {
+                lexer.mACTION(true);
+                actionStr = lexer.getTokenObject().getText();
+                // System.out.println("action translated: "+actionStr);
+                // System.out.println("trans info is "+tInfo);
+            } catch (RecognitionException ex) {
+                lexer.reportError(ex);
+                return actionStr;
+            } catch (TokenStreamException tex) {
+                antlr.Tool.panic("Error reading action:" + actionStr);
+                return actionStr;
+            } catch (CharStreamException io) {
+                antlr.Tool.panic("Error reading action:" + actionStr);
+                return actionStr;
+            }
+        }
+        return actionStr;
     }
 
     /**
@@ -574,85 +569,84 @@
      * @return the declaration without any assignment portion
      */
     protected String removeAssignmentFromDeclaration(String d) {
-	// If d contains an equal sign, then it's a declaration
-	// with an initialization.  Strip off the initialization part.
-	if (d.indexOf('=') >= 0) d = d.substring(0, d.indexOf('=')).trim();
-	return d;
+        // If d contains an equal sign, then it's a declaration
+        // with an initialization.  Strip off the initialization part.
+        if (d.indexOf('=') >= 0) d = d.substring(0, d.indexOf('=')).trim();
+        return d;
     }
 
     /** Set all fields back like one just created */
     private void reset() {
-	tabs = 0;
-	// Allocate list of bitsets tagged for code generation
-	bitsetsUsed = new Vector();
-	currentOutput = null;
-	grammar = null;
-	DEBUG_CODE_GENERATOR = false;
-	makeSwitchThreshold = DEFAULT_MAKE_SWITCH_THRESHOLD;
-	bitsetTestThreshold = DEFAULT_BITSET_TEST_THRESHOLD;
+        tabs = 0;
+        // Allocate list of bitsets tagged for code generation
+        bitsetsUsed = new Vector();
+        currentOutput = null;
+        grammar = null;
+        DEBUG_CODE_GENERATOR = false;
+        makeSwitchThreshold = DEFAULT_MAKE_SWITCH_THRESHOLD;
+        bitsetTestThreshold = DEFAULT_BITSET_TEST_THRESHOLD;
     }
 
     public static String reverseLexerRuleName(String id) {
-	return id.substring(1,id.length());
+        return id.substring(1, id.length());
     }
 
     public void setAnalyzer(LLkGrammarAnalyzer analyzer_) {
-	analyzer = analyzer_;
+        analyzer = analyzer_;
     }
 
     public void setBehavior(DefineGrammarSymbols behavior_) {
-	behavior = behavior_;
+        behavior = behavior_;
     }
 
     /** Set a grammar for the code generator to use */
     protected void setGrammar(Grammar g) {
-	reset();
-	grammar = g;
-	// Lookup make-switch threshold in the grammar generic options
-	if (grammar.hasOption("codeGenMakeSwitchThreshold")) {
-	    try {
-		makeSwitchThreshold = grammar.getIntegerOption("codeGenMakeSwitchThreshold");
-				//System.out.println("setting codeGenMakeSwitchThreshold to " + makeSwitchThreshold);
-	    } catch (NumberFormatException e) {
-		tool.error(
-			   "option 'codeGenMakeSwitchThreshold' must be an integer",
-			   grammar.getClassName(),
-			   grammar.getOption("codeGenMakeSwitchThreshold").getLine()
-			   );
-	    }
-	}
-
-	// Lookup bitset-test threshold in the grammar generic options
-	if (grammar.hasOption("codeGenBitsetTestThreshold")) {
-	    try {
-		bitsetTestThreshold = grammar.getIntegerOption("codeGenBitsetTestThreshold");
-				//System.out.println("setting codeGenBitsetTestThreshold to " + bitsetTestThreshold);
-	    } catch (NumberFormatException e) {
-		tool.error(
-			   "option 'codeGenBitsetTestThreshold' must be an integer",
-			   grammar.getClassName(),
-			   grammar.getOption("codeGenBitsetTestThreshold").getLine()
-			   );
-	    }
-	}
-
-	// Lookup debug code-gen in the grammar generic options
-	if (grammar.hasOption("codeGenDebug")) {
-	    Token t = grammar.getOption("codeGenDebug");
-	    if (t.getText().equals("true")) {
-				//System.out.println("setting code-generation debug ON");
-		DEBUG_CODE_GENERATOR = true;
-	    }
-	    else if (t.getText().equals("false")) {
-				//System.out.println("setting code-generation debug OFF");
-		DEBUG_CODE_GENERATOR = false;
-	    }
-	    else {
-		tool.error("option 'codeGenDebug' must be true or false", grammar.getClassName(), t.getLine());
-	    }
-	}
+        reset();
+        grammar = g;
+        // Lookup make-switch threshold in the grammar generic options
+        if (grammar.hasOption("codeGenMakeSwitchThreshold")) {
+            try {
+                makeSwitchThreshold = grammar.getIntegerOption("codeGenMakeSwitchThreshold");
+                //System.out.println("setting codeGenMakeSwitchThreshold to " + makeSwitchThreshold);
+            } catch (NumberFormatException e) {
+                tool.error(
+                  "option 'codeGenMakeSwitchThreshold' must be an integer",
+                  grammar.getClassName(),
+                  grammar.getOption("codeGenMakeSwitchThreshold").getLine()
+                );
+            }
+        }
+
+        // Lookup bitset-test threshold in the grammar generic options
+        if (grammar.hasOption("codeGenBitsetTestThreshold")) {
+            try {
+                bitsetTestThreshold = grammar.getIntegerOption("codeGenBitsetTestThreshold");
+                //System.out.println("setting codeGenBitsetTestThreshold to " + bitsetTestThreshold);
+            } catch (NumberFormatException e) {
+                tool.error(
+                  "option 'codeGenBitsetTestThreshold' must be an integer",
+                  grammar.getClassName(),
+                  grammar.getOption("codeGenBitsetTestThreshold").getLine()
+                );
+            }
+        }
+
+        // Lookup debug code-gen in the grammar generic options
+        if (grammar.hasOption("codeGenDebug")) {
+            Token t = grammar.getOption("codeGenDebug");
+            if (t.getText().equals("true")) {
+                //System.out.println("setting code-generation debug ON");
+                DEBUG_CODE_GENERATOR = true;
+            } else if (t.getText().equals("false")) {
+                //System.out.println("setting code-generation debug OFF");
+                DEBUG_CODE_GENERATOR = false;
+            } else {
+                tool.error("option 'codeGenDebug' must be true or false", grammar.getClassName(), t.getLine());
+            }
+        }
     }
+
     public void setTool(Tool tool_) {
-	tool = tool_;
+        tool = tool_;
     }
 }



1.5       +45 -37    e/src/jsrc/antlr/CommonAST.java

Index: CommonAST.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/CommonAST.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CommonAST.java	2001/11/29 20:33:25	1.4
+++ CommonAST.java	2001/12/02 06:01:28	1.5
@@ -4,50 +4,58 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: CommonAST.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: CommonAST.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 import antlr.collections.AST;
 
 /** Common AST node implementation */
 public class CommonAST extends BaseAST {
-	int ttype = Token.INVALID_TYPE;
-	String text;
 
+    int ttype = Token.INVALID_TYPE;
 
-	/** Get the token text for this node */
-	public String getText() { return text; }
+    String text;
 
-	/** Get the token type for this node */
-	public int getType() { return ttype; }
-
-	public void initialize(int t, String txt) {
-		setType(t);
-		setText(txt);
-	}
-
-	public void initialize(AST t) {
-		setText(t.getText());
-		setType(t.getType());
-	}
-
-	public CommonAST() {
-	}
-
-	public CommonAST(Token tok) {
-		initialize(tok);
-	}
-
-	public void initialize(Token tok) {
-		setText(tok.getText());
-		setType(tok.getType());
-	}
-	/** Set the token text for this node */
-	public void setText(String text_) {
-		text = text_;
-	}
-	/** Set the token type for this node */
-	public void setType(int ttype_) {
-		ttype = ttype_;
-	}
+
+    /** Get the token text for this node */
+    public String getText() {
+        return text;
+    }
+
+    /** Get the token type for this node */
+    public int getType() {
+        return ttype;
+    }
+
+    public void initialize(int t, String txt) {
+        setType(t);
+        setText(txt);
+    }
+
+    public void initialize(AST t) {
+        setText(t.getText());
+        setType(t.getType());
+    }
+
+    public CommonAST() {
+    }
+
+    public CommonAST(Token tok) {
+        initialize(tok);
+    }
+
+    public void initialize(Token tok) {
+        setText(tok.getText());
+        setType(tok.getType());
+    }
+
+    /** Set the token text for this node */
+    public void setText(String text_) {
+        text = text_;
+    }
+
+    /** Set the token type for this node */
+    public void setType(int ttype_) {
+        ttype = ttype_;
+    }
 }



1.5       +14 -9     e/src/jsrc/antlr/CommonASTWithHiddenTokens.java

Index: CommonASTWithHiddenTokens.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/CommonASTWithHiddenTokens.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CommonASTWithHiddenTokens.java	2001/11/29 20:33:25	1.4
+++ CommonASTWithHiddenTokens.java	2001/12/02 06:01:28	1.5
@@ -4,31 +4,36 @@
  * Project led by Terence Parr at http://www.jGuru.com
  * Software rights: http://www.antlr.org/RIGHTS.html
  *
- * $Id: CommonASTWithHiddenTokens.java,v 1.4 2001/11/29 20:33:25 markm Exp $
+ * $Id: CommonASTWithHiddenTokens.java,v 1.5 2001/12/02 06:01:28 markm Exp $
  */
 
 /** A CommonAST whose initialization copies hidden token
  *  information from the Token used to create a node.
  */
 public class CommonASTWithHiddenTokens extends CommonAST {
+
     protected CommonHiddenStreamToken hiddenBefore, hiddenAfter; // references to hidden tokens
 
     public CommonASTWithHiddenTokens() {
-	super();
+        super();
     }
 
     public CommonASTWithHiddenTokens(Token tok) {
-	super(tok);
+        super(tok);
     }
 
-    public CommonHiddenStreamToken getHiddenAfter() { return hiddenAfter; }
+    public CommonHiddenStreamToken getHiddenAfter() {
+        return hiddenAfter;
+    }
 
-    public CommonHiddenStreamToken getHiddenBefore() { return hiddenBefore; }
+    public CommonHiddenStreamToken getHiddenBefore() {
+        return hiddenBefore;
+    }
 
     public void initialize(Token tok) {
-	CommonHiddenStreamToken t = (Co