[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/5] tests: simplify useless obfuscation
From: |
Akim Demaille |
Subject: |
[PATCH 2/5] tests: simplify useless obfuscation |
Date: |
Fri, 15 Nov 2013 10:19:05 +0100 |
* tests/c++.at: $$ is not special for M4, there is no need to "escape"
it.
---
tests/c++.at | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/tests/c++.at b/tests/c++.at
index e403c55..14a001a 100644
--- a/tests/c++.at
+++ b/tests/c++.at
@@ -243,7 +243,7 @@ typedef std::list<std::string> strings_type;
// digraph for the left square bracket.
%type <::std::list<std::string>> list result;
-%printer { yyo << $][$; }
+%printer { yyo << $$; }
<int> <::std::string> <::std::list<std::string>>;
%%
@@ -253,13 +253,13 @@ result:
list:
/* nothing */ { /* Generates an empty string list */ }
-| list item { std::swap ($][$,$][1); $$.push_back ($][2); }
-| list error { std::swap ($][$,$][1); }
+| list item { std::swap ($$,$][1); $$.push_back ($][2); }
+| list error { std::swap ($$,$][1); }
;
item:
- TEXT { std::swap ($][$,$][1); }
-| NUMBER { if ($][1 == 3) YYERROR; else $][$ = string_cast ($][1); }
+ TEXT { std::swap ($$,$][1); }
+| NUMBER { if ($][1 == 3) YYERROR; else $$ = string_cast ($][1); }
;
%%
]AT_TOKEN_CTOR_IF([],
@@ -785,21 +785,21 @@ $1
start: list {]AT_VARIANT_IF([], [ delete $][1]; )[};
list:
- item { $][$ = $][1; }
+ item { $$ = $][1; }
// Right recursion to load the stack.
-| item list { $][$ = $][1; ]AT_VARIANT_IF([], [delete $][2]; )[}
+| item list { $$ = $][1; ]AT_VARIANT_IF([], [delete $][2]; )[}
;
item:
- 'a' { $$][ = $][1; }
-| 'e' { YYUSE ($][$); YYUSE($][1); error ("syntax error"); }
+ 'a' { $$ = $][1; }
+| 'e' { YYUSE ($$); YYUSE($][1); error ("syntax error"); }
// Not just 'E', otherwise we reduce when 'E' is the lookahead, and
// then the stack is emptied, defeating the point of the test.
-| 'E' 'a' { YYUSE($][1); $][$ = $][2; }
-| 'R' { ]AT_VARIANT_IF([], [$][$ = YY_NULLPTR; delete $][1]; )[YYERROR; }
-| 'p' { $][$ = $][1; }
-| 's' { $][$ = $][1; throw std::runtime_error ("reduction"); }
-| 'T' { ]AT_VARIANT_IF([], [$][$ = YY_NULLPTR; delete $][1]; )[YYABORT; }
+| 'E' 'a' { YYUSE($][1); $$ = $][2; }
+| 'R' { ]AT_VARIANT_IF([], [$$ = YY_NULLPTR; delete $][1]; )[YYERROR; }
+| 'p' { $$ = $][1; }
+| 's' { $$ = $][1; throw std::runtime_error ("reduction"); }
+| 'T' { ]AT_VARIANT_IF([], [$$ = YY_NULLPTR; delete $][1]; )[YYABORT; }
| error { ]AT_VARIANT_IF([], [$][$ = YY_NULLPTR; ])[yyerrok; }
;
%%
--
1.8.4.2
- [PATCH 0/5] {maint} fix variants when YYERROR is used, Akim Demaille, 2013/11/15
- [PATCH 3/5] tests: check $$'s destruction with variant, YYERROR, and no error recovery, Akim Demaille, 2013/11/15
- [PATCH 4/5] lalr1.cc: fix the support of YYERROR with variants, Akim Demaille, 2013/11/15
- [PATCH 1/5] skeletons: use better names when computing a "goto", Akim Demaille, 2013/11/15
- [PATCH 5/5] lalr1.cc: formatting changes, Akim Demaille, 2013/11/15
- [PATCH 2/5] tests: simplify useless obfuscation,
Akim Demaille <=