[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04-scanner-epilogue.patch
From: |
Akim Demaille |
Subject: |
04-scanner-epilogue.patch |
Date: |
Tue, 12 Nov 2002 08:44:18 +0100 |
Index: 0.6/ChangeLog
--- 0.6/ChangeLog Sat, 09 Nov 2002 11:07:24 +0100 akim (bison/d/40_ChangeLog
1.4 644)
+++ 0.6(w)/ChangeLog Sat, 09 Nov 2002 16:41:24 +0100 akim (bison/d/40_ChangeLog
1.4 644)
@@ -1,5 +1,15 @@
2002-11-09 Akim Demaille <address@hidden>
+ * src/parse-gram.y (input): Don't append the epilogue here,
+ (epilogue.pot): do it here, and free the scanner's obstack.
+ * src/reader.c (get_merge_function): The type defaults to the
+ struniq "".
+ * src/reader.c (epilogue_set): Rename as...
+ (epilogue_append): this.
+ * data/c.m4 (b4_epilogue): Defaults to empty.
+
+2002-11-09 Akim Demaille <address@hidden>
+
* src/getargs.c (long_options): Remove duplicates.
* src/vmsgetargs.c, src/build.com, src/bison.cld, src/vmshlp.mar:
Remove.
Index: 0.6/src/reader.h
--- 0.6/src/reader.h Sat, 09 Nov 2002 10:36:21 +0100 akim (bison/51_reader.h
1.2 644)
+++ 0.6(w)/src/reader.h Sat, 09 Nov 2002 16:40:09 +0100 akim (bison/51_reader.h
1.2 644)
@@ -70,7 +70,7 @@
/* From reader.c. */
void grammar_start_symbol_set (symbol_t *s, location_t l);
void prologue_augment (const char *prologue, location_t location);
-void epilogue_set (const char *epilogue, location_t location);
+void epilogue_append (const char *epilogue, location_t location);
void grammar_symbol_append (symbol_t *s, location_t l);
void grammar_rule_begin (symbol_t *lhs, location_t l);
void grammar_rule_end (location_t l);
Index: 0.6/src/reader.c
--- 0.6/src/reader.c Sat, 09 Nov 2002 10:36:21 +0100 akim (bison/b/0_reader.c
1.3 644)
+++ 0.6(w)/src/reader.c Sat, 09 Nov 2002 16:41:40 +0100 akim
(bison/b/0_reader.c 1.3 644)
@@ -83,17 +83,19 @@
`----------------------*/
void
-epilogue_set (const char *epilogue, location_t location)
+epilogue_append (const char *epilogue, location_t location)
{
+ char *extension = 0;
obstack_fgrow2 (&muscle_obstack, "]b4_syncline([[%d]], [[%s]])[\n",
location.first_line,
quotearg_style (escape_quoting_style, location.file));
obstack_sgrow (&muscle_obstack, epilogue);
obstack_1grow (&muscle_obstack, 0);
- muscle_insert ("epilogue", obstack_finish (&muscle_obstack));
+ extension = obstack_finish (&muscle_obstack);
+ muscle_grow ("epilogue", extension, "");
+ obstack_free (&muscle_obstack, extension);
}
-
/*-------------------------------------------------------------------.
@@ -113,7 +115,7 @@
return 0;
if (type == NULL)
- type = "";
+ type = struniq_new ("");
head.next = merge_functions;
for (syms = &head, n = 1; syms->next != NULL; syms = syms->next, n += 1)
Index: 0.6/src/parse-gram.y
--- 0.6/src/parse-gram.y Sat, 09 Nov 2002 10:36:21 +0100 akim
(bison/b/5_parse-gram 1.3 644)
+++ 0.6(w)/src/parse-gram.y Sat, 09 Nov 2002 16:38:12 +0100 akim
(bison/b/5_parse-gram 1.3 644)
@@ -158,8 +158,10 @@
%token BRACED_CODE "{...}"
-%type <string> CHARACTER STRING string_content
- BRACED_CODE PROLOGUE EPILOGUE epilogue.opt action
+%type <string> CHARACTER
+ STRING string_content
+ BRACED_CODE action
+ PROLOGUE EPILOGUE
%type <struniq> TYPE
%type <integer> INT
%type <symbol> ID symbol string_as_id
@@ -171,7 +173,6 @@
declarations "%%" grammar epilogue.opt
{
yycontrol->errcode = 0;
- epilogue_set ($4, @4);
}
;
@@ -420,12 +421,10 @@
epilogue.opt:
/* Nothing. */
- {
- $$ = xstrdup ("");
- }
| "%%" EPILOGUE
{
- $$ = $2;
+ epilogue_append ($2, @2);
+ scanner_last_string_free ();
}
;
@@ -470,6 +469,10 @@
case EPILOGUE:
fprintf (file, " = {{ %s }}", value->string);
break;
+
+ default:
+ fprintf (file, "unknown token type");
+ break;
}
}
Index: 0.6/data/c.m4
--- 0.6/data/c.m4 Fri, 08 Nov 2002 16:19:16 +0100 akim (bison/b/46_c.m4 1.1 644)
+++ 0.6(w)/data/c.m4 Sat, 09 Nov 2002 16:27:28 +0100 akim (bison/b/46_c.m4 1.1
644)
@@ -65,6 +65,14 @@
+## ---------------- ##
+## Default values. ##
+## ---------------- ##
+
+m4_define_default([b4_epilogue], [])
+
+
+
## ------------------------ ##
## Pure/impure interfaces. ##
## ------------------------ ##
- 04-scanner-epilogue.patch,
Akim Demaille <=