fktn-k / fkYAML

A C++ header-only YAML library
MIT License
69 stars 7 forks source link

Parse errors on strings containing a single quote #217

Closed bobziuchkovski closed 10 months ago

bobziuchkovski commented 11 months ago

Description

When parsing a scalar value that contains a ' character within it, fkYAML throws an exception.

Reproduction steps

Try parsing either of the following:

stuff:
  - id: foo
    name: "Bob's stuff"
stuff:
  - id: foo
    name: Bob's stuff

Both should be valid YAML, but the single quote throws off the parser: fkyaml::v0_2_1::exception: Invalid single quotation mark found in a string token.

Expected vs. actual results

Expected: Parse the name field as "Bob's stuff" string. Actual: Exception thrown: fkyaml::v0_2_1::exception: Invalid single quotation mark found in a string token.

Minimal code example

No response

Error messages

No response

Compiler and operating system

Clang on MacOS 13.6

Library version

develop HEAD

Validation

fktn-k commented 11 months ago

@bobziuchkovski
Thanks for your report!
I misunderstood the specification for single quotation marks (like they must be escaped, which is not true as you pointed out).
This IS a bug and I'll fix it soon.

bobziuchkovski commented 11 months ago

No problem. And honestly there's no hurry on my end. I'm able to work-around it just fine.

fktn-k commented 11 months ago

@bobziuchkovski
Thanks, but I've already made local changes to fkYAML with which can successfully parse strings containing single quotes.
I'll create a PR for the changes tonight.

fktn-k commented 11 months ago

@bobziuchkovski
The PR fixing this issue has been merged!
Since all the CI checks have passed, the fix should work on your environment too.

bobziuchkovski commented 10 months ago

Confirmed! This is working as expected now. Thanks!

fktn-k commented 10 months ago

@bobziuchkovski
Thanks! I'll close this issue then:)