Asama 2.2 — Add getSourceText() and getSourceRange() to ASTNode #42

Open
opened 2026-05-26 19:51:59 +03:00 by saqut · 0 comments
Owner

Goal: Given any AST node, retrieve the exact source code substring it represents.

Files to modify:

  • src/parser/ast.hpp
  • src/core/sourcefile.hpp

Requirements:

  • ASTNode::getSourceText() returns the original source code for this node.
  • ASTNode::getSourceRange() returns pair of SourceLocation (start and end).
  • Requires AST nodes to store a reference to the SourceFile.

Success criteria:

  • For BinaryExpression a + b, getSourceText() returns "a + b".
  • For IfStatement, returns the entire if block text.
**Goal:** Given any AST node, retrieve the exact source code substring it represents. **Files to modify:** - src/parser/ast.hpp - src/core/sourcefile.hpp **Requirements:** - ASTNode::getSourceText() returns the original source code for this node. - ASTNode::getSourceRange() returns pair of SourceLocation (start and end). - Requires AST nodes to store a reference to the SourceFile. **Success criteria:** - For BinaryExpression a + b, getSourceText() returns "a + b". - For IfStatement, returns the entire if block text.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: saqut/saqut-compiler#42
No description provided.