X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/6b5a748937ae95af26d78e9e5e7a335351a2970d..20964c33f91dc49b9f1b97a85505dd69776fe41c:/src/scan-skel.l diff --git a/src/scan-skel.l b/src/scan-skel.l index 5126d5f2..68f528cb 100644 --- a/src/scan-skel.l +++ b/src/scan-skel.l @@ -134,7 +134,7 @@ static void fail_for_invalid_at (char const *at); { - <> complain (fatal, _("unclosed %s directive in skeleton"), argv[0]); + <> complain (NULL, fatal, _("unclosed %s directive in skeleton"), argv[0]); } %% @@ -186,65 +186,26 @@ at_directive_perform (int argc, char *argv[], char **outnamep, int *out_linenop) fail_for_at_directive_too_many_args (argv[0]); fputs (last_component (argv[1]), yyout); } - else if (STREQ (argv[0], "@warn") - || STREQ (argv[0], "@complain") - || STREQ (argv[0], "@fatal")) + else if (STREQ (argv[0], "@warn") || STREQ (argv[0], "@warn_at") + || STREQ (argv[0], "@complain") || STREQ (argv[0], "@complain_at") + || STREQ (argv[0], "@fatal") || STREQ (argv[0], "@fatal_at")) { - warnings w = flag (argv[0]); - switch (argc) - { - case 2: - complain (w, "%s", _(argv[1])); - break; - case 3: - complain (w, _(argv[1]), argv[2]); - break; - case 4: - complain (w, _(argv[1]), argv[2], argv[3]); - break; - case 5: - complain (w, _(argv[1]), argv[2], argv[3], argv[4]); - break; - case 6: - complain (w, _(argv[1]), argv[2], argv[3], argv[4], argv[5]); - break; - default: - fail_for_at_directive_too_many_args (argv[0]); - break; - } - } - else if (STREQ (argv[0], "@warn_at") - || STREQ (argv[0], "@complain_at") - || STREQ (argv[0], "@fatal_at")) - { - warnings w = flag (argv[0]); + warnings w = flag (*argv); location loc; - if (argc < 4) - fail_for_at_directive_too_few_args (argv[0]); - boundary_set_from_string (&loc.start, argv[1]); - boundary_set_from_string (&loc.end, argv[2]); - switch (argc) + location *locp = NULL; + if (STREQ (*argv + strlen (*argv) - 3, "_at")) { - case 4: - complain_at (loc, w, "%s", _(argv[3])); - break; - case 5: - complain_at (loc, w, _(argv[3]), argv[4]); - break; - case 6: - complain_at (loc, w, _(argv[3]), argv[4], argv[5]); - break; - case 7: - complain_at (loc, w, _(argv[3]), argv[4], argv[5], argv[6]); - break; - case 8: - complain_at (loc, w, _(argv[3]), argv[4], argv[5], argv[6], - argv[7]); - break; - default: - fail_for_at_directive_too_many_args (argv[0]); - break; + if (argc < 4) + fail_for_at_directive_too_few_args (argv[0]); + boundary_set_from_string (&loc.start, argv[1]); + boundary_set_from_string (&loc.end, argv[2]); + argc -= 2; + argv += 2; + locp = &loc; } + else if (argc < 2) + fail_for_at_directive_too_few_args (argv[0]); + complain_args (locp, w, argc, argv); } else if (STREQ (argv[0], "@output")) { @@ -267,19 +228,19 @@ at_directive_perform (int argc, char *argv[], char **outnamep, int *out_linenop) static void fail_for_at_directive_too_few_args (char const *at_directive_name) { - complain (fatal, _("too few arguments for %s directive in skeleton"), + complain (NULL, fatal, _("too few arguments for %s directive in skeleton"), at_directive_name); } static void fail_for_at_directive_too_many_args (char const *at_directive_name) { - complain (fatal, _("too many arguments for %s directive in skeleton"), + complain (NULL, fatal, _("too many arguments for %s directive in skeleton"), at_directive_name); } static void fail_for_invalid_at (char const *at) { - complain (fatal, "invalid @ in skeleton: %s", at); + complain (NULL, fatal, "invalid @ in skeleton: %s", at); }