Skip to content

Allow identifier in expressions to contain an underliner #115

Merged
merged 3 commits into from
Dec 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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