Search in sources :

Example 11 with LineColumn

use of org.codehaus.groovy.antlr.LineColumn in project groovy-core by groovy.

the class LineColumnChecker method visitDefault.

public void visitDefault(GroovySourceAST t, int visit) {
    if (visit == OPENING_VISIT) {
        System.out.println("[" + tokenNames[t.getType()] + "]");
        int line = t.getLine();
        int column = t.getColumn();
        int lineLast = t.getLineLast();
        int columnLast = t.getColumnLast();
        System.out.println("" + line + " / " + column + " - " + lineLast + " / " + columnLast);
        if (line > 0 && column > 0 && lineLast > 0 && columnLast > 0) {
            System.out.println("" + sourceBuffer.getSnippet(new LineColumn(line, column), new LineColumn(lineLast, columnLast)));
        } else {
            System.out.println("ZERO");
        }
    } else if (visit == CLOSING_VISIT) {
        System.out.println();
    }
}
Also used : LineColumn(org.codehaus.groovy.antlr.LineColumn)

Aggregations

LineColumn (org.codehaus.groovy.antlr.LineColumn)11 Matcher (java.util.regex.Matcher)3 GroovySourceAST (org.codehaus.groovy.antlr.GroovySourceAST)2