From 4ef220d9149fbfe1adc3da85290e5ffb18a21df4 Mon Sep 17 00:00:00 2001 From: Oliver Burn Date: Wed, 18 Sep 2002 23:33:17 +0000 Subject: [PATCH] fixed the problem of line/column numbers not being in the AST. --- .../tools/checkstyle/api/DetailAST.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/DetailAST.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/DetailAST.java index b914d4575..bc0222411 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/DetailAST.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/DetailAST.java @@ -44,6 +44,24 @@ public class DetailAST /** the parent token */ private DetailAST mParent; + /** @see antlr.CommonAST **/ + public void initialize(Token aTok) + { + super.initialize(aTok); + mLineNo = aTok.getLine(); + mColumnNo = aTok.getColumn() - 1; // expect columns to start @ 0 + } + + /** @see antlr.CommonAST **/ + public void initialize(AST aAST) + { + final DetailAST da = (DetailAST) aAST; + setText(da.getText()); + setType(da.getType()); + mLineNo = da.getLineNo(); + mColumnNo = da.getColumnNo(); + } + /** * Returns the number of child nodes one level below this node. That is is * does not recurse down the tree. @@ -83,14 +101,6 @@ public class DetailAST return mParent; } - /** @see antlr.CommonAST **/ - public void initialize(Token aTok) - { - super.initialize(aTok); - mLineNo = aTok.getLine(); - mColumnNo = aTok.getColumn() - 1; // expect columns to start @ 0 - } - /** @return the line number **/ public int getLineNo() {