We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6f13b6d commit 5d56b36Copy full SHA for 5d56b36
1 file changed
src/jsonata/tokenizer.py
@@ -32,6 +32,8 @@
32
33
from jsonata import jexception, utils
34
35
+_NUMBER_PATTERN = re.compile(r"^-?(0|([1-9][0-9]*))(\.[0-9]+)?([Ee][-+]?[0-9]+)?")
36
+
37
38
class Tokenizer:
39
operators = {
@@ -264,8 +266,7 @@ def next(self, prefix: bool) -> Optional[Token]:
264
266
self.position += 1
265
267
raise jexception.JException("S0101", self.position)
268
# test for numbers
- numregex = re.compile("^-?(0|([1-9][0-9]*))(\\.[0-9]+)?([Ee][-+]?[0-9]+)?")
- match_ = numregex.search(self.path[self.position:])
269
+ match_ = _NUMBER_PATTERN.search(self.path[self.position:])
270
if match_ is not None:
271
num = float(match_.group(0))
272
if not math.isnan(num) and math.isfinite(num):
0 commit comments