aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/query/lexer.go4
-rw-r--r--pkg/query/lexer_test.go4
2 files changed, 4 insertions, 4 deletions
diff --git a/pkg/query/lexer.go b/pkg/query/lexer.go
index 8a70c47..0ebdb1d 100644
--- a/pkg/query/lexer.go
+++ b/pkg/query/lexer.go
@@ -243,7 +243,7 @@ func tokenizeOperation(s string) Token {
t.Type = TOK_OP_LT
case ">":
t.Type = TOK_OP_GT
- case "!re!":
+ case "/":
t.Type = TOK_OP_RE
}
@@ -335,7 +335,7 @@ func TokensStringify(tokens []Token) string {
func init() {
negPattern := `(?<negation>-?)`
categoryPattern := `(?<category>T|p(?:ath)?|a(?:uthor)?|d(?:ate)?|f(?:iletime)?|t(?:ags|itle)?|h(?:eadings)?|l(?:inks)?|m(?:eta)?)`
- opPattern := `(?<operator>!re!|!=|<=|>=|=|:|~|<|>)`
+ opPattern := `(?<operator>!=|<=|>=|=|:|/|~|<|>)`
valPattern := `(?<value>".*?"|\S*[^\s\)])`
statementPattern := `(?<statement>` + negPattern + categoryPattern + opPattern + valPattern + `)`
unknownPattern := `(?<unknown>\S*".*?"[^\s)]*|\S*[^\s\)])`
diff --git a/pkg/query/lexer_test.go b/pkg/query/lexer_test.go
index 92f9017..3d62671 100644
--- a/pkg/query/lexer_test.go
+++ b/pkg/query/lexer_test.go
@@ -79,7 +79,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 t!re!bar", []Token{
+ {"nested clauses", "a:a (or t:b t!=c) or d<=01010001 and -T~foo t/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"},
@@ -90,7 +90,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"},
+ {TOK_CAT_TAGS, "t"}, {TOK_OP_RE, "/"}, {TOK_VAL_STR, "bar"},
{Type: TOK_CLAUSE_END},
{Type: TOK_CLAUSE_END},
{Type: TOK_CLAUSE_END},