diff options
Diffstat (limited to 'ast.c')
-rw-r--r-- | ast.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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; +} |