FILTER    = attrExp / logExp / *1"not" "(" FILTER ")"

; valuePath has been removed intentionally in this test grammer
; cause it is leading to illogical nesting of [ and ] chars when complex attribute is grouped
;FILTER    = attrExp / logExp / valuePath / *1"not" "(" FILTER ")"

;valuePath = attrPath "[" valFilter "]"
  ; FILTER uses sub-attributes of a parent attrPath

valFilter = attrExp / valLogExp / *1"not" "(" valFilter ")"

valLogExp = attrExp SP ("and" / "or") SP attrExp

attrExp   = (attrPath SP "pr") /
  (attrPath SP compareOp SP compValue)

logExp    = FILTER SP ("and" / "or") SP FILTER

compValue = false / null / true / number / string
  ; rules from JSON (RFC 7159)

compareOp = "eq" / "ne" / "co" /
    "sw" / "ew" /
    "gt" / "lt" /
    "ge" / "le"

attrPath  = ["schema:"] ATTRNAME *1subAttr
  ; SCIM attribute name
  ; URI is SCIM "schema" URI

ATTRNAME  = ALPHA *(nameChar)

nameChar  = "-" / "_" / DIGIT / ALPHA

subAttr   = "." ATTRNAME
false = "false"
null = "null"
true = "true"
number = "number"
string = "string"

