shithub: riscv

Download patch

ref: 9e09742e9b5789a94b7676ff5f4e01468d2f2d88
parent: d928a6f23979bd0c91a5a192f23911f958c91a09
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Dec 7 12:00:41 EST 2015

yacc: attempt to keep line numbers right for yyparse()

as the generated parser intermixes lines from .y source
and the parser text, the line source/lineno for yyparse()
shows up wrong in the debugger. to make stack traces a
bit less crazy, put a #line 1 "/sys/lib/yaccpar" before
copying in the parser text.

--- a/sys/src/cmd/yacc.c
+++ b/sys/src/cmd/yacc.c
@@ -474,6 +474,7 @@
 	Bprint(ftable, "%4d\n};\n", 0);
 
 	/* copy parser text */
+	Bprint(ftable, "\n#line\t1\t\"%s\"\n", parser);
 	while((c=Bgetrune(finput)) != Beof) {
 		if(c == '$') {
 			if((c = Bgetrune(finput)) != 'A')