summaryrefslogtreecommitdiff
path: root/src/gram.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/gram.y')
-rw-r--r--src/gram.y67
1 files changed, 24 insertions, 43 deletions
diff --git a/src/gram.y b/src/gram.y
index 6c4f4ea..4bf9f4c 100644
--- a/src/gram.y
+++ b/src/gram.y
@@ -281,19 +281,17 @@ stmt : error
noarg : KEYWORD { if (!do_single_keyword ($1)) {
- twmrc_error_prefix();
- fprintf (stderr,
- "unknown singleton keyword %d\n",
- $1);
+ parseWarning (
+ "unknown singleton keyword %d",
+ $1);
ParseError = 1;
}
}
;
sarg : SKEYWORD string { if (!do_string_keyword ($1, $2)) {
- twmrc_error_prefix();
- fprintf (stderr,
- "unknown string keyword %d (value \"%s\")\n",
+ parseWarning (
+ "unknown string keyword %d (value \"%s\")",
$1, $2);
ParseError = 1;
}
@@ -301,9 +299,8 @@ sarg : SKEYWORD string { if (!do_string_keyword ($1, $2)) {
;
narg : NKEYWORD number { if (!do_number_keyword ($1, $2)) {
- twmrc_error_prefix();
- fprintf (stderr,
- "unknown numeric keyword %d (value %d)\n",
+ parseWarning (
+ "unknown numeric keyword %d (value %d)",
$1, $2);
ParseError = 1;
}
@@ -327,9 +324,8 @@ key : META { mods |= Mod1Mask; }
| LOCK { mods |= LockMask; }
| CONTROL { mods |= ControlMask; }
| META number { if ($2 < 1 || $2 > 5) {
- twmrc_error_prefix();
- fprintf (stderr,
- "bad modifier number (%d), must be 1-5\n",
+ parseWarning (
+ "bad modifier number (%d), must be 1-5",
$2);
ParseError = 1;
} else {
@@ -445,9 +441,8 @@ color_entries : /* Empty */
color_entry : CLKEYWORD string { if (!do_colorlist_keyword ($1, color,
$2)) {
- twmrc_error_prefix();
- fprintf (stderr,
- "unhandled list color keyword %d (string \"%s\")\n",
+ parseWarning (
+ "unhandled list color keyword %d (string \"%s\")",
$1, $2);
ParseError = 1;
}
@@ -455,9 +450,8 @@ color_entry : CLKEYWORD string { if (!do_colorlist_keyword ($1, color,
| CLKEYWORD string { list = do_colorlist_keyword($1,color,
$2);
if (!list) {
- twmrc_error_prefix();
- fprintf (stderr,
- "unhandled color list keyword %d (string \"%s\")\n",
+ parseWarning (
+ "unhandled color list keyword %d (string \"%s\")",
$1, $2);
ParseError = 1;
}
@@ -465,9 +459,8 @@ color_entry : CLKEYWORD string { if (!do_colorlist_keyword ($1, color,
win_color_list { /* No action */; }
| CKEYWORD string { if (!do_color_keyword ($1, color,
$2)) {
- twmrc_error_prefix();
- fprintf (stderr,
- "unhandled color keyword %d (string \"%s\")\n",
+ parseWarning (
+ "unhandled color keyword %d (string \"%s\")",
$1, $2);
ParseError = 1;
}
@@ -605,18 +598,16 @@ action : FKEYWORD { $$ = $1; }
break;
case F_WARPRING:
if (!CheckWarpRingArg (Action)) {
- twmrc_error_prefix();
- fprintf (stderr,
- "ignoring invalid f.warptoring argument \"%s\"\n",
+ parseWarning (
+ "ignoring invalid f.warptoring argument \"%s\"",
Action);
$$ = F_NOP;
}
break;
case F_WARPTOSCREEN:
if (!CheckWarpScreenArg (Action)) {
- twmrc_error_prefix();
- fprintf (stderr,
- "ignoring invalid f.warptoscreen argument \"%s\"\n",
+ parseWarning (
+ "ignoring invalid f.warptoscreen argument \"%s\"",
Action);
$$ = F_NOP;
}
@@ -625,9 +616,8 @@ action : FKEYWORD { $$ = $1; }
if (CheckColormapArg (Action)) {
$$ = F_COLORMAP;
} else {
- twmrc_error_prefix();
- fprintf (stderr,
- "ignoring invalid f.colormap argument \"%s\"\n",
+ parseWarning (
+ "ignoring invalid f.colormap argument \"%s\"",
Action);
$$ = F_NOP;
}
@@ -666,8 +656,7 @@ number : NUMBER { $$ = $1; }
static void
yyerror(const char *s)
{
- twmrc_error_prefix();
- fprintf (stderr, "error in input file: %s\n", s ? s : "");
+ parseWarning ("error in input file: %s", s ? s : "");
ParseError = 1;
}
@@ -830,9 +819,8 @@ static void GotKey(char *key, int func)
static void GotTitleButton (char *bitmapname, int func, Bool rightside)
{
if (!CreateTitleButton (bitmapname, func, Action, pull, rightside, True)) {
- twmrc_error_prefix();
- fprintf (stderr,
- "unable to create %s titlebutton \"%s\"\n",
+ parseWarning (
+ "unable to create %s titlebutton \"%s\"",
rightside ? "right" : "left", bitmapname);
}
Action = empty;
@@ -876,10 +864,3 @@ static Bool CheckColormapArg (char *s)
return False;
}
-
-
-void
-twmrc_error_prefix (void)
-{
- fprintf (stderr, "%s: line %d: ", ProgramName, yylineno);
-}