yaml / yaml-spec

YAML Specification
http://yaml.org/spec/
348 stars 53 forks source link

production syntax: difference syntax isn't described #293

Open vyivel opened 2 years ago

vyivel commented 2 years ago

"Production Syntax" section describes the syntax of parenthesization, quantification etc, but doesn't seem to mention the syntax of difference/subtraction/exception (term - string, as seen in e.g. plain-scalar-first-character rule). Looks like an oversight.

GrahamHannington commented 12 months ago

Another example (relating to issue #319):

[34] ns-char ::=
  nb-char - s-white

Reference

Thom1729 commented 12 months ago

Off the top of my head, I believe that a - b can always be interpreted [lookahead ≠ b] a. Of course, in cases where a and b are both effectively character classes, then you can equivalently interpret it as set subtraction, and this is surely the intuition behind the operator.