UcasRichard / snakeyaml

Automatically exported from code.google.com/p/snakeyaml
Apache License 2.0
0 stars 0 forks source link

Colon in flow scalar causes parsing problems #78

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Parsing the following file

hello:
    pattern:      /hello/:name.:_format
    defaults:     { _controller: HelloBundle:Hello:index, _format: html }
    requirements: { _format: (html|xml|json) }

gives this error

Exception in thread "main" while scanning a plain scalar
 in "<reader>", line 3, column 34:
        defaults:     { _controller: HelloBundle:Hello:index, _format ... 
                                     ^
found unexpected ':'
 in "<reader>", line 3, column 45:
     ... :     { _controller: HelloBundle:Hello:index, _format: html }
                                         ^
Please check http://pyyaml.org/wiki/YAMLColonInFlowContext for details.

Reading the wiki it appears that this is not an entirely resolved issue, but if 
I understand YAML 1.1 spec correctly it should be allowed.

I am using the latest version as far as I know.

This was initial reported as an issue to YEdit: 
http://code.google.com/p/yedit/issues/detail?id=32

Original issue reported on code.google.com by oyseo...@gmail.com on 17 Aug 2010 at 5:50

GoogleCodeExporter commented 9 years ago
Yes, indeed.
As you can see here http://pyyaml.org/ticket/158 I have reported the issue.
Unfortunately there is no progress.
I am not really in favor to fix the problem only in SnakeYAML as when the 
documents are exchanged with other languages it causes compatibility issues. 
PyYAML is the only parser at the moment which has no compatibility issues 
(valid document for SnakeYAML is always valid for PyYAML and vice versa). Any 
exception would confuse users.
Let us try to speak in yaml-core mailing list and see what comes out of it.

Original comment by py4fun@gmail.com on 18 Aug 2010 at 7:14

GoogleCodeExporter commented 9 years ago
http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTi%3DtRBNOo__zmn%3
D%3D3hW_VhQQNG1WeD5E-1z6ZAKm%40mail.gmail.com&forum_name=yaml-core

Original comment by py4fun@gmail.com on 23 Aug 2010 at 7:23

GoogleCodeExporter commented 9 years ago
Please see the explanation in the yaml-core mailing list. In the meantime use 
quotes for scalars with a colon in the flow context.
This issue will be addressed when 1.2 specification is going to be implemented.

Original comment by py4fun@gmail.com on 26 Aug 2010 at 8:44

GoogleCodeExporter commented 9 years ago
Thanks for following up this question.

I agree that using quotes is an ok workaround.

Original comment by oyseo...@gmail.com on 31 Aug 2010 at 5:20

GoogleCodeExporter commented 9 years ago
is there a roadmap for the 1.2 development? 

Original comment by r.gruend...@gmail.com on 6 Dec 2011 at 9:48

GoogleCodeExporter commented 9 years ago
I would recommend to use the mailing list for this kind of general questions.

Original comment by py4fun@gmail.com on 6 Dec 2011 at 1:35