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

Closed
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.
saqut closed this issue 2026-06-14 21:53:25 +03:00
Sign in to join this conversation.
No description provided.