[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/11] grammar: do not add a \n at the end of blocks of code
From: |
Akim Demaille |
Subject: |
[PATCH 10/11] grammar: do not add a \n at the end of blocks of code |
Date: |
Thu, 4 Apr 2013 17:36:27 +0200 |
We now 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 is 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.
---
src/parse-gram.c | 2 +-
src/parse-gram.y | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/parse-gram.c b/src/parse-gram.c
index 8ff1d06..2cf9e86 100644
--- a/src/parse-gram.c
+++ b/src/parse-gram.c
@@ -2676,7 +2676,7 @@ yyreduce:
#line 683 "src/parse-gram.y" /* yacc.c:1668 */
{
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_translate_code (&plain_code);
gram_scanner_last_string_free ();
diff --git a/src/parse-gram.y b/src/parse-gram.y
index b633859..ebcd31b 100644
--- a/src/parse-gram.y
+++ b/src/parse-gram.y
@@ -682,7 +682,7 @@ braceless:
"{...}"
{
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_translate_code (&plain_code);
gram_scanner_last_string_free ();
--
1.8.2
- [PATCH 00/11] support "%define variable {value}", Akim Demaille, 2013/04/04
- [PATCH 05/11] grammar: style changes, Akim Demaille, 2013/04/04
- [PATCH 07/11] style: fix comments, Akim Demaille, 2013/04/04
- [PATCH 11/11] api.namespace: demonstrate and use {...} values instead of "..." values, Akim Demaille, 2013/04/04
- [PATCH 04/11] grammar: split %union to group together related aspects, Akim Demaille, 2013/04/04
- [PATCH 02/11] style: comment changes, Akim Demaille, 2013/04/04
- [PATCH 08/11] grammar: record the kind of %define variable values, Akim Demaille, 2013/04/04
- [PATCH 01/11] muscle: minor refactoring, Akim Demaille, 2013/04/04
- [PATCH 10/11] grammar: do not add a \n at the end of blocks of code,
Akim Demaille <=
- [PATCH 03/11] muscle: refactor, Akim Demaille, 2013/04/04
- [PATCH 09/11] regen, Akim Demaille, 2013/04/04
- [PATCH 06/11] regen, Akim Demaille, 2013/04/04
- Re: [PATCH 00/11] support "%define variable {value}", Joel E. Denny, 2013/04/07
- Re: [PATCH 00/11] support "%define variable {value}", Akim Demaille, 2013/04/09