#include <src/reader.h>
#include <src/uniqstr.h>
-#include <ctype.h>
+#include <c-ctype.h>
#include <mbswidth.h>
#include <quote.h>
<INITIAL,SC_AFTER_IDENTIFIER,SC_BRACKETED_ID,SC_RETURN_BRACKETED_ID>
{
/* Comments and white space. */
- "," warn_at (*loc, _("stray ',' treated as white space"));
+ "," {
+ complain_at (*loc, Wother, _("stray ',' treated as white space"));
+ }
[ \f\n\t\v] |
"//".* ;
"/*" {
"%yacc" return PERCENT_YACC;
{directive} {
- complain_at (*loc, _("invalid directive: %s"), quote (yytext));
+ complain_at (*loc, complaint, _("invalid directive: %s"), quote (yytext));
}
"=" return EQUAL;
/* Identifiers may not start with a digit. Yet, don't silently
accept "1FOO" as "1 FOO". */
{int}{id} {
- complain_at (*loc, _("invalid identifier: %s"), quote (yytext));
+ complain_at (*loc, complaint, _("invalid identifier: %s"), quote (yytext));
}
/* Characters. */
}
. {
- complain_at (*loc, _("invalid character: %s"), quote (yytext));
+ complain_at (*loc, complaint, _("invalid character: %s"), quote (yytext));
}
<<EOF>> {
<SC_ESCAPED_CHARACTER,SC_ESCAPED_STRING,SC_TAG>
{
- \0 complain_at (*loc, _("invalid null character"));
+ \0 complain_at (*loc, complaint, _("invalid null character"));
}
{id} {
if (bracketed_id_str)
{
- complain_at (*loc, _("unexpected identifier in bracketed name: %s"),
+ complain_at (*loc, complaint,
+ _("unexpected identifier in bracketed name: %s"),
quote (yytext));
}
else
}
}
else
- complain_at (*loc, _("an identifier expected"));
+ complain_at (*loc, complaint, _("an identifier expected"));
}
. {
- complain_at (*loc, _("invalid character in bracketed name: %s"),
+ complain_at (*loc, complaint, _("invalid character in bracketed name: %s"),
quote (yytext));
}
<<EOF>> {
/* FIXME: Eventually, make these errors. */
if (last_string[0] == '\0')
{
- warn_at (*loc, _("empty character literal"));
+ complain_at (*loc, Wother, _("empty character literal"));
/* '\0' seems dangerous even if we are about to complain. */
val->character = '\'';
}
else if (last_string[1] != '\0')
- warn_at (*loc, _("extra characters in character literal"));
+ complain_at (*loc, Wother,
+ _("extra characters in character literal"));
}
if (yytext[0] == '\n')
unexpected_newline (token_start, "'");
/* FIXME: Eventually, make these errors. */
if (last_string[0] == '\0')
{
- warn_at (*loc, _("empty character literal"));
+ complain_at (*loc, Wother, _("empty character literal"));
/* '\0' seems dangerous even if we are about to complain. */
val->character = '\'';
}
else if (last_string[1] != '\0')
- warn_at (*loc, _("extra characters in character literal"));
+ complain_at (*loc, Wother,
+ _("extra characters in character literal"));
}
unexpected_eof (token_start, "'");
STRING_FREE;
\\[0-7]{1,3} {
unsigned long int c = strtoul (yytext + 1, NULL, 8);
if (!c || UCHAR_MAX < c)
- complain_at (*loc, _("invalid number after \\-escape: %s"),
+ complain_at (*loc, complaint, _("invalid number after \\-escape: %s"),
yytext+1);
else
obstack_1grow (&obstack_for_string, c);
verify (UCHAR_MAX < ULONG_MAX);
unsigned long int c = strtoul (yytext + 2, NULL, 16);
if (!c || UCHAR_MAX < c)
- complain_at (*loc, _("invalid number after \\-escape: %s"),
+ complain_at (*loc, complaint, _("invalid number after \\-escape: %s"),
yytext+1);
else
obstack_1grow (&obstack_for_string, c);
\\(u|U[0-9abcdefABCDEF]{4})[0-9abcdefABCDEF]{4} {
int c = convert_ucn_to_byte (yytext);
if (c <= 0)
- complain_at (*loc, _("invalid number after \\-escape: %s"),
+ complain_at (*loc, complaint, _("invalid number after \\-escape: %s"),
yytext+1);
else
obstack_1grow (&obstack_for_string, c);
\\(.|\n) {
char const *p = yytext + 1;
/* Quote only if escaping won't make the character visible. */
- if (isspace ((unsigned char) *p) && isprint ((unsigned char) *p))
+ if (c_isspace ((unsigned char) *p) && c_isprint ((unsigned char) *p))
p = quote (p);
else
p = quotearg_style_mem (escape_quoting_style, p, 1);
- complain_at (*loc, _("invalid character after \\-escape: %s"), p);
+ complain_at (*loc, complaint, _("invalid character after \\-escape: %s"),
+ p);
}
}
if (INT_MAX < num)
{
- complain_at (loc, _("integer out of range: %s"), quote (number));
+ complain_at (loc, complaint, _("integer out of range: %s"),
+ quote (number));
num = INT_MAX;
}
*strchr (file, '"') = '\0';
if (INT_MAX <= lineno)
{
- warn_at (loc, _("line number overflow"));
+ complain_at (loc, Wother, _("line number overflow"));
lineno = INT_MAX;
}
current_file = uniqstr_new (file);
// Instead of '\'', display "'".
if (STREQ (token_end, "'\\''"))
token_end = "\"'\"";
- complain_at (loc, _(msgid), token_end);
+ complain_at (loc, complaint, _(msgid), token_end);
}