Fix search parser

Allow + or - in the search string as long as it is not preceeded by
a space. If it is preceeded by a space, it starts a new search
constraint.
This commit is contained in:
Robin Malley 2021-09-11 21:49:15 +00:00
parent a16f2dfe02
commit 3bd07ebf6a
1 changed files with 2 additions and 2 deletions

View File

@ -41,7 +41,7 @@ local fields
local grammar = P{
"chunk";
whitespace = S" \t\n"^0,
itm = C(P(1-S"+-")^0), --go until the next '+' or '-'
itm = C((P(1 - (P" " * S"+-")))^0), --go until the next '+' or '-'
likefield = C(P"title" + P"author") * V"whitespace" * C(P"=") * V"whitespace" * V"itm",
rangeop = P"<=" + P">=" + P">" + P"<" + P"=",
rangefield = C(P"date" + P"hits") * V"whitespace" * C(V"rangeop") * V"whitespace" * C(V"itm"),
@ -54,7 +54,7 @@ local grammar = P{
table.insert(fields.tags,{pn,"=",field})
end
end,
chunk = V"field"^0
chunk = V"field" * (P" " * V"field")^0
}
--Grammar