summaryrefslogtreecommitdiff
path: root/yacc/reader.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1998-04-23 08:24:50 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1998-04-23 08:24:50 +0000
commit56fafddd87e147af03c871b9ce3f6be655257e5d (patch)
tree6998d37d2c3cd4da83552f9873a9f514535fc48f /yacc/reader.c
parent9d50ff267eaee25cbfbecae92dd8fad1ea9fc306 (diff)
downloadocaml-56fafddd87e147af03c871b9ce3f6be655257e5d.tar.gz
Generation de messages # lineno
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1930 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'yacc/reader.c')
-rw-r--r--yacc/reader.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/yacc/reader.c b/yacc/reader.c
index 09bfba6d87..2b77c53c3e 100644
--- a/yacc/reader.c
+++ b/yacc/reader.c
@@ -1203,8 +1203,10 @@ void copy_action(void)
insert_empty_rule();
last_was_action = 1;
- fprintf(f, "(* Rule %d, file %s, line %d *)\n",
+ /*
+ fprintf(f, "(* Rule %d, file %s, line %d *)\n",
nrules-2, input_file_name, lineno);
+ */
if (sflag)
fprintf(f, "yyact.(%d) <- (fun parser_env ->\n", nrules-2);
else
@@ -1216,7 +1218,7 @@ void copy_action(void)
for (i = 1; i <= n; i++) {
item = pitem[nitems + i - n - 1];
if (item->class == TERM && !item->tag) continue;
- fprintf(f, "\tlet dollar__%d = ", i);
+ fprintf(f, "\tlet _%d = ", i);
if (item->tag)
fprintf(f, "(peek_val parser_env %d : %s) in\n", n - i, item->tag);
else if (sflag)
@@ -1224,7 +1226,9 @@ void copy_action(void)
else
fprintf(f, "(peek_val parser_env %d : '%s) in\n", n - i, item->name);
}
- fprintf(f, "\tObj.repr((");
+ fprintf(f, "\tObj.repr((\n");
+ fprintf(f, "# %d \"%s\"\n", lineno, input_file_name);
+ for (i = cptr - line; i >= 0; i--) fputc(' ', f);
depth = 1;
cptr++;
@@ -1243,7 +1247,7 @@ loop:
item = pitem[nitems + i - n - 1];
if (item->class == TERM && !item->tag)
illegal_token_ref(i, item->name);
- fprintf(f, "dollar__%d", i);
+ fprintf(f, "_%d", i);
goto loop;
}
}