1 package org.apache.ojb.jdo.jdoql; 2 3 17 18 import antlr.CommonAST; 19 import antlr.Token; 20 import antlr.collections.AST; 21 22 27 public class ASTWithPositionInfo extends CommonAST 28 { 29 30 private int _line = 0; 31 32 private int _column = 0; 33 34 37 public ASTWithPositionInfo() 38 { 39 super(); 40 } 41 42 47 public ASTWithPositionInfo(Token tok) 48 { 49 super(tok); 50 } 51 52 58 public int getColumn() 59 { 60 return _column; 61 } 62 63 69 public int getLine() 70 { 71 return _line; 72 } 73 74 77 public void initialize(AST ast) 78 { 79 super.initialize(ast); 80 _line = ast.getLine(); 81 _column = ast.getColumn(); 82 } 83 84 87 public void initialize(Token tok) 88 { 89 super.initialize(tok); 90 _line = tok.getLine(); 91 _column = tok.getColumn(); 92 } 93 94 97 public void addChild(AST ast) 98 { 99 if ((ast != null) && (down == null) && (_line == 0) && (_column == 0)) 100 { 101 _line = ast.getLine(); 102 _column = ast.getColumn(); 103 } 104 super.addChild(ast); 105 } 106 107 110 public void setFirstChild(AST ast) 111 { 112 if ((ast != null) && (_line == 0) && (_column == 0)) 113 { 114 _line = ast.getLine(); 115 _column = ast.getColumn(); 116 } 117 super.setFirstChild(ast); 118 } 119 } 120 | Popular Tags |