summaryrefslogtreecommitdiff
path: root/conf/confbase.Y
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-05-04 12:24:30 +0200
committerMaria Matejka <mq@ucw.cz>2022-05-04 15:39:21 +0200
commitcce974e8ea992d0e6d2f649eca7880b436d91d71 (patch)
tree64448636b2633ef429923eb3f9625b11e03f2b4a /conf/confbase.Y
parent8ebac84bc8d51e2404ce6d6dc5e35fb261830596 (diff)
Conf: Allowing keyword redefinition
Some tokens are both keywords and symbols. For now, we allow only specific keywords to be redefined; in future, more of the keywords may be added to this category. The redefinable keywords must be specified in any .Y file as follows: toksym: THE_KEYWORD ; See proto/bgp/config.Y for an example. Also dropped a lot of unused terminals.
Diffstat (limited to 'conf/confbase.Y')
-rw-r--r--conf/confbase.Y8
1 files changed, 5 insertions, 3 deletions
diff --git a/conf/confbase.Y b/conf/confbase.Y
index 2286b257..8a27c3d5 100644
--- a/conf/confbase.Y
+++ b/conf/confbase.Y
@@ -116,7 +116,7 @@ CF_DECLS
%type <mls> label_stack_start label_stack
%type <t> text opttext
-%type <s> symbol
+%type <s> symbol symbol_known toksym
%nonassoc PREFIX_DUMMY
%left AND OR
@@ -162,7 +162,7 @@ definition:
expr:
NUM
| '(' term ')' { $$ = f_eval_int(f_linearize($2)); }
- | CF_SYM_KNOWN {
+ | symbol_known {
if ($1->class != (SYM_CONSTANT | T_INT)) cf_error("Number constant expected");
$$ = SYM_VAL($1).i; }
;
@@ -173,7 +173,9 @@ expr_us:
| expr US { $$ = $1 US_; }
;
-symbol: CF_SYM_UNDEFINED | CF_SYM_KNOWN ;
+toksym: FROM ;
+symbol: CF_SYM_UNDEFINED | CF_SYM_KNOWN | toksym ;
+symbol_known: CF_SYM_KNOWN | toksym ;
/* Switches */