swaroopch / edn_format

EDN reader and writer implementation in Python, using PLY (lex, yacc)
https://swaroopch.com/2012/12/24/edn-format-python/
Other
131 stars 31 forks source link

Fix float regex #68

Closed gabrielferreira95 closed 4 years ago

gabrielferreira95 commented 4 years ago

Fixes issue #67.

gabrielferreira95 commented 4 years ago

Thanks, @bfontaine, for the simplification. Regex explanation:

[+-]?                 # a single character '+' or '-', 0-1 time
\d+                   # at least one digit (0-9) 
(?:
   (?:
      \.\d+           # dot and at least one digit         \ sth like .34e9
      ([eE][+-]?\d+)? # possibly sth like: e-21, E+1, e4   /
      |[eE][+-]?\d+   # OR sth like 34e10, 12e-3
   )
   M?                 # If there is a '.' or ['e', 'E'], 'M' is optional
   |M                 # otherwise, 'M' is mandatory
)
bfontaine commented 4 years ago

Thank you @gabrielferreira95! :tada: