View Javadoc

1   package org.codehaus.groovy.antlr;
2   
3   import antlr.collections.AST;
4   import antlr.*;
5   
6   /***
7    * We have an AST subclass so we can track source information.
8    * Very odd that ANTLR doesn't do this by default.
9    *
10   * @author Mike Spille
11   * @author Jeremy Rayner <groovy@ross-rayner.com>
12   */
13  public class GroovySourceAST extends CommonAST {
14    private int line;
15    private int col;
16  
17    public GroovySourceAST() {
18    }
19  
20    public GroovySourceAST(Token t) {
21      super (t);
22    }
23  
24    public void initialize(AST ast) {
25      super.initialize(ast);
26      line = ast.getLine();
27      col = ast.getColumn();
28    }
29  
30    public void initialize(Token t) {
31      super.initialize(t);
32      line = t.getLine();
33      col = t.getColumn();
34    }
35  
36    public int getLine() {
37      return (line);
38    }
39  
40    public int getColumn() {
41      return (col);
42    }
43  }