From a8a64ca0fed41c78376b27880e934296bd3c3a7f Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Thu, 27 Apr 2023 18:20:49 +0200 Subject: 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. --- conf/gen_parser.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'conf/gen_parser.m4') diff --git a/conf/gen_parser.m4 b/conf/gen_parser.m4 index af4b1455..7a2a9de4 100644 --- a/conf/gen_parser.m4 +++ b/conf/gen_parser.m4 @@ -29,9 +29,9 @@ m4_define(CF_END, `m4_divert(-1)') m4_define(CF_itera, `m4_ifelse($#, 1, [[CF_iter($1)]], [[CF_iter($1)[[]]CF_itera(m4_shift($@))]])') m4_define(CF_iterate, `m4_define([[CF_iter]], m4_defn([[$1]]))CF_itera($2)') -# Keywords act as untyped %token +# Keywords act as %token m4_define(CF_keywd, `m4_ifdef([[CF_tok_$1]],,[[m4_define([[CF_tok_$1]],1)m4_define([[CF_toks]],CF_toks $1)]])') -m4_define(CF_KEYWORDS, `m4_define([[CF_toks]],[[]])CF_iterate([[CF_keywd]], [[$@]])m4_ifelse(CF_toks,,,%token[[]]CF_toks +m4_define(CF_KEYWORDS, `m4_define([[CF_toks]],[[]])CF_iterate([[CF_keywd]], [[$@]])m4_ifelse(CF_toks,,,%token[[]]CF_toks )DNL') # CLI commands -- cgit v1.2.3