summaryrefslogtreecommitdiff
path: root/conf/confbase.Y
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2023-04-27 18:20:49 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2023-04-27 18:41:01 +0200
commita8a64ca0fed41c78376b27880e934296bd3c3a7f (patch)
treeb07dce29bd01d67438438278bc8af89879faba12 /conf/confbase.Y
parent9b471e72d75c154f3b8c4fa134c7c9f1a55fe27f (diff)
Conf: Improve handling of keywords
For whatever reason, parser allocated a symbol for every parsed keyword in each scope. That wasted time and memory. The effect is worsened with recent changes allowing local scopes, so keywords often promote soft scopes (with no symbols) to real scopes. Do not allocate a symbol for a keyword. Take care of keywords that could be promoted to symbols (kw_sym) and do it explicitly.
Diffstat (limited to 'conf/confbase.Y')
-rw-r--r--conf/confbase.Y4
1 files changed, 3 insertions, 1 deletions
diff --git a/conf/confbase.Y b/conf/confbase.Y
index 1d5738ff..3e8f5807 100644
--- a/conf/confbase.Y
+++ b/conf/confbase.Y
@@ -61,6 +61,7 @@ CF_DECLS
net_addr net;
net_addr *net_ptr;
struct symbol *s;
+ struct keyword *kw;
const char *t;
struct rtable_config *r;
struct channel_config *cc;
@@ -117,6 +118,7 @@ CF_DECLS
%type <t> text opttext
%type <s> symbol
+%type <kw> kw_sym
%nonassoc PREFIX_DUMMY
%left AND OR
@@ -172,7 +174,7 @@ expr_us:
| expr US { $$ = $1 US_; }
;
-symbol: CF_SYM_UNDEFINED | CF_SYM_KNOWN ;
+symbol: CF_SYM_UNDEFINED | CF_SYM_KNOWN | kw_sym { $$ = cf_symbol_from_keyword($1); } ;
/* Switches */