Skip to content

Commit

Permalink
Merge pull request #115 from mariux64/fix-114
Browse files Browse the repository at this point in the history
Allow identifier in expressions to contain an underliner
  • Loading branch information
donald authored Dec 16, 2021
2 parents 50a00a9 + bdffa97 commit 9651164
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions test_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 9651164

Please sign in to comment.