lib/fhir_models/fluentpath/parse.rb in fhir_models-1.8.2 vs lib/fhir_models/fluentpath/parse.rb in fhir_models-1.8.3

- old
+ new

@@ -1,14 +1,14 @@ module FluentPath - @@reserved = ['all', 'not', 'empty', 'exists', 'where', 'select', 'extension', 'startsWith', 'contains', 'in', 'distinct', '=', '!=', '<=', '>=', '<', '>', 'and', 'or', 'xor', '+', '-', '/', '*', 'toInteger', 'implies', 'children', 'first', 'last', 'tail', 'count', 'substring'] + @@reserved = ['all', 'not', 'empty', 'exists', 'where', 'select', 'extension', 'startsWith', 'contains', 'in', 'distinct', '=', '!=', '<=', '>=', '<', '>', 'and', 'or', 'xor', '+', '-', '/', '*', 'toInteger', 'implies', 'children', 'first', 'last', 'tail', 'count', 'length', 'substring'] def self.parse(expression) build_tree(tokenize(expression)) end # This method tokenizes the expression into a flat array of tokens def self.tokenize(expression) - raw_tokens = expression.gsub('()', '').split(/(\(|\)|\s|>=|<=|>|<|=|!=|\+|-|\/|\*)/) + raw_tokens = expression.gsub('()', '').split(%r{(\(|\)|\s|>=|<=|>|<|=|!=|\+|-|\/|\*)}) # recreate strings if they were split size = nil while raw_tokens.include?("'") && size != raw_tokens.length index = raw_tokens.index("'") e_index = raw_tokens[(index + 1)..raw_tokens.length].index("'")