groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cchamp...@apache.org
Subject [39/62] [abbrv] [partial] groovy git commit: Move Java source set into `src/main/java`
Date Sun, 17 Dec 2017 15:05:01 GMT
http://git-wip-us.apache.org/repos/asf/groovy/blob/a188738d/src/main/java/org/codehaus/groovy/antlr/treewalker/TraversalHelper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/antlr/treewalker/TraversalHelper.java b/src/main/java/org/codehaus/groovy/antlr/treewalker/TraversalHelper.java
new file mode 100644
index 0000000..dcae1a8
--- /dev/null
+++ b/src/main/java/org/codehaus/groovy/antlr/treewalker/TraversalHelper.java
@@ -0,0 +1,557 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.codehaus.groovy.antlr.treewalker;
+
+import antlr.collections.AST;
+import org.codehaus.groovy.antlr.AntlrASTProcessor;
+import org.codehaus.groovy.antlr.GroovySourceAST;
+import org.codehaus.groovy.antlr.parser.GroovyTokenTypes;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Helper Class for Antlr AST traversal and visitation.
+ *
+ * @author <a href="mailto:groovy@ross-rayner.com">Jeremy Rayner</a>
+ */
+public abstract class TraversalHelper implements AntlrASTProcessor {
+    protected List<GroovySourceAST> unvisitedNodes;
+    private final Visitor v;
+
+    public TraversalHelper(Visitor visitor) {
+        this.unvisitedNodes = new ArrayList<GroovySourceAST>();
+        this.v = visitor;
+    }
+
+    protected void setUp(GroovySourceAST ast) {
+        v.setUp();
+    }
+
+    protected void tearDown(GroovySourceAST ast) {
+        v.tearDown();
+    }
+
+    protected void push(GroovySourceAST ast) {
+        v.push(ast);
+    }
+
+    protected GroovySourceAST pop() {
+        return v.pop();
+    }
+
+    protected void visitNode(GroovySourceAST ast, int n) {
+        if (ast != null) {
+            switch (ast.getType()) {
+                case GroovyTokenTypes.ABSTRACT                      :   v.visitAbstract(ast,n);                     break;
+                case GroovyTokenTypes.ANNOTATION                    :   v.visitAnnotation(ast,n);                   break;
+                case GroovyTokenTypes.ANNOTATIONS                   :   v.visitAnnotations(ast,n);                  break;
+                case GroovyTokenTypes.ANNOTATION_ARRAY_INIT         :   v.visitAnnotationArrayInit(ast,n);          break; // obsolete?
+                case GroovyTokenTypes.ANNOTATION_DEF                :   v.visitAnnotationDef(ast,n);                break;
+                case GroovyTokenTypes.ANNOTATION_FIELD_DEF          :   v.visitAnnotationFieldDef(ast,n);           break;
+                case GroovyTokenTypes.ANNOTATION_MEMBER_VALUE_PAIR  :   v.visitAnnotationMemberValuePair(ast,n);    break;
+                case GroovyTokenTypes.ARRAY_DECLARATOR              :   v.visitArrayDeclarator(ast,n);              break;
+                case GroovyTokenTypes.ASSIGN                        :   v.visitAssign(ast,n);                       break;
+                case GroovyTokenTypes.AT                            :   v.visitAt(ast,n);                           break;
+                case GroovyTokenTypes.BAND                          :   v.visitBand(ast,n);                         break;
+                case GroovyTokenTypes.BAND_ASSIGN                   :   v.visitBandAssign(ast,n);                   break;
+                case GroovyTokenTypes.BIG_SUFFIX                    :   v.visitBigSuffix(ast,n);                    break;
+                case GroovyTokenTypes.BLOCK                         :   v.visitBlock(ast,n);                        break;
+                case GroovyTokenTypes.BNOT                          :   v.visitBnot(ast,n);                         break;
+                case GroovyTokenTypes.BOR                           :   v.visitBor(ast,n);                          break;
+                case GroovyTokenTypes.BOR_ASSIGN                    :   v.visitBorAssign(ast,n);                    break;
+                case GroovyTokenTypes.BSR                           :   v.visitBsr(ast,n);                          break;
+                case GroovyTokenTypes.BSR_ASSIGN                    :   v.visitBsrAssign(ast,n);                    break;
+                case GroovyTokenTypes.BXOR                          :   v.visitBxor(ast,n);                         break;
+                case GroovyTokenTypes.BXOR_ASSIGN                   :   v.visitBxorAssign(ast,n);                   break;
+                case GroovyTokenTypes.CASE_GROUP                    :   v.visitCaseGroup(ast,n);                    break;
+                case GroovyTokenTypes.CLASS_DEF                     :   v.visitClassDef(ast,n);                     break;
+                case GroovyTokenTypes.CLOSABLE_BLOCK                :   v.visitClosedBlock(ast,n);                  break;
+                case GroovyTokenTypes.CLOSABLE_BLOCK_OP             :   v.visitClosureOp(ast,n);                    break;
+                case GroovyTokenTypes.CLOSURE_LIST                  :   v.visitClosureList(ast,n);                  break;
+                case GroovyTokenTypes.COLON                         :   v.visitColon(ast,n);                        break;
+                case GroovyTokenTypes.COMMA                         :   v.visitComma(ast,n);                        break;
+                case GroovyTokenTypes.COMPARE_TO                    :   v.visitCompareTo(ast,n);                    break;
+                case GroovyTokenTypes.CTOR_CALL                     :   v.visitCtorCall(ast,n);                     break;
+                case GroovyTokenTypes.CTOR_IDENT                    :   v.visitCtorIdent(ast,n);                    break;
+                case GroovyTokenTypes.DEC                           :   v.visitDec(ast,n);                          break;
+                case GroovyTokenTypes.DIGIT                         :   v.visitDigit(ast,n);                        break;
+                case GroovyTokenTypes.DIV                           :   v.visitDiv(ast,n);                          break;
+                case GroovyTokenTypes.DIV_ASSIGN                    :   v.visitDivAssign(ast,n);                    break;
+                case GroovyTokenTypes.DOLLAR                        :   v.visitDollar(ast,n);                       break;
+                case GroovyTokenTypes.DOLLAR_REGEXP_CTOR_END        :   v.visitRegexpCtorEnd(ast,n);                break;
+                case GroovyTokenTypes.DOLLAR_REGEXP_LITERAL         :   v.visitRegexpLiteral(ast,n);                break;
+                case GroovyTokenTypes.DOLLAR_REGEXP_SYMBOL          :   v.visitRegexpSymbol(ast,n);                 break;
+                case GroovyTokenTypes.DOT                           :   v.visitDot(ast,n);                          break;
+                case GroovyTokenTypes.DYNAMIC_MEMBER                :   v.visitDynamicMember(ast,n);                break;
+                case GroovyTokenTypes.ELIST                         :   v.visitElist(ast,n);                        break;
+                case GroovyTokenTypes.EMPTY_STAT                    :   v.visitEmptyStat(ast,n);                    break;
+                case GroovyTokenTypes.ENUM_CONSTANT_DEF             :   v.visitEnumConstantDef(ast,n);              break;
+                case GroovyTokenTypes.ENUM_DEF                      :   v.visitEnumDef(ast,n);                      break;
+                case GroovyTokenTypes.EOF                           :   v.visitEof(ast,n);                          break;
+                case GroovyTokenTypes.EQUAL                         :   v.visitEqual(ast,n);                        break;
+                case GroovyTokenTypes.ESC                           :   v.visitEsc(ast,n);                          break;
+                case GroovyTokenTypes.EXPONENT                      :   v.visitExponent(ast,n);                     break;
+                case GroovyTokenTypes.EXPR                          :   v.visitExpr(ast,n);                         break;
+                case GroovyTokenTypes.EXTENDS_CLAUSE                :   v.visitExtendsClause(ast,n);                break;
+                case GroovyTokenTypes.FINAL                         :   v.visitFinal(ast,n);                        break;
+                case GroovyTokenTypes.FLOAT_SUFFIX                  :   v.visitFloatSuffix(ast,n);                  break;
+                case GroovyTokenTypes.FOR_CONDITION                 :   v.visitForCondition(ast,n);                 break;
+                case GroovyTokenTypes.FOR_EACH_CLAUSE               :   v.visitForEachClause(ast,n);                break;
+                case GroovyTokenTypes.FOR_INIT                      :   v.visitForInit(ast,n);                      break;
+                case GroovyTokenTypes.FOR_IN_ITERABLE               :   v.visitForInIterable(ast,n);                break;
+                case GroovyTokenTypes.FOR_ITERATOR                  :   v.visitForIterator(ast,n);                  break;
+                case GroovyTokenTypes.GE                            :   v.visitGe(ast,n);                           break;
+                case GroovyTokenTypes.GT                            :   v.visitGt(ast,n);                           break;
+                case GroovyTokenTypes.HEX_DIGIT                     :   v.visitHexDigit(ast,n);                     break;
+                case GroovyTokenTypes.IDENT                         :   v.visitIdent(ast,n);                        break;
+                case GroovyTokenTypes.IMPLEMENTS_CLAUSE             :   v.visitImplementsClause(ast,n);             break;
+                case GroovyTokenTypes.IMPLICIT_PARAMETERS           :   v.visitImplicitParameters(ast,n);           break;
+                case GroovyTokenTypes.IMPORT                        :   v.visitImport(ast,n);                       break;
+                case GroovyTokenTypes.INC                           :   v.visitInc(ast,n);                          break;
+                case GroovyTokenTypes.INDEX_OP                      :   v.visitIndexOp(ast,n);                      break;
+                case GroovyTokenTypes.INSTANCE_INIT                 :   v.visitInstanceInit(ast,n);                 break;
+                case GroovyTokenTypes.INTERFACE_DEF                 :   v.visitInterfaceDef(ast,n);                 break;
+                case GroovyTokenTypes.LABELED_ARG                   :   v.visitLabeledArg(ast,n);                   break;
+                case GroovyTokenTypes.LABELED_STAT                  :   v.visitLabeledStat(ast,n);                  break;
+                case GroovyTokenTypes.LAND                          :   v.visitLand(ast,n);                         break;
+                case GroovyTokenTypes.LBRACK                        :   v.visitLbrack(ast,n);                       break;
+                case GroovyTokenTypes.LCURLY                        :   v.visitLcurly(ast,n);                       break;
+                case GroovyTokenTypes.LE                            :   v.visitLe(ast,n);                           break;
+                case GroovyTokenTypes.LETTER                        :   v.visitLetter(ast,n);                       break;
+                case GroovyTokenTypes.LIST_CONSTRUCTOR              :   v.visitListConstructor(ast,n);              break;
+                case GroovyTokenTypes.LITERAL_as                    :   v.visitLiteralAs(ast,n);                    break;
+                case GroovyTokenTypes.LITERAL_assert                :   v.visitLiteralAssert(ast,n);                break;
+                case GroovyTokenTypes.LITERAL_boolean               :   v.visitLiteralBoolean(ast,n);               break;
+                case GroovyTokenTypes.LITERAL_break                 :   v.visitLiteralBreak(ast,n);                 break;
+                case GroovyTokenTypes.LITERAL_byte                  :   v.visitLiteralByte(ast,n);                  break;
+                case GroovyTokenTypes.LITERAL_case                  :   v.visitLiteralCase(ast,n);                  break;
+                case GroovyTokenTypes.LITERAL_catch                 :   v.visitLiteralCatch(ast,n);                 break;
+                case GroovyTokenTypes.LITERAL_char                  :   v.visitLiteralChar(ast,n);                  break;
+                case GroovyTokenTypes.LITERAL_class                 :   v.visitLiteralClass(ast,n);                 break;
+                case GroovyTokenTypes.LITERAL_continue              :   v.visitLiteralContinue(ast,n);              break;
+                case GroovyTokenTypes.LITERAL_def                   :   v.visitLiteralDef(ast,n);                   break;
+                case GroovyTokenTypes.LITERAL_default               :   v.visitLiteralDefault(ast,n);               break;
+                case GroovyTokenTypes.LITERAL_double                :   v.visitLiteralDouble(ast,n);                break;
+                case GroovyTokenTypes.LITERAL_else                  :   v.visitLiteralElse(ast,n);                  break;
+                case GroovyTokenTypes.LITERAL_enum                  :   v.visitLiteralEnum(ast,n);                  break;
+                case GroovyTokenTypes.LITERAL_extends               :   v.visitLiteralExtends(ast,n);               break;
+                case GroovyTokenTypes.LITERAL_false                 :   v.visitLiteralFalse(ast,n);                 break;
+                case GroovyTokenTypes.LITERAL_finally               :   v.visitLiteralFinally(ast,n);               break;
+                case GroovyTokenTypes.LITERAL_float                 :   v.visitLiteralFloat(ast,n);                 break;
+                case GroovyTokenTypes.LITERAL_for                   :   v.visitLiteralFor(ast,n);                   break;
+                case GroovyTokenTypes.LITERAL_if                    :   v.visitLiteralIf(ast,n);                    break;
+                case GroovyTokenTypes.LITERAL_implements            :   v.visitLiteralImplements(ast,n);            break;
+                case GroovyTokenTypes.LITERAL_import                :   v.visitLiteralImport(ast,n);                break;
+                case GroovyTokenTypes.LITERAL_in                    :   v.visitLiteralIn(ast,n);                    break;
+                case GroovyTokenTypes.LITERAL_instanceof            :   v.visitLiteralInstanceof(ast,n);            break;
+                case GroovyTokenTypes.LITERAL_int                   :   v.visitLiteralInt(ast,n);                   break;
+                case GroovyTokenTypes.LITERAL_interface             :   v.visitLiteralInterface(ast,n);             break;
+                case GroovyTokenTypes.LITERAL_long                  :   v.visitLiteralLong(ast,n);                  break;
+                case GroovyTokenTypes.LITERAL_native                :   v.visitLiteralNative(ast,n);                break;
+                case GroovyTokenTypes.LITERAL_new                   :   v.visitLiteralNew(ast,n);                   break;
+                case GroovyTokenTypes.LITERAL_null                  :   v.visitLiteralNull(ast,n);                  break;
+                case GroovyTokenTypes.LITERAL_package               :   v.visitLiteralPackage(ast,n);               break;
+                case GroovyTokenTypes.LITERAL_private               :   v.visitLiteralPrivate(ast,n);               break;
+                case GroovyTokenTypes.LITERAL_protected             :   v.visitLiteralProtected(ast,n);             break;
+                case GroovyTokenTypes.LITERAL_public                :   v.visitLiteralPublic(ast,n);                break;
+                case GroovyTokenTypes.LITERAL_return                :   v.visitLiteralReturn(ast,n);                break;
+                case GroovyTokenTypes.LITERAL_short                 :   v.visitLiteralShort(ast,n);                 break;
+                case GroovyTokenTypes.LITERAL_static                :   v.visitLiteralStatic(ast,n);                break;
+                case GroovyTokenTypes.LITERAL_super                 :   v.visitLiteralSuper(ast,n);                 break;
+                case GroovyTokenTypes.LITERAL_switch                :   v.visitLiteralSwitch(ast,n);                break;
+                case GroovyTokenTypes.LITERAL_synchronized          :   v.visitLiteralSynchronized(ast,n);          break;
+                case GroovyTokenTypes.LITERAL_this                  :   v.visitLiteralThis(ast,n);                  break;
+                case GroovyTokenTypes.LITERAL_threadsafe            :   v.visitLiteralThreadsafe(ast,n);            break;
+                case GroovyTokenTypes.LITERAL_throw                 :   v.visitLiteralThrow(ast,n);                 break;
+                case GroovyTokenTypes.LITERAL_throws                :   v.visitLiteralThrows(ast,n);                break;
+                case GroovyTokenTypes.LITERAL_transient             :   v.visitLiteralTransient(ast,n);             break;
+                case GroovyTokenTypes.LITERAL_true                  :   v.visitLiteralTrue(ast,n);                  break;
+                case GroovyTokenTypes.LITERAL_try                   :   v.visitLiteralTry(ast,n);                   break;
+                case GroovyTokenTypes.LITERAL_void                  :   v.visitLiteralVoid(ast,n);                  break;
+                case GroovyTokenTypes.LITERAL_volatile              :   v.visitLiteralVolatile(ast,n);              break;
+                case GroovyTokenTypes.LITERAL_while                 :   v.visitLiteralWhile(ast,n);                 break;
+                case GroovyTokenTypes.LNOT                          :   v.visitLnot(ast,n);                         break;
+                case GroovyTokenTypes.LOR                           :   v.visitLor(ast,n);                          break;
+                case GroovyTokenTypes.LPAREN                        :   v.visitLparen(ast,n);                       break;
+                case GroovyTokenTypes.LT                            :   v.visitLt(ast,n);                           break;
+                case GroovyTokenTypes.MAP_CONSTRUCTOR               :   v.visitMapConstructor(ast,n);               break;
+                case GroovyTokenTypes.MEMBER_POINTER                :   v.visitMemberPointer(ast,n);                break;
+                case GroovyTokenTypes.METHOD_CALL                   :   v.visitMethodCall(ast,n);                   break;
+                case GroovyTokenTypes.METHOD_DEF                    :   v.visitMethodDef(ast,n);                    break;
+                case GroovyTokenTypes.MINUS                         :   v.visitMinus(ast,n);                        break;
+                case GroovyTokenTypes.MINUS_ASSIGN                  :   v.visitMinusAssign(ast,n);                  break;
+                case GroovyTokenTypes.ML_COMMENT                    :   v.visitMlComment(ast,n);                    break;
+                case GroovyTokenTypes.MOD                           :   v.visitMod(ast,n);                          break;
+                case GroovyTokenTypes.MODIFIERS                     :   v.visitModifiers(ast,n);                    break;
+                case GroovyTokenTypes.MOD_ASSIGN                    :   v.visitModAssign(ast,n);                    break;
+                case GroovyTokenTypes.NLS                           :   v.visitNls(ast,n);                          break;
+                case GroovyTokenTypes.NOT_EQUAL                     :   v.visitNotEqual(ast,n);                     break;
+                case GroovyTokenTypes.NULL_TREE_LOOKAHEAD           :   v.visitNullTreeLookahead(ast,n);            break;
+                case GroovyTokenTypes.MULTICATCH                    :   v.visitMultiCatch(ast,n);                   break;
+                case GroovyTokenTypes.MULTICATCH_TYPES              :   v.visitMultiCatchTypes(ast,n);              break;
+                case GroovyTokenTypes.NUM_BIG_DECIMAL               :   v.visitNumBigDecimal(ast,n);                break;
+                case GroovyTokenTypes.NUM_BIG_INT                   :   v.visitNumBigInt(ast,n);                    break;
+                case GroovyTokenTypes.NUM_DOUBLE                    :   v.visitNumDouble(ast,n);                    break;
+                case GroovyTokenTypes.NUM_FLOAT                     :   v.visitNumFloat(ast,n);                     break;
+                case GroovyTokenTypes.NUM_INT                       :   v.visitNumInt(ast,n);                       break;
+                case GroovyTokenTypes.NUM_LONG                      :   v.visitNumLong(ast,n);                      break;
+                case GroovyTokenTypes.OBJBLOCK                      :   v.visitObjblock(ast,n);                     break;
+                case GroovyTokenTypes.ONE_NL                        :   v.visitOneNl(ast,n);                        break;
+                case GroovyTokenTypes.OPTIONAL_DOT                  :   v.visitOptionalDot(ast,n);                  break;
+                case GroovyTokenTypes.PACKAGE_DEF                   :   v.visitPackageDef(ast,n);                   break;
+                case GroovyTokenTypes.PARAMETERS                    :   v.visitParameters(ast,n);                   break;
+                case GroovyTokenTypes.PARAMETER_DEF                 :   v.visitParameterDef(ast,n);                 break;
+                case GroovyTokenTypes.PLUS                          :   v.visitPlus(ast,n);                         break;
+                case GroovyTokenTypes.PLUS_ASSIGN                   :   v.visitPlusAssign(ast,n);                   break;
+                case GroovyTokenTypes.POST_DEC                      :   v.visitPostDec(ast,n);                      break;
+                case GroovyTokenTypes.POST_INC                      :   v.visitPostInc(ast,n);                      break;
+                case GroovyTokenTypes.QUESTION                      :   v.visitQuestion(ast,n);                     break;
+                case GroovyTokenTypes.RANGE_EXCLUSIVE               :   v.visitRangeExclusive(ast,n);               break;
+                case GroovyTokenTypes.RANGE_INCLUSIVE               :   v.visitRangeInclusive(ast,n);               break;
+                case GroovyTokenTypes.RBRACK                        :   v.visitRbrack(ast,n);                       break;
+                case GroovyTokenTypes.RCURLY                        :   v.visitRcurly(ast,n);                       break;
+                case GroovyTokenTypes.REGEXP_CTOR_END               :   v.visitRegexpCtorEnd(ast,n);                break;
+                case GroovyTokenTypes.REGEXP_LITERAL                :   v.visitRegexpLiteral(ast,n);                break;
+                case GroovyTokenTypes.REGEXP_SYMBOL                 :   v.visitRegexpSymbol(ast,n);                 break;
+                case GroovyTokenTypes.REGEX_FIND                    :   v.visitRegexFind(ast,n);                    break;
+                case GroovyTokenTypes.REGEX_MATCH                   :   v.visitRegexMatch(ast,n);                   break;
+                case GroovyTokenTypes.RPAREN                        :   v.visitRparen(ast,n);                       break;
+                case GroovyTokenTypes.SELECT_SLOT                   :   v.visitSelectSlot(ast,n);                   break;
+                case GroovyTokenTypes.SEMI                          :   v.visitSemi(ast,n);                         break;
+                case GroovyTokenTypes.SH_COMMENT                    :   v.visitShComment(ast,n);                    break;
+                case GroovyTokenTypes.SL                            :   v.visitSl(ast,n);                           break;
+                case GroovyTokenTypes.SLIST                         :   v.visitSlist(ast,n);                        break;
+                case GroovyTokenTypes.SL_ASSIGN                     :   v.visitSlAssign(ast,n);                     break;
+                case GroovyTokenTypes.SL_COMMENT                    :   v.visitSlComment(ast,n);                    break;
+                case GroovyTokenTypes.SPREAD_ARG                    :   v.visitSpreadArg(ast,n);                    break;
+                case GroovyTokenTypes.SPREAD_DOT                    :   v.visitSpreadDot(ast,n);                    break;
+                case GroovyTokenTypes.SPREAD_MAP_ARG                :   v.visitSpreadMapArg(ast,n);                 break;
+                case GroovyTokenTypes.SR                            :   v.visitSr(ast,n);                           break;
+                case GroovyTokenTypes.SR_ASSIGN                     :   v.visitSrAssign(ast,n);                     break;
+                case GroovyTokenTypes.STAR                          :   v.visitStar(ast,n);                         break;
+                case GroovyTokenTypes.STAR_ASSIGN                   :   v.visitStarAssign(ast,n);                   break;
+                case GroovyTokenTypes.STAR_STAR                     :   v.visitStarStar(ast,n);                     break;
+                case GroovyTokenTypes.STAR_STAR_ASSIGN              :   v.visitStarStarAssign(ast,n);               break;
+                case GroovyTokenTypes.STATIC_IMPORT                 :   v.visitStaticImport(ast,n);                 break;
+                case GroovyTokenTypes.STATIC_INIT                   :   v.visitStaticInit(ast,n);                   break;
+                case GroovyTokenTypes.STRICTFP                      :   v.visitStrictfp(ast,n);                     break;
+                case GroovyTokenTypes.STRING_CH                     :   v.visitStringCh(ast,n);                     break;
+                case GroovyTokenTypes.STRING_CONSTRUCTOR            :   v.visitStringConstructor(ast,n);            break;
+                case GroovyTokenTypes.STRING_CTOR_END               :   v.visitStringCtorEnd(ast,n);                break;
+                case GroovyTokenTypes.STRING_CTOR_MIDDLE            :   v.visitStringCtorMiddle(ast,n);             break;
+                case GroovyTokenTypes.STRING_CTOR_START             :   v.visitStringCtorStart(ast,n);              break;
+                case GroovyTokenTypes.STRING_LITERAL                :   v.visitStringLiteral(ast,n);                break;
+                case GroovyTokenTypes.STRING_NL                     :   v.visitStringNl(ast,n);                     break;
+                case GroovyTokenTypes.SUPER_CTOR_CALL               :   v.visitSuperCtorCall(ast,n);                break;
+                case GroovyTokenTypes.TRAIT_DEF                     :   v.visitTraitDef(ast,n);                     break;
+                case GroovyTokenTypes.TRIPLE_DOT                    :   v.visitTripleDot(ast,n);                    break;
+                case GroovyTokenTypes.TYPE                          :   v.visitType(ast,n);                         break;
+                case GroovyTokenTypes.TYPECAST                      :   v.visitTypecast(ast,n);                     break;
+                case GroovyTokenTypes.TYPE_ARGUMENT                 :   v.visitTypeArgument(ast,n);                 break;
+                case GroovyTokenTypes.TYPE_ARGUMENTS                :   v.visitTypeArguments(ast,n);                break;
+                case GroovyTokenTypes.TYPE_LOWER_BOUNDS             :   v.visitTypeLowerBounds(ast,n);              break;
+                case GroovyTokenTypes.TYPE_PARAMETER                :   v.visitTypeParameter(ast,n);                break;
+                case GroovyTokenTypes.TYPE_PARAMETERS               :   v.visitTypeParameters(ast,n);               break;
+                case GroovyTokenTypes.TYPE_UPPER_BOUNDS             :   v.visitTypeUpperBounds(ast,n);              break;
+                case GroovyTokenTypes.UNARY_MINUS                   :   v.visitUnaryMinus(ast,n);                   break;
+                case GroovyTokenTypes.UNARY_PLUS                    :   v.visitUnaryPlus(ast,n);                    break;
+                case GroovyTokenTypes.UNUSED_CONST                  :   v.visitUnusedConst(ast,n);                  break;
+                case GroovyTokenTypes.UNUSED_DO                     :   v.visitUnusedDo(ast,n);                     break;
+                case GroovyTokenTypes.UNUSED_GOTO                   :   v.visitUnusedGoto(ast,n);                   break;
+                case GroovyTokenTypes.VARIABLE_DEF                  :   v.visitVariableDef(ast,n);                  break;
+                case GroovyTokenTypes.VARIABLE_PARAMETER_DEF        :   v.visitVariableParameterDef(ast,n);         break;
+                case GroovyTokenTypes.VOCAB                         :   v.visitVocab(ast,n);                        break;
+                case GroovyTokenTypes.WILDCARD_TYPE                 :   v.visitWildcardType(ast,n);                 break;
+                case GroovyTokenTypes.WS                            :   v.visitWs(ast,n);                           break;
+
+
+                default                                             :   v.visitDefault(ast,n);                      break;
+            }
+        } else {
+            // the supplied AST was null
+            v.visitDefault(null,n);
+        }
+    }
+
+    protected abstract void accept(GroovySourceAST currentNode);
+
+    protected void accept_v_FirstChildsFirstChild_v_Child2_Child3_v_Child4_v___v_LastChild(GroovySourceAST t) {
+        openingVisit(t);
+        GroovySourceAST expr2 = t.childAt(0);
+        skip(expr2);
+        accept(expr2.childAt(0));
+        closingVisit(t);
+
+        GroovySourceAST sibling = (GroovySourceAST) expr2.getNextSibling();
+        boolean firstSList = true;
+        while (sibling != null) {
+            if (!firstSList) {
+                subsequentVisit(t);
+            }
+            firstSList = false;
+            accept(sibling);
+            sibling = (GroovySourceAST) sibling.getNextSibling();
+        }
+    }
+
+    protected void accept_v_FirstChildsFirstChild_v_RestOfTheChildren(GroovySourceAST t) {
+        openingVisit(t);
+        GroovySourceAST expr = t.childAt(0);
+        skip(expr);
+        accept(expr.childAt(0));
+        closingVisit(t);
+        acceptSiblings(expr);
+    }
+
+    protected void accept_FirstChild_v_SecondChild(GroovySourceAST t) {
+        accept(t.childAt(0));
+        subsequentVisit(t);
+        accept(t.childAt(1));
+    }
+
+    protected void accept_FirstChild_v_SecondChild_v(GroovySourceAST t) {
+        accept(t.childAt(0));
+        openingVisit(t);
+        accept(t.childAt(1));
+        closingVisit(t);
+    }
+
+    protected void accept_SecondChild_v_ThirdChild_v(GroovySourceAST t) {
+        accept(t.childAt(1));
+        openingVisit(t);
+        accept(t.childAt(2));
+        closingVisit(t);
+    }
+
+    protected void accept_FirstChild_v_SecondChildsChildren_v(GroovySourceAST t) {
+        accept(t.childAt(0));
+
+        openingVisit(t);
+        GroovySourceAST secondChild = t.childAt(1);
+        if (secondChild != null) {
+            acceptChildren(secondChild);
+        }
+        closingVisit(t);
+    }
+
+
+    protected void accept_v_FirstChild_SecondChild_v_ThirdChild_v(GroovySourceAST t) {
+        openingVisit(t);
+        accept(t.childAt(0));
+        accept(t.childAt(1));
+        subsequentVisit(t);
+        accept(t.childAt(2));
+        closingVisit(t);
+    }
+
+    protected void accept_FirstChild_v_SecondChild_v_ThirdChild_v(GroovySourceAST t) {
+        accept(t.childAt(0));
+        openingVisit(t);
+        accept(t.childAt(1));
+        subsequentVisit(t);
+        accept(t.childAt(2));
+        closingVisit(t);
+    }
+
+    protected void accept_FirstSecondAndThirdChild_v_v_ForthChild(GroovySourceAST t) {
+        GroovySourceAST child1 = (GroovySourceAST) t.getFirstChild();
+        if (child1 != null) {
+            accept(child1);
+            GroovySourceAST child2 = (GroovySourceAST) child1.getNextSibling();
+            if (child2 != null) {
+                accept(child2);
+                GroovySourceAST child3 = (GroovySourceAST) child2.getNextSibling();
+                if (child3 != null) {
+                    accept(child3);
+                    openingVisit(t);
+                    GroovySourceAST child4 = (GroovySourceAST) child3.getNextSibling();
+                    if (child4 != null) {
+                        subsequentVisit(t);
+                        accept(child4);
+                    }
+                }
+            }
+        }
+    }
+
+    protected void accept_v_FirstChild_2ndv_SecondChild_v___LastChild_v(GroovySourceAST t) {
+        openingVisit(t);
+        GroovySourceAST child = (GroovySourceAST) t.getFirstChild();
+        if (child != null) {
+            accept(child);
+            GroovySourceAST sibling = (GroovySourceAST) child.getNextSibling();
+            if (sibling != null) {
+                secondVisit(t);
+                accept(sibling);
+                sibling = (GroovySourceAST) sibling.getNextSibling();
+                while (sibling != null) {
+                    subsequentVisit(t);
+                    accept(sibling);
+                    sibling = (GroovySourceAST) sibling.getNextSibling();
+                }
+            }
+        }
+        closingVisit(t);
+    }
+
+    protected void accept_v_FirstChild_v_SecondChild_v___LastChild_v(GroovySourceAST t) {
+        openingVisit(t);
+        GroovySourceAST child = (GroovySourceAST) t.getFirstChild();
+        if (child != null) {
+            accept(child);
+            GroovySourceAST sibling = (GroovySourceAST) child.getNextSibling();
+            while (sibling != null) {
+                subsequentVisit(t);
+                accept(sibling);
+                sibling = (GroovySourceAST) sibling.getNextSibling();
+            }
+        }
+        closingVisit(t);
+    }
+
+    protected void accept_v_FirstChild_v(GroovySourceAST t) {
+        openingVisit(t);
+        accept(t.childAt(0));
+        closingVisit(t);
+    }
+
+    protected void accept_v_Siblings_v(GroovySourceAST t) {
+        openingVisit(t);
+        acceptSiblings(t);
+        closingVisit(t);
+    }
+
+    protected void accept_v_AllChildren_v_Siblings(GroovySourceAST t) {
+        openingVisit(t);
+        acceptChildren(t);
+        closingVisit(t);
+        acceptSiblings(t);
+    }
+
+    protected void accept_v_AllChildren_v(GroovySourceAST t) {
+        openingVisit(t);
+        acceptChildren(t);
+        closingVisit(t);
+    }
+
+    protected void accept_FirstChild_v_RestOfTheChildren(GroovySourceAST t) {
+        accept(t.childAt(0));
+        openingVisit(t);
+        closingVisit(t);
+        acceptSiblings(t.childAt(0));
+    }
+
+    protected void accept_FirstChild_v_RestOfTheChildren_v_LastChild(GroovySourceAST t) {
+        int count = 0;
+        accept(t.childAt(0));
+        count++;
+        openingVisit(t);
+        if (t.childAt(0) != null) {
+            GroovySourceAST sibling = (GroovySourceAST) t.childAt(0).getNextSibling();
+            while (sibling != null) {
+                if (count == t.getNumberOfChildren() - 1) {
+                    closingVisit(t);
+                }
+                accept(sibling);
+                count++;
+                sibling = (GroovySourceAST) sibling.getNextSibling();
+            }
+        }
+
+
+    }
+
+    protected void accept_FirstChild_v_RestOfTheChildren_v(GroovySourceAST t) {
+        accept(t.childAt(0));
+        openingVisit(t);
+        acceptSiblings(t.childAt(0));
+        closingVisit(t);
+    }
+
+    protected void accept_v_FirstChild_v_RestOfTheChildren(GroovySourceAST t) {
+        accept_v_FirstChild_v(t);
+        acceptSiblings(t.childAt(0));
+    }
+
+    protected void accept_v_FirstChild_v_RestOfTheChildren_v(GroovySourceAST t) {
+        openingVisit(t);
+        accept(t.childAt(0));
+        subsequentVisit(t);
+        acceptSiblings(t.childAt(0));
+        closingVisit(t);
+    }
+
+    protected void acceptSiblings(GroovySourceAST t) {
+        if (t != null) {
+            GroovySourceAST sibling = (GroovySourceAST) t.getNextSibling();
+            while (sibling != null) {
+                accept(sibling);
+                sibling = (GroovySourceAST) sibling.getNextSibling();
+            }
+        }
+    }
+
+    protected void acceptChildren(GroovySourceAST t) {
+        if (t != null) {
+            GroovySourceAST child = (GroovySourceAST) t.getFirstChild();
+            if (child != null) {
+                accept(child);
+                acceptSiblings(child);
+            }
+        }
+    }
+
+    protected void skip(GroovySourceAST expr) {
+        unvisitedNodes.remove(expr);
+    }
+
+    protected void openingVisit(GroovySourceAST t) {
+        unvisitedNodes.remove(t);
+
+        int n = Visitor.OPENING_VISIT;
+        visitNode(t, n);
+    }
+
+    protected void secondVisit(GroovySourceAST t) {
+        int n = Visitor.SECOND_VISIT;
+        visitNode(t, n);
+    }
+
+    protected void subsequentVisit(GroovySourceAST t) {
+        int n = Visitor.SUBSEQUENT_VISIT;
+        visitNode(t, n);
+    }
+
+    protected void closingVisit(GroovySourceAST t) {
+        int n = Visitor.CLOSING_VISIT;
+        visitNode(t, n);
+    }
+
+    public AST process(AST t) {
+        GroovySourceAST node = (GroovySourceAST) t;
+
+        // process each node in turn
+        setUp(node);
+        accept(node);
+        acceptSiblings(node);
+        tearDown(node);
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/a188738d/src/main/java/org/codehaus/groovy/antlr/treewalker/Visitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/antlr/treewalker/Visitor.java b/src/main/java/org/codehaus/groovy/antlr/treewalker/Visitor.java
new file mode 100644
index 0000000..841e4ca
--- /dev/null
+++ b/src/main/java/org/codehaus/groovy/antlr/treewalker/Visitor.java
@@ -0,0 +1,260 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.codehaus.groovy.antlr.treewalker;
+
+import org.codehaus.groovy.antlr.GroovySourceAST;
+
+/**
+ * An interface for visiting a GroovySourceAST node.
+ *
+ * @author <a href="mailto:groovy@ross-rayner.com">Jeremy Rayner</a>
+ */
+
+public interface Visitor {
+    int OPENING_VISIT = 1;
+    int SECOND_VISIT = 2; // only used on rare occasions, e.g. the '(' in this snippet...   @Foo  (  a=1, b=2, c=3)
+    int SUBSEQUENT_VISIT = 3;
+    int CLOSING_VISIT = 4;
+
+    void setUp();
+    void visitAbstract(GroovySourceAST t, int visit);
+    void visitAnnotation(GroovySourceAST t, int visit);
+    void visitAnnotations(GroovySourceAST t, int visit);
+    void visitAnnotationArrayInit(GroovySourceAST t, int visit);
+    void visitAnnotationDef(GroovySourceAST t, int visit);
+    void visitAnnotationFieldDef(GroovySourceAST t, int visit);
+    void visitAnnotationMemberValuePair(GroovySourceAST t, int visit);
+    void visitArrayDeclarator(GroovySourceAST t, int visit);
+    void visitAssign(GroovySourceAST t, int visit);
+    void visitAt(GroovySourceAST t, int visit);
+    void visitBand(GroovySourceAST t, int visit);
+    void visitBandAssign(GroovySourceAST t, int visit);
+    void visitBigSuffix(GroovySourceAST t, int visit);
+    void visitBlock(GroovySourceAST t, int visit);
+    void visitBnot(GroovySourceAST t, int visit);
+    void visitBor(GroovySourceAST t, int visit);
+    void visitBorAssign(GroovySourceAST t, int visit);
+    void visitBsr(GroovySourceAST t, int visit);
+    void visitBsrAssign(GroovySourceAST t, int visit);
+    void visitBxor(GroovySourceAST t, int visit);
+    void visitBxorAssign(GroovySourceAST t, int visit);
+    void visitCaseGroup(GroovySourceAST t, int visit);
+    void visitClassDef(GroovySourceAST t, int visit);
+    void visitClosedBlock(GroovySourceAST t, int visit);
+    void visitClosureList(GroovySourceAST t, int visit);
+    void visitClosureOp(GroovySourceAST t, int visit);
+    void visitColon(GroovySourceAST t, int visit);
+    void visitComma(GroovySourceAST t, int visit);
+    void visitCompareTo(GroovySourceAST t, int visit);
+    void visitCtorCall(GroovySourceAST t, int visit);
+    void visitCtorIdent(GroovySourceAST t, int visit);
+    void visitDec(GroovySourceAST t, int visit);
+    void visitDigit(GroovySourceAST t, int visit);
+    void visitDiv(GroovySourceAST t, int visit);
+    void visitDivAssign(GroovySourceAST t, int visit);
+    void visitDollar(GroovySourceAST t, int visit);
+    void visitDot(GroovySourceAST t, int visit);
+    void visitDynamicMember(GroovySourceAST t, int visit);
+    void visitElist(GroovySourceAST t, int visit);
+    void visitEmptyStat(GroovySourceAST t, int visit);
+    void visitEnumConstantDef(GroovySourceAST t, int visit);
+    void visitEnumDef(GroovySourceAST t, int visit);
+    void visitEof(GroovySourceAST t, int visit);
+    void visitEqual(GroovySourceAST t, int visit);
+    void visitEsc(GroovySourceAST t, int visit);
+    void visitExponent(GroovySourceAST t, int visit);
+    void visitExpr(GroovySourceAST t, int visit);
+    void visitExtendsClause(GroovySourceAST t, int visit);
+    void visitFinal(GroovySourceAST t, int visit);
+    void visitFloatSuffix(GroovySourceAST t, int visit);
+    void visitForCondition(GroovySourceAST t, int visit);
+    void visitForEachClause(GroovySourceAST t, int visit);
+    void visitForInit(GroovySourceAST t, int visit);
+    void visitForInIterable(GroovySourceAST t, int visit);
+    void visitForIterator(GroovySourceAST t, int visit);
+    void visitGe(GroovySourceAST t, int visit);
+    void visitGt(GroovySourceAST t, int visit);
+    void visitHexDigit(GroovySourceAST t, int visit);
+    void visitIdent(GroovySourceAST t, int visit);
+    void visitImplementsClause(GroovySourceAST t, int visit);
+    void visitImplicitParameters(GroovySourceAST t, int visit);
+    void visitImport(GroovySourceAST t, int visit);
+    void visitInc(GroovySourceAST t, int visit);
+    void visitIndexOp(GroovySourceAST t, int visit);
+    void visitInstanceInit(GroovySourceAST t, int visit);
+    void visitInterfaceDef(GroovySourceAST t, int visit);
+    void visitLabeledArg(GroovySourceAST t, int visit);
+    void visitLabeledStat(GroovySourceAST t, int visit);
+    void visitLand(GroovySourceAST t, int visit);
+    void visitLbrack(GroovySourceAST t, int visit);
+    void visitLcurly(GroovySourceAST t, int visit);
+    void visitLe(GroovySourceAST t, int visit);
+    void visitLetter(GroovySourceAST t, int visit);
+    void visitListConstructor(GroovySourceAST t, int visit);
+    void visitLiteralAs(GroovySourceAST t, int visit);
+    void visitLiteralAssert(GroovySourceAST t, int visit);
+    void visitLiteralBoolean(GroovySourceAST t, int visit);
+    void visitLiteralBreak(GroovySourceAST t, int visit);
+    void visitLiteralByte(GroovySourceAST t, int visit);
+    void visitLiteralCase(GroovySourceAST t, int visit);
+    void visitLiteralCatch(GroovySourceAST t, int visit);
+    void visitLiteralChar(GroovySourceAST t, int visit);
+    void visitLiteralClass(GroovySourceAST t, int visit);
+    void visitLiteralContinue(GroovySourceAST t, int visit);
+    void visitLiteralDef(GroovySourceAST t, int visit);
+    void visitLiteralDefault(GroovySourceAST t, int visit);
+    void visitLiteralDouble(GroovySourceAST t, int visit);
+    void visitLiteralElse(GroovySourceAST t, int visit);
+    void visitLiteralEnum(GroovySourceAST t, int visit);
+    void visitLiteralExtends(GroovySourceAST t, int visit);
+    void visitLiteralFalse(GroovySourceAST t, int visit);
+    void visitLiteralFinally(GroovySourceAST t, int visit);
+    void visitLiteralFloat(GroovySourceAST t, int visit);
+    void visitLiteralFor(GroovySourceAST t, int visit);
+    void visitLiteralIf(GroovySourceAST t, int visit);
+    void visitLiteralImplements(GroovySourceAST t, int visit);
+    void visitLiteralImport(GroovySourceAST t, int visit);
+    void visitLiteralIn(GroovySourceAST t, int visit);
+    void visitLiteralInstanceof(GroovySourceAST t, int visit);
+    void visitLiteralInt(GroovySourceAST t, int visit);
+    void visitLiteralInterface(GroovySourceAST t, int visit);
+    void visitLiteralLong(GroovySourceAST t, int visit);
+    void visitLiteralNative(GroovySourceAST t, int visit);
+    void visitLiteralNew(GroovySourceAST t, int visit);
+    void visitLiteralNull(GroovySourceAST t, int visit);
+    void visitLiteralPackage(GroovySourceAST t, int visit);
+    void visitLiteralPrivate(GroovySourceAST t, int visit);
+    void visitLiteralProtected(GroovySourceAST t, int visit);
+    void visitLiteralPublic(GroovySourceAST t, int visit);
+    void visitLiteralReturn(GroovySourceAST t, int visit);
+    void visitLiteralShort(GroovySourceAST t, int visit);
+    void visitLiteralStatic(GroovySourceAST t, int visit);
+    void visitLiteralSuper(GroovySourceAST t, int visit);
+    void visitLiteralSwitch(GroovySourceAST t, int visit);
+    void visitLiteralSynchronized(GroovySourceAST t, int visit);
+    void visitLiteralThis(GroovySourceAST t, int visit);
+    void visitLiteralThreadsafe(GroovySourceAST t, int visit);
+    void visitLiteralThrow(GroovySourceAST t, int visit);
+    void visitLiteralThrows(GroovySourceAST t, int visit);
+    void visitLiteralTransient(GroovySourceAST t, int visit);
+    void visitLiteralTrue(GroovySourceAST t, int visit);
+    void visitLiteralTry(GroovySourceAST t, int visit);
+    void visitLiteralVoid(GroovySourceAST t, int visit);
+    void visitLiteralVolatile(GroovySourceAST t, int visit);
+    void visitLiteralWhile(GroovySourceAST t, int visit);
+    void visitLnot(GroovySourceAST t, int visit);
+    void visitLor(GroovySourceAST t, int visit);
+    void visitLparen(GroovySourceAST t, int visit);
+    void visitLt(GroovySourceAST t, int visit);
+    void visitMapConstructor(GroovySourceAST t, int visit);
+    void visitMemberPointer(GroovySourceAST t, int visit);
+    void visitMethodCall(GroovySourceAST t, int visit);
+    void visitMethodDef(GroovySourceAST t, int visit);
+    void visitMinus(GroovySourceAST t, int visit);
+    void visitMinusAssign(GroovySourceAST t, int visit);
+    void visitMlComment(GroovySourceAST t, int visit);
+    void visitMod(GroovySourceAST t, int visit);
+    void visitModifiers(GroovySourceAST t, int visit);
+    void visitModAssign(GroovySourceAST t, int visit);
+    void visitMultiCatch(GroovySourceAST t, int visit);
+    void visitMultiCatchTypes(GroovySourceAST t, int visit);
+    void visitNls(GroovySourceAST t, int visit);
+    void visitNotEqual(GroovySourceAST t, int visit);
+    void visitNullTreeLookahead(GroovySourceAST t, int visit);
+    void visitNumBigDecimal(GroovySourceAST t, int visit);
+    void visitNumBigInt(GroovySourceAST t, int visit);
+    void visitNumDouble(GroovySourceAST t, int visit);
+    void visitNumFloat(GroovySourceAST t, int visit);
+    void visitNumInt(GroovySourceAST t, int visit);
+    void visitNumLong(GroovySourceAST t, int visit);
+    void visitObjblock(GroovySourceAST t, int visit);
+    void visitOneNl(GroovySourceAST t, int visit);
+    void visitOptionalDot(GroovySourceAST t, int visit);
+    void visitPackageDef(GroovySourceAST t, int visit);
+    void visitParameters(GroovySourceAST t, int visit);
+    void visitParameterDef(GroovySourceAST t, int visit);
+    void visitPlus(GroovySourceAST t, int visit);
+    void visitPlusAssign(GroovySourceAST t, int visit);
+    void visitPostDec(GroovySourceAST t, int visit);
+    void visitPostInc(GroovySourceAST t, int visit);
+    void visitQuestion(GroovySourceAST t, int visit);
+    void visitRangeExclusive(GroovySourceAST t, int visit);
+    void visitRangeInclusive(GroovySourceAST t, int visit);
+    void visitRbrack(GroovySourceAST t, int visit);
+    void visitRcurly(GroovySourceAST t, int visit);
+    void visitRegexpCtorEnd(GroovySourceAST t, int visit);
+    void visitRegexpLiteral(GroovySourceAST t, int visit);
+    void visitRegexpSymbol(GroovySourceAST t, int visit);
+    void visitRegexFind(GroovySourceAST t, int visit);
+    void visitRegexMatch(GroovySourceAST t, int visit);
+    void visitRparen(GroovySourceAST t, int visit);
+    void visitSelectSlot(GroovySourceAST t, int visit);
+    void visitSemi(GroovySourceAST t, int visit);
+    void visitShComment(GroovySourceAST t, int visit);
+    void visitSl(GroovySourceAST t, int visit);
+    void visitSlist(GroovySourceAST t, int visit);
+    void visitSlAssign(GroovySourceAST t, int visit);
+    void visitSlComment(GroovySourceAST t, int visit);
+    void visitSpreadArg(GroovySourceAST t, int visit);
+    void visitSpreadDot(GroovySourceAST t, int visit);
+    void visitSpreadMapArg(GroovySourceAST t, int visit);
+    void visitSr(GroovySourceAST t, int visit);
+    void visitSrAssign(GroovySourceAST t, int visit);
+    void visitStar(GroovySourceAST t, int visit);
+    void visitStarAssign(GroovySourceAST t, int visit);
+    void visitStarStar(GroovySourceAST t, int visit);
+    void visitStarStarAssign(GroovySourceAST t, int visit);
+    void visitStaticImport(GroovySourceAST t, int visit);
+    void visitStaticInit(GroovySourceAST t, int visit);
+    void visitStrictfp(GroovySourceAST t, int visit);
+    void visitStringCh(GroovySourceAST t, int visit);
+    void visitStringConstructor(GroovySourceAST t, int visit);
+    void visitStringCtorEnd(GroovySourceAST t, int visit);
+    void visitStringCtorMiddle(GroovySourceAST t, int visit);
+    void visitStringCtorStart(GroovySourceAST t, int visit);
+    void visitStringLiteral(GroovySourceAST t, int visit);
+    void visitStringNl(GroovySourceAST t, int visit);
+    void visitSuperCtorCall(GroovySourceAST t, int visit);
+    void visitTraitDef(GroovySourceAST t, int visit);
+    void visitTripleDot(GroovySourceAST t, int visit);
+    void visitType(GroovySourceAST t, int visit);
+    void visitTypecast(GroovySourceAST t, int visit);
+    void visitTypeArgument(GroovySourceAST t, int visit);
+    void visitTypeArguments(GroovySourceAST t, int visit);
+    void visitTypeLowerBounds(GroovySourceAST t, int visit);
+    void visitTypeParameter(GroovySourceAST t, int visit);
+    void visitTypeParameters(GroovySourceAST t, int visit);
+    void visitTypeUpperBounds(GroovySourceAST t, int visit);
+    void visitUnaryMinus(GroovySourceAST t, int visit);
+    void visitUnaryPlus(GroovySourceAST t, int visit);
+    void visitUnusedConst(GroovySourceAST t, int visit);
+    void visitUnusedDo(GroovySourceAST t, int visit);
+    void visitUnusedGoto(GroovySourceAST t, int visit);
+    void visitVariableDef(GroovySourceAST t, int visit);
+    void visitVariableParameterDef(GroovySourceAST t, int visit);
+    void visitVocab(GroovySourceAST t, int visit);
+    void visitWildcardType(GroovySourceAST t, int visit);
+    void visitWs(GroovySourceAST t, int visit);
+
+    void visitDefault(GroovySourceAST t,int visit);
+    void tearDown();
+
+    void push(GroovySourceAST t);
+    GroovySourceAST pop();
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/a188738d/src/main/java/org/codehaus/groovy/antlr/treewalker/VisitorAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/antlr/treewalker/VisitorAdapter.java b/src/main/java/org/codehaus/groovy/antlr/treewalker/VisitorAdapter.java
new file mode 100644
index 0000000..a6e8063
--- /dev/null
+++ b/src/main/java/org/codehaus/groovy/antlr/treewalker/VisitorAdapter.java
@@ -0,0 +1,258 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.codehaus.groovy.antlr.treewalker;
+
+import org.codehaus.groovy.antlr.GroovySourceAST;
+
+
+/**
+ * A default implementation of all visitor methods.
+ * If you extend this class, any un-overridden visit methods will
+ * call visitDefault.
+ *
+ * @author <a href="mailto:groovy@ross-rayner.com">Jeremy Rayner</a>
+ */
+
+public class VisitorAdapter implements Visitor {
+    public void setUp() {}
+    public void visitAbstract(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitAnnotation(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitAnnotations(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitAnnotationArrayInit(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitAnnotationDef(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitAnnotationFieldDef(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitAnnotationMemberValuePair(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitArrayDeclarator(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitAssign(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitAt(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitBand(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitBandAssign(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitBigSuffix(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitBlock(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitBnot(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitBor(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitBorAssign(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitBsr(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitBsrAssign(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitBxor(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitBxorAssign(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitCaseGroup(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitClassDef(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitClosedBlock(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitClosureOp(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitClosureList(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitColon(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitComma(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitCompareTo(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitCtorCall(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitCtorIdent(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitDec(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitDigit(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitDiv(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitDivAssign(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitDollar(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitDot(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitDynamicMember(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitElist(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitEmptyStat(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitEnumConstantDef(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitEnumDef(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitEof(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitEqual(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitEsc(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitExponent(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitExpr(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitExtendsClause(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitFinal(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitFloatSuffix(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitForCondition(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitForEachClause(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitForInit(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitForInIterable(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitForIterator(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitGe(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitGt(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitHexDigit(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitIdent(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitImplementsClause(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitImplicitParameters(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitImport(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitInc(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitIndexOp(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitInstanceInit(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitInterfaceDef(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLabeledArg(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLabeledStat(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLand(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLbrack(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLcurly(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLe(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLetter(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitListConstructor(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralAs(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralAssert(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralBoolean(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralBreak(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralByte(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralCase(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralCatch(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralChar(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralClass(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralContinue(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralDef(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralDefault(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralDouble(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralElse(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralEnum(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralExtends(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralFalse(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralFinally(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralFloat(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralFor(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralIf(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralImplements(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralImport(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralIn(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralInstanceof(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralInt(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralInterface(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralLong(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralNative(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralNew(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralNull(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralPackage(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralPrivate(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralProtected(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralPublic(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralReturn(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralShort(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralStatic(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralSuper(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralSwitch(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralSynchronized(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralThis(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralThreadsafe(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralThrow(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralThrows(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralTransient(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralTrue(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralTry(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralVoid(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralVolatile(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLiteralWhile(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLnot(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLor(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLparen(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitLt(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitMapConstructor(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitMemberPointer(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitMethodCall(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitMethodDef(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitMinus(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitMinusAssign(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitMlComment(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitMod(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitModifiers(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitModAssign(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitMultiCatch(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitMultiCatchTypes(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitNls(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitNotEqual(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitNullTreeLookahead(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitNumBigDecimal(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitNumBigInt(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitNumDouble(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitNumFloat(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitNumInt(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitNumLong(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitObjblock(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitOneNl(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitOptionalDot(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitPackageDef(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitParameters(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitParameterDef(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitPlus(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitPlusAssign(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitPostDec(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitPostInc(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitQuestion(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitRangeExclusive(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitRangeInclusive(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitRbrack(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitRcurly(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitRegexpCtorEnd(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitRegexpLiteral(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitRegexpSymbol(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitRegexFind(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitRegexMatch(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitRparen(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitSelectSlot(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitSemi(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitShComment(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitSl(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitSlist(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitSlAssign(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitSlComment(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitSpreadArg(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitSpreadDot(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitSpreadMapArg(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitSr(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitSrAssign(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitStar(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitStarAssign(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitStarStar(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitStarStarAssign(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitStaticImport(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitStaticInit(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitStrictfp(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitStringCh(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitStringConstructor(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitStringCtorEnd(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitStringCtorMiddle(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitStringCtorStart(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitStringLiteral(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitStringNl(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitSuperCtorCall(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitTraitDef(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitTripleDot(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitType(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitTypecast(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitTypeArgument(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitTypeArguments(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitTypeLowerBounds(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitTypeParameter(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitTypeParameters(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitTypeUpperBounds(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitUnaryMinus(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitUnaryPlus(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitUnusedConst(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitUnusedDo(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitUnusedGoto(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitVariableDef(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitVariableParameterDef(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitVocab(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitWildcardType(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+    public void visitWs(GroovySourceAST t,int visit) {visitDefault(t,visit);}
+
+    public void visitDefault(GroovySourceAST t,int visit) {}
+    public void tearDown() {}
+
+    public void push(GroovySourceAST t) {}
+    public GroovySourceAST pop() {return null;}
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/a188738d/src/main/java/org/codehaus/groovy/antlr/treewalker/package.html
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/antlr/treewalker/package.html b/src/main/java/org/codehaus/groovy/antlr/treewalker/package.html
new file mode 100644
index 0000000..9fca823
--- /dev/null
+++ b/src/main/java/org/codehaus/groovy/antlr/treewalker/package.html
@@ -0,0 +1,28 @@
+<!--
+
+     Licensed to the Apache Software Foundation (ASF) under one
+     or more contributor license agreements.  See the NOTICE file
+     distributed with this work for additional information
+     regarding copyright ownership.  The ASF licenses this file
+     to you under the Apache License, Version 2.0 (the
+     "License"); you may not use this file except in compliance
+     with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing,
+     software distributed under the License is distributed on an
+     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+     KIND, either express or implied.  See the License for the
+     specific language governing permissions and limitations
+     under the License.
+
+-->
+<html>
+  <head>
+    <title>package org.codehaus.groovy.antlr.treewalker.*</title>
+  </head>
+  <body>
+    <p>Classes for walking the AST.</p>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/groovy/blob/a188738d/src/main/java/org/codehaus/groovy/ast/ASTNode.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/ast/ASTNode.java b/src/main/java/org/codehaus/groovy/ast/ASTNode.java
new file mode 100644
index 0000000..058af78
--- /dev/null
+++ b/src/main/java/org/codehaus/groovy/ast/ASTNode.java
@@ -0,0 +1,200 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.codehaus.groovy.ast;
+
+import org.codehaus.groovy.GroovyBugError;
+import org.codehaus.groovy.util.ListHashMap;
+
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * Base class for any AST node. This class supports basic information used in all nodes of the AST:
+ * <ul>
+ * <li> line and column number information. Usually a node represents a certain
+ * area in a text file determined by a starting position and an ending position.
+ * For nodes that do not represent this, this information will be -1. A node can
+ * also be configured in its line/col information using another node through 
+ * setSourcePosition(otherNode).</li>
+ * <li> every node can store meta data. A phase operation or transform can use 
+ * this to transport arbitrary information to another phase operation or 
+ * transform. The only requirement is that the other phase operation or transform
+ * runs after the part storing the information. If the information transport is 
+ * done it is strongly recommended to remove that meta data.</li> 
+ * <li> a text representation of this node trough getText(). This was in the
+ * past used for assertion messages. Since the usage of power asserts this 
+ * method will not be called for this purpose anymore and might be removed in
+ * future versions of Groovy</li>
+ * </ul>
+ *
+ * @author <a href="mailto:james@coredevelopers.net">James Strachan</a>
+ * @author <a href="mailto:blackdrag@gmx.org">Jochen "blackdrag" Theodorou</a>
+ */
+public class ASTNode {
+
+    private int lineNumber = -1;
+    private int columnNumber = -1;
+    private int lastLineNumber = -1;
+    private int lastColumnNumber = -1;
+    private ListHashMap metaDataMap = null;
+
+    public void visit(GroovyCodeVisitor visitor) {
+        throw new RuntimeException("No visit() method implemented for class: " + getClass().getName());
+    }
+
+    public String getText() {
+        return "<not implemented yet for class: " + getClass().getName() + ">";
+    }
+
+    public int getLineNumber() {
+        return lineNumber;
+    }
+
+    public void setLineNumber(int lineNumber) {
+        this.lineNumber = lineNumber;
+    }
+
+    public int getColumnNumber() {
+        return columnNumber;
+    }
+
+    public void setColumnNumber(int columnNumber) {
+        this.columnNumber = columnNumber;
+    }
+
+    public int getLastLineNumber() {
+        return lastLineNumber;
+    }
+
+    public void setLastLineNumber(int lastLineNumber) {
+        this.lastLineNumber = lastLineNumber;
+    }
+
+    public int getLastColumnNumber() {
+        return lastColumnNumber;
+    }
+
+    public void setLastColumnNumber(int lastColumnNumber) {
+        this.lastColumnNumber = lastColumnNumber;
+    }
+    
+    /**
+     * Sets the source position using another ASTNode.
+     * The sourcePosition consists of a line/column pair for
+     * the start and a line/column pair for the end of the
+     * expression or statement 
+     * 
+     * @param node - the node used to configure the position information
+     */
+    public void setSourcePosition(ASTNode node) {
+        this.columnNumber = node.getColumnNumber();
+        this.lastLineNumber = node.getLastLineNumber();
+        this.lastColumnNumber = node.getLastColumnNumber();
+        this.lineNumber = node.getLineNumber();
+    }
+    
+    /**
+     * Gets the node meta data. 
+     * 
+     * @param key - the meta data key
+     * @return the node meta data value for this key
+     */
+    public <T> T getNodeMetaData(Object key) {
+        if (metaDataMap == null) {
+            return (T) null;
+        }
+        return (T) metaDataMap.get(key);
+    }
+
+    /**
+     * Copies all node meta data from the other node to this one
+     * @param other - the other node
+     */
+    public void copyNodeMetaData(ASTNode other) {
+        if (other.metaDataMap == null) {
+            return;
+        }
+        if (metaDataMap == null) {
+            metaDataMap = new ListHashMap();
+        }
+        metaDataMap.putAll(other.metaDataMap);
+    }
+    
+    /**
+     * Sets the node meta data. 
+     * 
+     * @param key - the meta data key
+     * @param value - the meta data value
+     * @throws GroovyBugError if key is null or there is already meta 
+     *                        data under that key
+     */
+    public void setNodeMetaData(Object key, Object value) {
+        if (key==null) throw new GroovyBugError("Tried to set meta data with null key on "+this+".");
+        if (metaDataMap == null) {
+            metaDataMap = new ListHashMap();
+        }
+        Object old = metaDataMap.put(key,value);
+        if (old!=null) throw new GroovyBugError("Tried to overwrite existing meta data "+this+".");
+    }
+
+    /**
+     * Sets the node meta data but allows overwriting values.
+     *
+     * @param key   - the meta data key
+     * @param value - the meta data value
+     * @return the old node meta data value for this key
+     * @throws GroovyBugError if key is null
+     */
+    public Object putNodeMetaData(Object key, Object value) {
+        if (key == null) throw new GroovyBugError("Tried to set meta data with null key on " + this + ".");
+        if (metaDataMap == null) {
+            metaDataMap = new ListHashMap();
+        }
+        return metaDataMap.put(key, value);
+    }
+
+    /**
+     * Removes a node meta data entry.
+     * 
+     * @param key - the meta data key
+     * @throws GroovyBugError if the key is null
+     */
+    public void removeNodeMetaData(Object key) {
+        if (key==null) throw new GroovyBugError("Tried to remove meta data with null key "+this+".");
+        if (metaDataMap == null) {
+            return;
+        }
+        metaDataMap.remove(key);
+    }
+
+    /**
+     * Returns an unmodifiable view of the current node metadata.
+     * @return the node metadata. Always not null.
+     */
+    public Map<?,?> getNodeMetaData() {
+        if (metaDataMap==null) {
+            return Collections.emptyMap();
+        }
+        return Collections.unmodifiableMap(metaDataMap);
+    }
+
+    public ListHashMap getMetaDataMap() {
+        return metaDataMap;
+    }
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/a188738d/src/main/java/org/codehaus/groovy/ast/AnnotatedNode.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/ast/AnnotatedNode.java b/src/main/java/org/codehaus/groovy/ast/AnnotatedNode.java
new file mode 100644
index 0000000..ab5f2eb
--- /dev/null
+++ b/src/main/java/org/codehaus/groovy/ast/AnnotatedNode.java
@@ -0,0 +1,112 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.codehaus.groovy.ast;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Base class for any AST node which is capable of being annotated
+ *
+ * @author <a href="mailto:jstrachan@protique.com">James Strachan</a>
+ */
+public class AnnotatedNode extends ASTNode {
+    private List<AnnotationNode> annotations = Collections.emptyList();
+    private boolean synthetic;
+    ClassNode declaringClass;
+    private boolean hasNoRealSourcePositionFlag;
+
+    public AnnotatedNode() {
+    }
+
+    public List<AnnotationNode> getAnnotations() {
+        return annotations;
+    }
+
+    public List<AnnotationNode> getAnnotations(ClassNode type) {
+        List<AnnotationNode> ret = new ArrayList<AnnotationNode>(annotations.size());
+        for (AnnotationNode node: annotations) {
+            if (type.equals(node.getClassNode())) ret.add(node);
+        }
+        return ret;
+    }
+
+    public void addAnnotation(AnnotationNode value) {
+        checkInit();
+        annotations.add(value);
+    }
+
+    private void checkInit() {
+        if (annotations == Collections.EMPTY_LIST)
+            annotations = new ArrayList<AnnotationNode>(3);
+    }
+
+    public void addAnnotations(List<AnnotationNode> annotations) {
+        for (AnnotationNode node : annotations) {
+            addAnnotation(node);
+        }
+    }
+
+    /**
+     * returns true if this node is added by the compiler.
+     * <b>NOTE</b>: 
+     * This method has nothing to do with the synthetic flag
+     * for fields, methods or classes.              
+     * @return true if this node is added by the compiler
+     */
+    public boolean isSynthetic() {
+        return synthetic;
+    }
+
+    /**
+     * sets this node as a node added by the compiler.
+     * <b>NOTE</b>: 
+     * This method has nothing to do with the synthetic flag
+     * for fields, methods or classes.              
+     * @param synthetic - if true this node is marked as
+     *                    added by the compiler
+     */
+    public void setSynthetic(boolean synthetic) {
+        this.synthetic = synthetic;
+    }
+
+    public ClassNode getDeclaringClass() {
+        return declaringClass;
+    }
+
+    /**
+     * @param declaringClass - The declaringClass to set.
+     */
+    public void setDeclaringClass(ClassNode declaringClass) {
+        this.declaringClass = declaringClass;
+    }
+
+    /**
+     * Currently only ever returns true for default constructors
+     * added by the compiler. See GROOVY-4161.
+     */
+    public boolean hasNoRealSourcePosition() {
+        return hasNoRealSourcePositionFlag;
+    }
+
+    public void setHasNoRealSourcePosition(boolean value) {
+        this.hasNoRealSourcePositionFlag = value;
+    }
+}


Mime
View raw message