[V1] Add source location and spans to V1 AstNodes #1608
Open
Description
public abstract class AstNode {
@NotNull
public final Span span;
// .........
}
public class Location {
public final int line;
public final int column;
}
public class Span {
public final Location start;
public final Location end;
}
Something like https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/parser/SqlParserPos.java
But it would make sense to have these be lazy so that we don't create many needless objects until the locations are actually used .. just to cut down on object creation for ASTs. Really, a node should only need its line/column pair and can compute a span from the children.