]> ocean-lang.org Git - ocean/commitdiff
parsergen: add token location to tracing
authorNeilBrown <neil@brown.name>
Fri, 28 Jun 2019 09:40:11 +0000 (19:40 +1000)
committerNeilBrown <neil@brown.name>
Fri, 28 Jun 2019 09:40:11 +0000 (19:40 +1000)
When we print the look-ahead token for tracing, add the line/column
location so it can be easily cross-references to the source code.

Signed-off-by: NeilBrown <neil@brown.name>
csrc/parsergen.mdc

index fdbe0ead7ecc3d01dd080d32862ef87d296edd33..c167e0967cddac00f2fe937027ff3165b45f37bd 100644 (file)
@@ -3029,7 +3029,7 @@ end inside square brackets.
                        fputs(reserved_words[tk->num], trace);
                else
                        text_dump(trace, tk->txt, 20);
                        fputs(reserved_words[tk->num], trace);
                else
                        text_dump(trace, tk->txt, 20);
-               fputs("]", trace);
+               fprintf(trace, ":%d:%d]", tk->line, tk->col);
        }
 
        void parser_trace_action(FILE *trace, char *action)
        }
 
        void parser_trace_action(FILE *trace, char *action)