diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2025-07-28 01:20:01 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2025-07-28 01:20:01 -0400 |
| commit | 3b8dcd30f5aca7624a22cff85a2f767d8d1fb583 (patch) | |
| tree | db01e57776ef9a8bc104403cd038e303c6831500 /pkg/query/lexer_test.go | |
| parent | 7b5cd075161bd4e1a05070d51cc64b38882ae74b (diff) | |
Add regex operator
Implemented regex operator using go flavored regular expressions.
Added optimization to combine regex's in `OR` clauses.
Diffstat (limited to 'pkg/query/lexer_test.go')
| -rw-r--r-- | pkg/query/lexer_test.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/query/lexer_test.go b/pkg/query/lexer_test.go index 5888902..35bdc4f 100644 --- a/pkg/query/lexer_test.go +++ b/pkg/query/lexer_test.go @@ -22,6 +22,7 @@ const ( TOK_OP_LE = query.TOK_OP_LE TOK_OP_GE = query.TOK_OP_GE TOK_OP_GT = query.TOK_OP_GT + TOK_OP_RE = query.TOK_OP_RE TOK_CAT_TITLE = query.TOK_CAT_TITLE TOK_CAT_AUTHOR = query.TOK_CAT_AUTHOR TOK_CAT_DATE = query.TOK_CAT_DATE @@ -77,7 +78,7 @@ func TestLex(t *testing.T) { {Type: TOK_CLAUSE_END}, {Type: TOK_CLAUSE_END}, }}, - {"nested clauses", "a:a (or t:b t!=c) or d<=01010001 and -T~foo", []Token{ + {"nested clauses", "a:a (or t:b t!=c) or d<=01010001 and -T~foo t!re!bar", []Token{ {Type: TOK_CLAUSE_START}, {TOK_CLAUSE_AND, "and"}, {TOK_CAT_AUTHOR, "a"}, {TOK_OP_AP, ":"}, {TOK_VAL_STR, "a"}, {Type: TOK_CLAUSE_START}, {TOK_CLAUSE_OR, "or"}, @@ -88,6 +89,7 @@ func TestLex(t *testing.T) { {TOK_CAT_DATE, "d"}, {TOK_OP_LE, "<="}, {TOK_VAL_DATETIME, "01010001"}, {Type: TOK_CLAUSE_START}, {TOK_CLAUSE_AND, "and"}, {TOK_OP_NEG, "-"}, {TOK_CAT_TITLE, "T"}, {TOK_OP_AP, "~"}, {TOK_VAL_STR, "foo"}, + {TOK_CAT_TAGS, "t"}, {TOK_OP_RE, "!re!"}, {TOK_VAL_STR, "bar"}, {Type: TOK_CLAUSE_END}, {Type: TOK_CLAUSE_END}, {Type: TOK_CLAUSE_END}, |
