majintao0131 / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

Better support needed for parsing empty (null) values #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The following YAML file:

{{{
- hello
-
- world
}}}

is parsed as

{{{
- hello
-
  - world
}}}

Also,

{{{
: empty key
}}}

gives an "end of map not found" error at the `:`.

Original issue reported on code.google.com by jbe...@gmail.com on 30 Jul 2009 at 4:45

GoogleCodeExporter commented 9 years ago
The sequence issue is fixed.

Original comment by jbe...@gmail.com on 30 Jul 2009 at 5:55

GoogleCodeExporter commented 9 years ago
Done with the map issue also.

Original comment by jbe...@gmail.com on 30 Jul 2009 at 6:49

GoogleCodeExporter commented 9 years ago
I just downloaded r217 and the ~ now parses as a scalar. This is identical 
behavior
to the yaml.org site's parser. What I can't seem to figure out is how to compare
against this null value. Should this be done programatically on the client side 
(eg.
if string == "~"), or is there a way to check for a value being equivalent to 
YAML::Null?

Thanks a bunch!

Original comment by homechic...@gmail.com on 31 Jul 2009 at 2:02

GoogleCodeExporter commented 9 years ago
I wasn't really sure what the best way to do this was. Based on r217, one way 
to do it 
was to check `node.Read(YAML::Null)`. I just committed a change that just added 
this as 
an `IsNull(const YAML::Node&)` function. It'll still parse as a scalar if you 
want, but 
you can check if it's null first.

Original comment by jbe...@gmail.com on 31 Jul 2009 at 5:10