Step 94a: AST source spans

This commit is contained in:
Bill
2026-02-09 10:22:13 -07:00
parent f84258bffc
commit 5fdb21d74d
7 changed files with 160 additions and 8 deletions

View File

@@ -8,9 +8,24 @@ public:
std::string id;
std::string conceptType;
ASTNode* parent = nullptr;
int spanStartLine = -1;
int spanStartCol = -1;
int spanEndLine = -1;
int spanEndCol = -1;
virtual ~ASTNode() = default;
void setSpan(int startLine, int startCol, int endLine, int endCol) {
spanStartLine = startLine;
spanStartCol = startCol;
spanEndLine = endLine;
spanEndCol = endCol;
}
bool hasSpan() const {
return spanStartLine >= 0 && spanStartCol >= 0 && spanEndLine >= 0 && spanEndCol >= 0;
}
// Multi-valued child: append to role
void addChild(const std::string& role, ASTNode* child) {
child->parent = this;