errors: factor b4_error @directives

Instead of @complain, @warn, and @fatal, use a unique @complain
directive. This directive's first argument is "complain", "warn", etc.

* data/bison.m4 (m4_error): Here.
* src/scan-skel.l (at_directive_perform): Adjust.
(flag): Replace the switch by safer and more explicit if branches.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
This commit is contained in:
Theophile Ranquet
2012-10-04 10:35:41 +00:00
committed by Akim Demaille
parent b999409e09
commit 0505df0cba
2 changed files with 22 additions and 24 deletions

View File

@@ -91,7 +91,7 @@ m4_if(m4_sysval, [0], [], [m4_fatal([$0: cannot write to stdout])])])
# b4_error([[complain]], [[input.y:2.3]], [[input.y:5.4]],
# [[invalid %s]], [[foo]])
m4_define([b4_error],
[b4_cat([[@]$1[(]$2[@,]$3[@,]$4[]]dnl
[b4_cat([[@complain][(]$1[@,]$2[@,]$3[@,]$4[]]dnl
[m4_if([$#], [4], [],
[m4_foreach([b4_arg],
m4_dquote(m4_shift(m4_shift(m4_shift(m4_shift($@))))),