summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1998-12-06 18:38:42 +0100
committerMartin Mares <mj@ucw.cz>1998-12-06 18:38:42 +0100
commit166b9c4912f1a52d7910c630280cf5a076eb1990 (patch)
treeb9019ea289b7626d87fc2d642515ca4c288cf1f3
parentb35d72ac668c52ef0755cedba89bdca54bd995ac (diff)
downloadbird-166b9c4912f1a52d7910c630280cf5a076eb1990.tar
bird-166b9c4912f1a52d7910c630280cf5a076eb1990.zip
Added rule "bool" for boolean switches.
-rw-r--r--conf/confbase.Y16
1 files changed, 14 insertions, 2 deletions
diff --git a/conf/confbase.Y b/conf/confbase.Y
index 24fff87..8e32129 100644
--- a/conf/confbase.Y
+++ b/conf/confbase.Y
@@ -15,6 +15,7 @@ CF_HDR
#include "lib/timer.h"
#include "nest/protocol.h"
#include "nest/iface.h"
+#include "nest/route.h"
CF_DECLS
@@ -31,12 +32,12 @@ CF_DECLS
%token <s> SYM
%token <t> TEXT
-%type <i> expr
+%type <i> expr bool
%left '+' '-'
%left '*' '/' '%'
-CF_KEYWORDS(DEFINE)
+CF_KEYWORDS(DEFINE, ON, OFF, YES, NO)
CF_GRAMMAR
@@ -76,6 +77,17 @@ definition:
}
;
+/* Switches */
+
+bool:
+ expr {$$ = !!$1; }
+ | ON { $$ = 1; }
+ | YES { $$ = 1; }
+ | OFF { $$ = 0; }
+ | NO { $$ = 0; }
+ | /* Silence means agreement */ { $$ = 1; }
+ ;
+
CF_CODE
CF_END