Step 94a: AST source spans
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user