Re: Fwd: Tabs inside scalars

Ingy dot Net <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <CAHJtQJ69ZdZ8oCJ=wZuqQoOoQ=CwbOietFfdkORs75NBcP93aA@mail.gmail.com>
Yes, sorry about that. Kirill is likely the person who can answer most
definitively.

On Mon, Dec 19, 2011 at 12:59 AM, Uwe Kubosch <[email protected]> wrote:

>  This was sent to me, but was probably meant for there mailing list:
>
> Begin forwarded message:
>
>  *From: *Ingy dot Net <[email protected]>
>  *Subject: **Re: [Yaml-core] Tabs inside scalars*
>  *Date: *2011-12-17 20:01:59 GMT+01:00
>  *To: *Uwe Kubosch <[email protected]>
>
> a tab in the middle of a plain scalar should be allowed.
>
> Interestingly, the Perl binding of libyaml handles it fine, while the
> python version fails:
>
> > perl -MYAML::XS -e 'print Dump Load "x\tx"'
> --- "x\tx"
>
> > python -c 'import yaml;print yaml.dump(yaml.load("x\tx"))'
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
>   File "/usr/lib/python2.7/dist-packages/yaml/__init__.py", line 71, in
> load
>     return loader.get_single_data()
>   File "/usr/lib/python2.7/dist-packages/yaml/constructor.py", line 37, in
> get_single_data
>     node = self.get_single_node()
>   File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 35, in
> get_single_node
>     if not self.check_event(StreamEndEvent):
>   File "/usr/lib/python2.7/dist-packages/yaml/parser.py", line 98, in
> check_event
>     self.current_event = self.state()
>   File "/usr/lib/python2.7/dist-packages/yaml/parser.py", line 143, in
> parse_implicit_document_start
>     StreamEndToken):
>   File "/usr/lib/python2.7/dist-packages/yaml/scanner.py", line 116, in
> check_token
>     self.fetch_more_tokens()
>   File "/usr/lib/python2.7/dist-packages/yaml/scanner.py", line 257, in
> fetch_more_tokens
>     % ch.encode('utf-8'), self.get_mark())
> yaml.scanner.ScannerError: while scanning for the next token
> found character '\t' that cannot start any token
>   in "<string>", line 1, column 2:
>     x    x
>      ^
>
> Kirill?
>
> On Thu, Dec 15, 2011 at 3:09 PM, Uwe Kubosch <[email protected]> wrote:
>
>> Hi!
>>
>> I have example output from Ruby 1.8 that fails to parse with SnakeYAML:
>>
>> "36L\tDIESEL" dumped from Ruby 1.8 gives "--- 36L\tDIESEL\n"
>>
>> When loaded with SnakeYAML it throws an exception:
>>
>> Exception in thread "main" while scanning for the next token
>> found character         '\t' that cannot start any token
>>  in "<string>", line 1, column 8:
>>    --- 36L     DIESEL
>>           ^
>>
>>        at
>> org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:358)
>>        at
>> org.yaml.snakeyaml.scanner.ScannerImpl.peekToken(ScannerImpl.java:202)
>>        at
>> org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentEnd.produce(ParserImpl.java:265)
>>        at
>> org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:161)
>>        at
>> org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:171)
>>        at
>> org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:125)
>>        at
>> org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:106)
>>        at
>> org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:121)
>>        at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:296)
>>        at org.yaml.snakeyaml.Yaml.load(Yaml.java:266)
>>        at
>> Issue136.main(Issue136.java:5)
>>
>> This is currently being tracked at
>> http://code.google.com/p/snakeyaml/issues/detail?id=136
>>
>> The question is wether the example is legal YAML.
>>
>> I have read the specs, and I find them inconclusive.  Ruby 1.8 has been
>> around for a long while, and the use of YAML with Ruby is widespread, being
>> in the standard library and all.  So I assumed that the output is legal
>> YAML and that SnakeYAML should accept it.
>>
>> Anybody got an answer on this?
>>
>> --
>> Uwe Kubosch
>> Systems Developer
>> Datek Wireless AS
>> [email protected]
>> http://datek.no/
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> 10 Tips for Better Server Consolidation
>> Server virtualization is being driven by many needs.
>> But none more important than the need to reduce IT complexity
>> while improving strategic productivity.  Learn More!
>> http://www.accelacomm.com/jaw/sdnl/114/51507609/
>> _______________________________________________
>> Yaml-core mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/yaml-core
>>
>
>
>  --
> Uwe Kubosch
> Systems Developer
> Datek Wireless AS
> [email protected]
> http://datek.no/
>
>
>
>
> ------------------------------------------------------------------------------
> Learn Windows Azure Live!  Tuesday, Dec 13, 2011
> Microsoft is holding a special Learn Windows Azure training event for
> developers. It will provide a great way to learn Windows Azure and what it
> provides. You can attend the event by watching it streamed LIVE online.
> Learn more at http://p.sf.net/sfu/ms-windowsazure
> _______________________________________________
> Yaml-core mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/yaml-core
>
>

------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure

_______________________________________________
Yaml-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/yaml-core
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.