summaryrefslogtreecommitdiffstats
path: root/usr.bin/yacc
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>1999-10-27 17:46:41 +0000
committerobrien <obrien@FreeBSD.org>1999-10-27 17:46:41 +0000
commitf7ea0f8cc3fa9fbbf4e13761b0c0f4f03092f4e6 (patch)
treeda5f0af3beea2ae7e1da74926eb6a012a2c6ce72 /usr.bin/yacc
parentf385609bb3cf97cc1959562ba43a0fc67e1a85f4 (diff)
downloadFreeBSD-src-f7ea0f8cc3fa9fbbf4e13761b0c0f4f03092f4e6.zip
FreeBSD-src-f7ea0f8cc3fa9fbbf4e13761b0c0f4f03092f4e6.tar.gz
Emit YYERRCODE into y.tab.h to help `lex' report scanning errors back to
Yacc. PR: 13562 Submitted by: W Gerald Hicks <wghicks@bellsouth.net>
Diffstat (limited to 'usr.bin/yacc')
-rw-r--r--usr.bin/yacc/output.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/yacc/output.c b/usr.bin/yacc/output.c
index 255aeea..2b6000a 100644
--- a/usr.bin/yacc/output.c
+++ b/usr.bin/yacc/output.c
@@ -863,6 +863,15 @@ output_defines()
register int c, i;
register char *s;
+ ++outline;
+ fprintf(code_file, "#define YYERRCODE %d\n", symbol_value[1]);
+
+ if(dflag)
+ {
+ fprintf(defines_file, "#ifndef YYERRCODE\n");
+ fprintf(defines_file, "#define YYERRCODE %d\n", symbol_value[1]);
+ fprintf(defines_file, "#endif\n\n");
+ }
for (i = 2; i < ntokens; ++i)
{
s = symbol_name[i];
@@ -894,9 +903,6 @@ output_defines()
}
}
- ++outline;
- fprintf(code_file, "#define YYERRCODE %d\n", symbol_value[1]);
-
if (dflag && unionized)
{
fclose(union_file);
OpenPOWER on IntegriCloud