On 2012-03-21 16:28, Julian Reschke wrote:
> ...

OK, here's an attempt to rewrite in IETF ABNF:

-- snip --
diffs =   *( ws ( add / set / remove / move / copy / test ) ws )

add =     "+" ws pointer ws ":" ws ( object / atom / array )
copy =    "*" ws pointer ws ":" ws pointer
move =    ">" ws pointer ws ":" ws pointer
remove =  "-" ws pointer
set =     "^" ws pointer ws ":" ws ( atom / array ) ; object?
test =    "?" ws pointer ws ":" ws ( atom / array ) ; object?

atom =    string / number / false / null / true

pointer = string

; JSON
array =   <see RFC4627, Section 2.3>
false =   <see RFC4627, Section 2.1>
null =    <see RFC4627, Section 2.1>
number =  <see RFC4627, Section 2.4>
object =  <see RFC4627, Section 2.2>
string =  <see RFC4627, Section 2.5>
true =    <see RFC4627, Section 2.1>
ws =      <see RFC4627, Section 2.1>
-- snip --

Open issues:

1) JSON's ws allows CR LF, and it can occur in arrays and objects. Is this true for JSOPDIFF as well?

2) I left out METADATA and EXTENSION for now

3) Does JSOPDIFF require anything special between diffs? Are they supposed to start on new lines?

4) The way the grammar is written makes it hard to extend, we may want to generalize it into simply

diffs =   *( ws op ws )

op    =   VCHAR ws pointer ws ":" ws ( object / atom / array )

and then describe the individual operations separately.

Feedback appreciated, Julian


Reply via email to