Commit da62382

mokha <mokha@cisco.com>
2019-05-10 18:06:27
match uri values
1 parent aa8fd7c
Changed files (2)
lib
scim
spec
scim
lib/scim/kit/v2/parser.rb
@@ -41,15 +41,19 @@ subAttr   = "." ATTRNAME
         rule(:rparen) { str(')') >> space? }
         rule(:digit) { match(/\d/) }
         rule(:quote) { str('"') }
+        rule(:single_quote) { str("'") }
         rule(:space) { match('\s') }
         rule(:space?) { space.maybe }
         rule(:alpha) { match('[a-zA-Z]') }
-        rule(:dot) { match('\.') }
-        rule(:colon) { match(':') }
+        rule(:dot) { str('.') }
+        rule(:colon) { str(':') }
+        rule(:hyphen) { str('-') }
 
         rule(:attribute) { uri | attribute_name }
         rule(:attribute_name) { alpha.repeat(1) | dot }
         rule(:uri) { (alpha | digit | dot | colon).repeat(1) }
+        rule(:date) { (alpha | digit | dot | colon | hyphen).repeat(1) }
+        rule(:string) { (alpha | single_quote).repeat(1) }
 
         rule(:operator) { equal | not_equal | contains | starts_with | ends_with | greater_than | less_than | less_than_equals | greater_than_equals }
         rule(:equal) { str("eq") }
@@ -63,7 +67,7 @@ subAttr   = "." ATTRNAME
         rule(:less_than_equals) { str("le") }
 
         rule(:quoted_value) { quote >> value.as(:right) >> quote }
-        rule(:value) { match(/[a-zA-Z0-9:\-']/).repeat(1) }
+        rule(:value) { (string | date | uri).repeat(1) }
 
         rule(:filter) { attribute.as(:left) >> space >> operator.as(:operator) >> space >> quoted_value }
         root :filter
spec/scim/kit/v2/parser_spec.rb
@@ -8,6 +8,7 @@ RSpec.describe Scim::Kit::V2::Parser do
     'name.familyName',
     'urn:ietf:params:scim:schemas:core:2.0:User:userName',
     'meta.lastModified',
+    'schemas',
   ].each do |attribute|
     [
       "eq",
@@ -25,6 +26,7 @@ RSpec.describe Scim::Kit::V2::Parser do
         "O'Malley",
         "J",
         "2011-05-13T04:42:34Z",
+        "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User",
       ].each do |value|
         context "#{attribute} #{operator} #{value}" do
           let(:result) { subject.pretty_parse(%Q(#{attribute} #{operator} \"#{value}\")) }
@@ -52,7 +54,6 @@ filter=title pr and userType eq "Employee"
 filter=title pr or userType eq "Intern"
 
 filter=
- schemas eq "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
 
 filter=userType eq "Employee" and (emails co "example.com" or
   emails.value co "example.org")