Commit e530a9c

mokha <mokha@cisco.com>
2019-05-11 20:10:57
improve number matcher
1 parent da7ed78
Changed files (1)
lib
scim
lib/scim/kit/v2/parser.rb
@@ -74,12 +74,12 @@ module Scim
             str('core:2.0:Group') |
             (
               str('extension') >>
-              colon >>
-              alpha.repeat(1) >>
-              colon >>
-              version >>
-              colon >>
-              alpha.repeat(1)
+            colon >>
+            alpha.repeat(1) >>
+            colon >>
+            version >>
+            colon >>
+            alpha.repeat(1)
             )
           )
         end
@@ -90,7 +90,15 @@ module Scim
         rule(:falsey) { str('false') }
         rule(:truthy) { str('true') }
         rule(:null) { str('null') }
-        rule(:number) { digit.repeat(1) }
+        rule(:number) do
+          str('-').maybe >> (
+            str('0') | (match('[1-9]') >> digit.repeat)
+          ) >> (
+            str('.') >> digit.repeat(1)
+          ).maybe >> (
+            match('[eE]') >> (str('+') | str('-')).maybe >> digit.repeat(1)
+          ).maybe
+        end
         rule(:equal) { str('eq') }
         rule(:not_equal) { str('ne') }
         rule(:contains) { str('co') }