From 874c9735f10ffbc8b549ee9acea4c6653088f968 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 16 Dec 2021 14:27:08 +0100 Subject: [PATCH 1/3] Makefile: test_mxqd_control depends on parser.tab.o --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 34bbd098..c7ab9577 100644 --- a/Makefile +++ b/Makefile @@ -727,6 +727,7 @@ test_mxqd_control: mx_util.o test_mxqd_control: mx_mysql.o test_mxqd_control: mxq_group.o test_mxqd_control: keywordset.o +test_mxqd_control: parser.tab.o test_mxqd_control: LDLIBS += $(LDLIBS_MYSQL) clean: CLEAN += test_mxqd_control From 66d0562d81e40bd1846f518f18ce91f41712e6e4 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 16 Dec 2021 14:27:51 +0100 Subject: [PATCH 2/3] test_parser: Add (failing) test for '_' Add a test with a keyword containing an underliner. Currently this test fails. --- test_parser.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test_parser.c b/test_parser.c index b52dbaa6..7ff44a04 100644 --- a/test_parser.c +++ b/test_parser.c @@ -62,6 +62,10 @@ int main() { test_expression(tags, "(true | false) & false ", 0, 0); test_expression(tags, "(true | false) & ( false || false ) & true & x", 1, 0); + keywordset_add(tags, "test test_1"); + test_expression(tags, "test", 0, 1); + test_expression(tags, "test_1", 0, 1); + keywordset_free(tags); static char text[8001]; From bdffa974937def0945d578c01b0122e6addba766 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 16 Dec 2021 14:32:02 +0100 Subject: [PATCH 3/3] parser.y: Allow '_' in identifier Allow identifier in expressions to contain an underliner. --- parser.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser.y b/parser.y index ea40c871..835486cc 100644 --- a/parser.y +++ b/parser.y @@ -65,7 +65,7 @@ int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, struct parser_context *ctx) { if (isalpha (c)) { size_t name_len = 1; - while(isalnum(ctx->input[ctx->pos+name_len])) + while(isalnum(ctx->input[ctx->pos+name_len]) || ctx->input[ctx->pos+name_len] == '_') name_len++; char *name=xstrndup(&ctx->input[ctx->pos], name_len); ctx->pos += name_len;