diff options
author | Teddy <ted.sybil@gmail.com> | 2014-03-25 18:27:50 +0800 |
---|---|---|
committer | Teddy <ted.sybil@gmail.com> | 2014-03-25 18:27:50 +0800 |
commit | 32cc498a2eb0b189cc90918dc28f8933b2f55278 (patch) | |
tree | 1c6a8fe5961d525a7c32180cf7b927525344a184 /ast.c | |
parent | 79b8219a7b8a786740a6c57b2d819953bcf261de (diff) |
location trackdownlocation_tracking
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; +} |