jmespath-community / jmespath.spec

JMESPath Specification
8 stars 3 forks source link

Fixed `unescaped-literal` missing character. #99

Closed springcomp closed 2 years ago

springcomp commented 2 years ago

The unescaped_literal grammar rule supports JSON strings when embedded in JMESPath expressions. It current definition is:

unescaped-literal = %x20-21 /   ; space !
  %x23-5B /   ; # - [
  %x5D-5F /   ; ] ^ _
  %x61-7A /   ; a-z
  %x7C-10FFFF ; |}~ ...

For some unknown reasons, the { %x7B opening brace character seems to be omitted from the list of valid characters. I believe this is an error and cannot find any justification.

The JSON grammar specifies that all characters in the range %x20-10FFFF are valid. (except \ %x5C escape character). The only exception for JMESPath is the need to escape the ` %x60 (backtick) character.

This PR re-introduces the { as a valid character. This PR also fixes a mistake while specifying the json-quoted-string which does not currently support empty strings.

springcomp commented 2 years ago

For testing the grammar quickly, I use the following Gist in BNF Playground.