aboutsummaryrefslogtreecommitdiff
path: root/ast.c
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2014-03-25 18:27:50 +0800
committerTeddy <ted.sybil@gmail.com>2014-03-25 18:27:50 +0800
commit32cc498a2eb0b189cc90918dc28f8933b2f55278 (patch)
tree1c6a8fe5961d525a7c32180cf7b927525344a184 /ast.c
parent79b8219a7b8a786740a6c57b2d819953bcf261de (diff)
location trackdownlocation_tracking
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;
+}