#1307 Parser accepts invalid YAML input, mistranslates others

open
yaml (10)
8
2012-01-18
2012-01-17
No

The yaml parser v0.3.6 (tcllib cvs head) accepts the following invalid YAML text:

list-no-comma: [ "a" "b" "c" ]

It returns {list-no-comma {a b c}} whereas it should throw an error complaining about the lack of commas between the quoted list elements.
Entering the above string into the online YAML validator/parser at

http://yaml-online-parser.appspot.com/

returns:

ERROR:

while parsing a flow sequence
in "<unicode string>", line 1, column 16:
list-no-comma: [ "a" "b" "c" ]
^
expected ',' or ']', but got '<scalar>'
in "<unicode string>", line 1, column 22:
list-no-comma: [ "a" "b" "c" ]
^

The second block in the error report is the important one.

Discussion

  • Andreas Kupries

    Andreas Kupries - 2012-01-18

    The valid YAML
    x: [ "a": "b", "c": "d" ]

    is mis-translated as {x {a b c d}}
    It should be translated as {x {{a b} {c d}}
    I.e. the value x is mapped to is a sequence of pair-mappings, not a plain sequence.

     
  • Andreas Kupries

    Andreas Kupries - 2012-01-18
    • summary: The parser accepts invalid YAML input --> Parser accepts invalid YAML input, mistranslates others