Support parsing multiline plain scalars #432
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR, parsing multiline plain (unquoted) scalars has been implemented, which was described as a restriction in the PR #344
Before this PR, multiline plain scalars seemed to be parsed with no error but the parse result was just incorrect since its data structure was different from the expected one. (I know this was terrible in debugging...)
The library can now successfully parses such scalars and the result has its correct data structure.
We can simply pass this YAML
to the
fkyaml::node::deserialize()
function, and the function then interprets the input as if the following YAML is passed.Note that, although multiline scalars (either plain or single/double quoted) cannot be used as an implicit mapping key as stated in the YAML specification (7.3. Flow Scalar Styles), the library currently allows for such an invalid syntax like this:
This will be fixed in another PR for sure.
Pull Request Checklist
Read the CONTRIBUTING.md file for detailed information.
Please don't
#ifdef
s or other means.