Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quoted strings and integers/float/null/bool parsing #20

Closed
kit-ty-kate opened this issue Feb 18, 2019 · 1 comment · Fixed by #22 or ocaml/opam-repository#13741
Closed

Quoted strings and integers/float/null/bool parsing #20

kit-ty-kate opened this issue Feb 18, 2019 · 1 comment · Fixed by #22 or ocaml/opam-repository#13741

Comments

@kit-ty-kate
Copy link
Contributor

ocaml-yaml 1.0.0 "adds supports" for float, null and bool values. However there is no internal distinctions between plain strings and quoted strings and this give wrong results. For example:

# Yaml.of_string "'null'";;
- : Yaml.value Yaml.res = Result.Ok `Null
# Yaml.of_string "'1'";;
- : Yaml.value Yaml.res = Result.Ok (`Float 1.)
# Yaml.of_string "'true'";;
- : Yaml.value Yaml.res = Result.Ok (`Bool true)

Those will of course return non-symmetric values when casted into strings using Yaml.to_string and will make something like "null" == null or 'true' == true.

@avsm
Copy link
Owner

avsm commented Feb 19, 2019

Thanks, patches for this welcome. In particular, what does the spec say about how this should behave? Is the interaction between the implicit quoting well defined?

@avsm avsm closed this as completed in #22 Mar 20, 2019
avsm added a commit to avsm/opam-repository that referenced this issue Mar 24, 2019
CHANGES:

* Represent quoted scalars as strings in Json encoding (avsm/ocaml-yaml#22 @rizo, fixes avsm/ocaml-yaml#20).
* Expose more detailed scalar information in `Yaml.yaml` (avsm/ocaml-yaml#22 @rizo).
* Add `Yaml.equal` (avsm/ocaml-yaml#22 @rizo)
* Avoid printing the decimal point when the float number is an
  integer (avsm/ocaml-yaml#25 @kit-ty-kate)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants