[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/6] errors: indent "invalid value for %define" context
From: |
Theophile Ranquet |
Subject: |
[PATCH 4/6] errors: indent "invalid value for %define" context |
Date: |
Wed, 26 Sep 2012 15:45:14 +0200 |
From: Theophile Ranquet <address@hidden>
This is the continuation of the work on the readability of errors
context.
For example, what used to be:
input.y:1.9-29: invalid value for %define variable 'foo' : 'bar'
input.y:1.9-29: accepted value: 'most'
is now:
input.y:1.9-29: invalid value for %define variable 'foo' : 'bar'
input.y:1.9-29: accepted value: 'most'
* src/muscle-tab.c (muscle_percent_define_check_values): Use
complain_at_indent to output with increased indentation level.
* tests/input:at: Apply this change.
Signed-off-by: Akim Demaille <address@hidden>
---
src/muscle-tab.c | 11 +++++++----
tests/input.at | 7 ++++---
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/muscle-tab.c b/src/muscle-tab.c
index d187f82..37a0f0e 100644
--- a/src/muscle-tab.c
+++ b/src/muscle-tab.c
@@ -593,12 +593,15 @@ muscle_percent_define_check_values (char const * const
*values)
}
if (!*values)
{
+ unsigned i = 0;
location loc = muscle_percent_define_get_loc (*variablep);
- complain_at(loc,
- _("invalid value for %%define variable %s: %s"),
- quote (*variablep), quote_n (1, value));
+ complain_at_indent (loc, &i,
+ _("invalid value for %%define variable %s:
%s"),
+ quote (*variablep), quote_n (1, value));
+ i += SUB_INDENT;
for (values = variablep + 1; *values; ++values)
- complain_at (loc, _("accepted value: %s"), quote (*values));
+ complain_at_indent (loc, &i, _("accepted value: %s"),
+ quote (*values));
}
else
{
diff --git a/tests/input.at b/tests/input.at
index 2facf9e..f208b5f 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -1033,12 +1033,13 @@ start: ;
]])
AT_BISON_CHECK([[input.y]], [[1]], [[]],
[[input.y:1.9-29: invalid value for %define variable 'lr.default-reductions':
'bogus'
-input.y:1.9-29: accepted value: 'most'
-input.y:1.9-29: accepted value: 'consistent'
-input.y:1.9-29: accepted value: 'accepting'
+input.y:1.9-29: accepted value: 'most'
+input.y:1.9-29: accepted value: 'consistent'
+input.y:1.9-29: accepted value: 'accepting'
]])
# Back-end.
+# FIXME: these should be indented, but we shouldn't mess with the m4 yet
AT_DATA([[input.y]],
[[%define api.push-pull neither
%%
--
1.7.10
- [PATCH 0/6] {maint} errors: output prefixing, Theophile Ranquet, 2012/09/26
- [PATCH 6/6] warnings: introduce -Wdeprecated in the usage info, Theophile Ranquet, 2012/09/26
- [PATCH 1/6] errors: indent "result type clash" error context, Theophile Ranquet, 2012/09/26
- [PATCH 3/6] errors: indent "%define var" redefinition context, Theophile Ranquet, 2012/09/26
- [PATCH 4/6] errors: indent "invalid value for %define" context,
Theophile Ranquet <=
- [PATCH 5/6] errors: prefix the output with "error: ", Theophile Ranquet, 2012/09/26
- [PATCH 2/6] errors: indent "symbol redeclaration" context, Theophile Ranquet, 2012/09/26
- Re: [PATCH 0/6] {maint} errors: output prefixing, Akim Demaille, 2012/09/26
- [PATCH 0/6] {maint} errors: output prefixing, Theophile Ranquet, 2012/09/27
- [PATCH 6/6] warnings: introduce Wdeprecated in the usage info, Theophile Ranquet, 2012/09/27
- [PATCH 4/6] errors: indent "invalid value for %define" context, Theophile Ranquet, 2012/09/27
- [PATCH 2/6] errors: indent "symbol redeclaration" context, Theophile Ranquet, 2012/09/27
- [PATCH 3/6] errors: indent "%define var" redefinition context, Theophile Ranquet, 2012/09/27
- [PATCH 1/6] errors: indent "result type clash" error context, Theophile Ranquet, 2012/09/27
- [PATCH 5/6] errors: prefix the output with "error: ", Theophile Ranquet, 2012/09/27