grammar: do not add a \n at the end of blocks of code

Now that we use "braceless" (which is {...} blocks of code with
initial and final braces stripped) to denote "short" values (such as
api.namespaces), the added end-of-line is a nuisance.  As a matter of
fact, this extra-safety was useless, as every expansion of "braceless"
(aka, "user code") is followed by an end of line.

* src/parse-gram.y, src/parse-gram.c (braceless): Instead of replacing
the final brace by \n, just delete the brace.
This commit is contained in:
Akim Demaille
2013-04-04 17:21:55 +02:00
parent de5fb744c9
commit 57597927ef
2 changed files with 2 additions and 2 deletions

View File

@@ -2676,7 +2676,7 @@ yyreduce:
#line 683 "src/parse-gram.y" /* yacc.c:1668 */ #line 683 "src/parse-gram.y" /* yacc.c:1668 */
{ {
code_props plain_code; code_props plain_code;
(yyvsp[0].code)[strlen ((yyvsp[0].code)) - 1] = '\n'; (yyvsp[0].code)[strlen ((yyvsp[0].code)) - 1] = '\0';
code_props_plain_init (&plain_code, (yyvsp[0].code)+1, (yylsp[0])); code_props_plain_init (&plain_code, (yyvsp[0].code)+1, (yylsp[0]));
code_props_translate_code (&plain_code); code_props_translate_code (&plain_code);
gram_scanner_last_string_free (); gram_scanner_last_string_free ();

View File

@@ -682,7 +682,7 @@ braceless:
"{...}" "{...}"
{ {
code_props plain_code; code_props plain_code;
$1[strlen ($1) - 1] = '\n'; $1[strlen ($1) - 1] = '\0';
code_props_plain_init (&plain_code, $1+1, @1); code_props_plain_init (&plain_code, $1+1, @1);
code_props_translate_code (&plain_code); code_props_translate_code (&plain_code);
gram_scanner_last_string_free (); gram_scanner_last_string_free ();