summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-03-23 00:38:37 +0000
committerDana Jansens <danakj@orodu.net>2003-03-23 00:38:37 +0000
commitddb5d43edc8bb35dadaa83fc3b516a43c1674cc9 (patch)
treed9d3f9c26d9927c867472234f52bdb9274d6821c /openbox
parent0f25fd6ff02c65c5584ab1ec827ba60a32af8dc2 (diff)
properly parse comments!
parse booleans
Diffstat (limited to 'openbox')
-rw-r--r--openbox/cparse.l21
1 files changed, 19 insertions, 2 deletions
diff --git a/openbox/cparse.l b/openbox/cparse.l
index 5a077493..3f362668 100644
--- a/openbox/cparse.l
+++ b/openbox/cparse.l
@@ -10,6 +10,7 @@ static ConfigEntry entry = { NULL, -1 };
static void stringvalue();
static void numbervalue();
+static void boolvalue();
static void identifier();
static void newline();
static int yywrap();
@@ -20,17 +21,19 @@ string \"[^"\n]*\"
identifier [a-zA-Z][a-zA-Z0-9_.]*
white [ \t]*
assign {white}={white}
+bool ([tT][rR][uU][eE]|[fF][aA][lL][sS][eE]|[yY][eE][sS]|[nN][oO]|[oO][nN]|[oO][fF][fF])
%%
+^# comment = TRUE;
+{bool}/{white}\n boolvalue();
{string}/{white}\n stringvalue();
{number}/{white}\n numbervalue();
^{identifier}/{assign} identifier();
\n newline();
-^# comment = TRUE;
=
[ \t]
-. haserror = TRUE;
+. if (!comment) haserror = TRUE;
%%
@@ -61,6 +64,19 @@ static void numbervalue()
}
}
+static void boolvalue()
+{
+ if (!comment) {
+ if (!haserror && entry.name != NULL && (signed)entry.type < 0) {
+ entry.type = Config_Bool;
+ entry.value.bool = (!g_ascii_strcasecmp("true", yytext) ||
+ !g_ascii_strcasecmp("yes", yytext) ||
+ !g_ascii_strcasecmp("on", yytext));
+ } else
+ haserror = TRUE;
+ }
+}
+
static void identifier()
{
if (!comment) {
@@ -87,6 +103,7 @@ static void newline()
haserror = FALSE;
}
+ comment = FALSE;
++yylineno;
}