yaml / yaml-spec

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

Production parameters #182

Closed Thom1729 closed 3 years ago

Thom1729 commented 3 years ago

Formally define parameterized productions as a “family” of productions. Inspired by the ECMAScript spec.

As a result of this change, the production rules no longer contain variables or conditional logic. Productions that once had conditional logic:

[#] nb-double-text(n,c) ::=
  c == FLOW-OUT  => nb-double-multi-line(n)
  c == FLOW-IN   => nb-double-multi-line(n)
  c == BLOCK-KEY => nb-double-one-line
  c == FLOW-KEY  => nb-double-one-line

Are now defined as multiple productions:

[#] s-line-prefix(n,BLOCK-OUT) ::= s-block-line-prefix(n)
    s-line-prefix(n,BLOCK-IN)  ::= s-block-line-prefix(n)
    s-line-prefix(n,FLOW-OUT)  ::= s-flow-line-prefix(n)
    s-line-prefix(n,FLOW-IN)   ::= s-flow-line-prefix(n)

Because the old auto-detect() thing in c-indentation-indicator was never defined, this PR removes it. To ensure that block scalar content indentation is well defined, I've expanded and reworded section 8.1.1.1. Block Indentation Indicator. (This could probably be done on its own, but I think it's a prerequisite for this PR.)

Comments welcome.

Thom1729 commented 3 years ago

https://spec.yaml.io/pr-182