yaml / libyaml

Canonical source repository for LibYAML
http://pyyaml.org/wiki/LibYAML
MIT License
921 stars 312 forks source link

Potential parse issue with "." #247

Closed rsbeckerca closed 2 years ago

rsbeckerca commented 2 years ago

I have been working with some complex YAML files, and found an strange behaviour. If '.' is specified, yamli_parser_parse(parser, &event) correctly reports event.type == YAML_SCALAR_EVENT. If . is specified, event.type == YAML_NO_EVENT comes back. I understand that this is correct. However, when "." is specified, this also comes back with YAML_NO_EVENT. My (potentially wrong) understanding is that the semantics of '.' and "." are the same. The context of the token is within a sequence, so:

join: [ "A", ".", "c" ]

The parser is unable to move past the "." token. This happens on any platform.

Is this a bug? The version is 0.2.5 commit 2c891fc.

perlpunk commented 2 years ago

Can you paste some reproducing code? And / or can you try out the tests/run-parser-test-suite program? You can use it like this, and for me everything looks like expected:

% echo "join: [ '.', \".\", . ]" | ./tests/run-parser-test-suite
+STR
+DOC
+MAP
=VAL :join
+SEQ
=VAL '.   # =VAL ' stands for a single quoted scalar
=VAL ".   # =VAL " for a double quoted scalar
=VAL :.   # =VAL : for a plain scalar
-SEQ
-MAP
-DOC
-STR

If you look at the source code for the program above, maybe you can see what your code is doing differently.

rsbeckerca commented 2 years ago

This looks like an error on the part of our parser. There was a duplicate event delete that threw things into a mess. The problem is resolved as of 5 minutes ago. Thanks for answering.