| Version 1 (modified by xi, 7 years ago) (diff) |
|---|
Syck Patches =
All patches are against revision 231 of syck: http://code.whytheluckystiff.net/svn/syck/trunk
Complex Keys
Problems:
>>> # key: empty collection ... print syck.emit(syck.Map({syck.Map(): syck.Scalar('foo')})) --- {} : foo >>> # key: collection with tag ... print syck.emit(syck.Map({syck.Seq([syck.Scalar('foo')], ... tag='x-private:key'): syck.Scalar('bar')})) --- !!key ? - foo : bar >>> # key: empty collection with alias ... node = syck.Map() >>> print syck.emit(syck.Map({node: node})) --- &id001 {} : *id001 >>> # key: scalar with alias ... node = syck.Scalar('foo', tag='x-private:bug') >>> print syck.emit(syck.Map({node: node})) --- &id001 ? !!bug foo : *id001 >>> # key: flow collection ... # the output is correct, but syck parser cannot parse it ... print syck.emit(syck.Map({syck.Seq([syck.Scalar('foo')], ... inline=True): syck.Scalar('bar')})) --- [foo]: bar
Ordered Maps in Flow Style
Before patching:
>>> syck.load('[foo: bar, baz: bat]\n') Traceback (most recent call last): File "<stdin>", line 1, in ? File "syck/loaders.py", line 391, in load return loader.load() File "syck/loaders.py", line 42, in load node = self.parse() _syck.error: ('syntax error', 0, 15)
After patching:
>>> syck.load('[foo: bar, baz: bat]\n') [{'foo': 'bar'}, {'baz': 'bat'}]
Attachments
-
emitter.c.diff
(5.0 KB) -
added by xi 7 years ago.
patch for the Complex Key bug
-
token.re.diff
(666 bytes) -
added by xi 7 years ago.
patch for the Flow Ordered Maps bug
