Bwidget Source Code
View Ticket
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.
Ticket UUID: 3475081
Title: Parser accepts invalid YAML input, mistranslates others
Type: Bug Version: None
Submitter: andreas_kupries Created on: 2012-01-17 20:09:20
Subsystem: yaml Assigned To: kanryu6
Priority: 8 Severity:
Status: Closed Last Modified: 2013-07-04 17:43:46
Resolution: Not Applicable Here Closed By:
    Closed on:
Description:
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.
User Comments: andreas_kupries added on 2012-01-19 04:17:32:
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.