aboutsummaryrefslogtreecommitdiff
path: root/ast.c
diff options
context:
space:
mode:
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/ast.c b/ast.c
index 0ca0271..e65f2c2 100644
--- a/ast.c
+++ b/ast.c
@@ -365,11 +365,13 @@ char *cnode_debug_type_repr(CNode *ast) {
assert(type);
}
if (aptr == abuff)
- sprintf(buffer, "%s", type);
+ sprintf(buffer, "%s(%d,%d)", type,
+ ast->loc.row, ast->loc.col);
else
{
*aptr = '\0';
- sprintf(buffer, "%s:%s", type, abuff);
+ sprintf(buffer, "%s:%s(%d,%d)", type, abuff,
+ ast->loc.row, ast->loc.col);
}
return buffer;
}
@@ -407,3 +409,10 @@ void cnode_debug_print(CNode *ast, int fancy) {
cnode_debug_print_plain(ast);
puts("");
}
+
+
+CNode *cnode_add_loc(CNode *node, YYLTYPE loc) {
+ node->loc.row = loc.first_line;
+ node->loc.col = loc.first_column;
+ return node;
+}