lib/search_lingo/constants.rb in search_lingo-2.0.0 vs lib/search_lingo/constants.rb in search_lingo-3.0.0.pre1

- old
+ new

@@ -1,11 +1,24 @@ # frozen-string-literal: true module SearchLingo ## # Pattern for matching modifiers within a token. - MODIFIER = /[[:alnum:]]+/ + MODIFIER = /[[:alnum:]]+/.freeze ## - # Pattern for matching terms within a token. - TERM = /"[^"]+"|[[:graph:]]+/ + # Pattern for matching a simple token. + SIMPLE_TOKEN = /"[^"]+"|[[:graph:]]+/.freeze + + ## + # Pattern for matching a simple or compound token. + SIMPLE_OR_COMPOUND_TOKEN = /(?:#{MODIFIER}:[[:space:]]*)?#{SIMPLE_TOKEN}/.freeze + + ## + # Pattern for matching a simple or compound token, with regex grouping to aid + # in decomposing the token into its modifier and term components. + SIMPLE_OR_COMPOUND_TOKEN_WITH_GROUPING = /\A(?:(#{MODIFIER}):[[:space:]]*)?(#{SIMPLE_TOKEN})\z/.freeze + + ## + # Pattern for matching the delimiter between tokens. + DELIMITER = /[[:space:]]*/.freeze end