01: package org.codehaus.groovy.antlr.java;
02:
03: import org.codehaus.groovy.antlr.GroovySourceAST;
04: import org.codehaus.groovy.antlr.parser.GroovyTokenTypes;
05: import org.codehaus.groovy.antlr.treewalker.VisitorAdapter;
06:
07: public class Groovifier extends VisitorAdapter implements
08: GroovyTokenTypes {
09: private String[] tokenNames;
10:
11: public Groovifier(String[] tokenNames) {
12: this .tokenNames = tokenNames;
13: }
14:
15: public void visitDefault(GroovySourceAST t, int visit) {
16: if (visit == OPENING_VISIT) {
17: // only want to do this once per node...
18:
19: // remove 'public' when implied already
20: if (t.getType() == LITERAL_public) {
21: t.setType(EXPR);
22: }
23: /* if (t.getType() == MODIFIERS) {
24: GroovySourceAST publicNode = t.childOfType(LITERAL_public);
25: if (t.getNumberOfChildren() > 1 && publicNode != null) {
26: // has more than one modifier, and one of them is public
27:
28: // delete 'public' node
29: publicNode.setType(EXPR); // near enough the same as delete for now...
30: }
31: }*/
32: // ----
33: }
34: }
35: }
|