[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/8] tests: no longer play with trigraphs
From: |
Akim Demaille |
Subject: |
[PATCH 3/8] tests: no longer play with trigraphs |
Date: |
Sat, 29 Dec 2018 17:30:22 +0100 |
IMHO, we should not try to protect the user from trigraphs in the
token names, the user should address that herself if needed.
Also, trigraphs are removed from C++17, and don't exist in Java/D.
Yet we escape them there.
* tests/input.at, tests/regression.at: Here.
---
tests/input.at | 2 +-
tests/regression.at | 20 +++++++-------------
2 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/tests/input.at b/tests/input.at
index 36a1c144..d8e9ee33 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -1244,7 +1244,7 @@ char quote[] = "@:>@@:>@,";
%type <ival> '@<:@'
/* Exercise quotes in strings. */
-%token FAKE "fake @<:@@:>@ \a\b\f\n\r\t\v\"\'\?\\\u005B\U0000005c
??!??'??(??)??-??/??<??=??> \x1\1"
+%token FAKE "fake @<:@@:>@ \a\b\f\n\r\t\v\"\'\?\\\u005B\U0000005c \x1\1"
%%
/* Exercise M4 quoting: '@:>@@:>@', @<:@, 1. */
diff --git a/tests/regression.at b/tests/regression.at
index a49b7c13..0530b1e5 100644
--- a/tests/regression.at
+++ b/tests/regression.at
@@ -431,8 +431,8 @@ AT_DATA_GRAMMAR([input.y],
%token B_TOKEN "b"
%token C_TOKEN 'c'
%token 'd' D_TOKEN
-%token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"
-%token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"
+%token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081"
+%token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081"
%%
exp: "a" "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!";
%%
@@ -442,21 +442,15 @@ exp: "a" "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!";
]])
AT_BISON_OPTION_POPDEFS
-# Checking the warning message guarantees that the trigraph "??!" isn't
-# unnecessarily escaped here even though it would need to be if encoded in a
-# C-string literal. Also notice that unnecessary escaping, such as "\?", from
+# Notice that unnecessary escaping, such as "\?", from
# the user specification is eliminated.
-AT_BISON_CHECK([-o input.c input.y], [[0]], [[]],
-[[input.y:22.8-14: warning: symbol SPECIAL redeclared [-Wother]
-input.y:22.16-63: warning: symbol "\\'?\"\a\b\f\n\r\t\v\001\201\001\201??!"
used more than once as a literal string [-Wother]
-]])
AT_BISON_CHECK([-fcaret -o input.c input.y], [[0]], [[]],
[[input.y:22.8-14: warning: symbol SPECIAL redeclared [-Wother]
- %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"
+ %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081"
^^^^^^^
-input.y:22.16-63: warning: symbol "\\'?\"\a\b\f\n\r\t\v\001\201\001\201??!"
used more than once as a literal string [-Wother]
- %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+input.y:22.16-60: warning: symbol "\\'?\"\a\b\f\n\r\t\v\001\201\001\201" used
more than once as a literal string [-Wother]
+ %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081"
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
]])
AT_COMPILE([input])
--
2.20.0
- [PATCH 0/8] Revamp the handling token string aliases in error messages, Akim Demaille, 2018/12/29
- [PATCH 6/8] tests: check that internationalization of token works, Akim Demaille, 2018/12/29
- [PATCH 7/8] translate bison's own tokens, Akim Demaille, 2018/12/29
- [PATCH 4/8] parsers: don't double escape tnames, Akim Demaille, 2018/12/29
- [PATCH 2/8] parsers: revamp the interface of yytnamerr, Akim Demaille, 2018/12/29
- [PATCH 1/8] yacc.c: avoid negated if, Akim Demaille, 2018/12/29
- [PATCH 3/8] tests: no longer play with trigraphs,
Akim Demaille <=
- [PATCH 5/8] parsers: support translatable token aliases, Akim Demaille, 2018/12/29
- [PATCH 8/8] regen, Akim Demaille, 2018/12/29