PostQuery::AST: fix #to_infix to not add unnecessary parentheses.

* Fix the `#to_infix` method to not add unnecessary parentheses around subexpressions.
* Fix metatags to add quotes around values when necessary.
This commit is contained in:
evazion
2022-03-30 00:43:00 -05:00
parent fb0a7851bf
commit 8c9e045a9c
3 changed files with 74 additions and 18 deletions

View File

@@ -33,6 +33,8 @@ require "strscan"
class PostQuery
class Parser
extend Memoist
class Error < StandardError; end
METATAG_NAME_REGEX = /(#{PostQueryBuilder::METATAGS.join("|")}):/i
@@ -265,5 +267,7 @@ class PostQuery
AST.new(type, args)
end
end
memoize :parse, :parse!
end
end