This is the continuation of the work on the readability of errors
context.
For example, what used to be:
input.y:2.9-11: %define variable 'var' redefined
input.y:1.9-11: previous definition
is now:
input.y:2.9-11: %define variable 'var' redefined
input.y:1.9-11: previous definition
* src/muscle-tab.c (muscle_percent_define_insert): Use
complain_at_indent to output with increased indentation level.
* tests/input.at: Apply this change.
Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
if (how == MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
&& muscle_find_const (name))
{
if (how == MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
&& muscle_find_const (name))
{
muscle_percent_define_how how_old =
atoi (muscle_find_const (how_name));
if (how_old == MUSCLE_PERCENT_DEFINE_F)
muscle_percent_define_how how_old =
atoi (muscle_find_const (how_name));
if (how_old == MUSCLE_PERCENT_DEFINE_F)
free (variable_tr);
return;
}
free (variable_tr);
return;
}
- complain_at (variable_loc, _("%%define variable %s redefined"),
- quote (variable));
- complain_at (muscle_percent_define_get_loc (variable),
- _("previous definition"));
+ complain_at_indent (variable_loc, &i,
+ _("%%define variable %s redefined"), quote (variable));
+ i += SUB_INDENT;
+ complain_at_indent (muscle_percent_define_get_loc (variable), &i,
+ _("previous definition"));
}
MUSCLE_INSERT_STRING (name, value);
}
MUSCLE_INSERT_STRING (name, value);
AT_BISON_CHECK([[input-redefined.y]], [[1]], [],
[[input-redefined.y:2.9-11: %define variable 'var' redefined
AT_BISON_CHECK([[input-redefined.y]], [[1]], [],
[[input-redefined.y:2.9-11: %define variable 'var' redefined
-input-redefined.y:1.9-11: previous definition
+input-redefined.y:1.9-11: previous definition
input-redefined.y:3.10-12: %define variable 'var' redefined
input-redefined.y:3.10-12: %define variable 'var' redefined
-input-redefined.y:2.9-11: previous definition
+input-redefined.y:2.9-11: previous definition
]])
AT_DATA([input-unused.y],
]])
AT_DATA([input-unused.y],
]])
AT_BISON_CHECK([[-Dvar=cmd-d input-dg.y]], [[1]], [],
[[input-dg.y:1.9-11: %define variable 'var' redefined
]])
AT_BISON_CHECK([[-Dvar=cmd-d input-dg.y]], [[1]], [],
[[input-dg.y:1.9-11: %define variable 'var' redefined
-<command line>:2: previous definition
+<command line>:2: previous definition
]])
AT_DATA([[input-unused.y]],
]])
AT_DATA([[input-unused.y]],