0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 01:31:55 +00:00

Added rule "bool" for boolean switches.

This commit is contained in:
Martin Mares 1998-12-06 17:38:42 +00:00
parent b35d72ac66
commit 166b9c4912

View File

@ -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