Skip to content

[V1] Add source location and spans to V1 AstNodes #1608

Open
@rchowell

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.

Metadata

Assignees

No one assigned

    Labels

    V1This is related to the V1 release of PartiQL.enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions