Skip to content

Support parsing multiline plain scalars #432

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

Merged
merged 6 commits into from
Nov 24, 2024

Conversation

fktn-k
Copy link
Owner

@fktn-k fktn-k commented Nov 24, 2024

In this PR, parsing multiline plain (unquoted) scalars has been implemented, which was described as a restriction in the PR #344

The flow line folding for plain scalars is not yet supported since the deserialization feature is not yet ready for that feature. It will, however, surely be supported in the future. Until the feature gets ready, please make such a scalar be either single or double quoted.

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

key: this line
  is a multiline
  plain scalar.

to the fkyaml::node::deserialize() function, and the function then interprets the input as if the following YAML is passed.

key: this line is a multiline plain scalar.

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 implicit
  multiline
  scalar: should not be allowed

This will be fixed in another PR for sure.


Pull Request Checklist

Read the CONTRIBUTING.md file for detailed information.

  • Changes are described in the pull request or in a referenced issue.
  • The test suite compiles and runs without any error.
  • The code coverage on your branch is 100%.
  • The documentation is updated if you added/changed a feature.

Please don't

  • The C++11 support varies between different compilers and versions. Please note the list of supported compilers. Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support. Please refrain from proposing changes that work around these compiler's limitations with #ifdefs or other means.
  • Please refrain from proposing changes that would break YAML specifications. If you propose a conformant extension of YAML to be supported by the library, please motivate this extension.
  • Please do not open pull requests that address multiple issues.

@fktn-k fktn-k added the new feature new feature possibly with public API changes label Nov 24, 2024
@fktn-k fktn-k added this to the Release v0.4.0 milestone Nov 24, 2024
@fktn-k fktn-k self-assigned this Nov 24, 2024
Copy link

github-actions bot commented Nov 24, 2024

:octocat: Upload Coverage Event Notification

Coverage data has been uploaded for the commit d6d410840446768195e9ff20aeeae7c482ab4d26.
You can download the artifact which contains the same file uploaded to the Coveralls and its HTML version.

Name fkYAML_coverage.pr432.zip
ID 2228999177
URL https://github.com/fktn-k/fkYAML/actions/runs/11992884674/artifacts/2228999177

@fktn-k fktn-k force-pushed the feature/428_support_parsing_multiline_plain_scalars branch from 1ddb0d4 to d6d4108 Compare November 24, 2024 03:46
@fktn-k
Copy link
Owner Author

fktn-k commented Nov 24, 2024

This also fixes one if of the issues in parsing the attached YAML file to the issue #428.

@fktn-k fktn-k changed the title Support parsing multiline plain (unquoted) scalars Support parsing multiline plain scalars Nov 24, 2024
@fktn-k fktn-k merged commit 7d0542d into develop Nov 24, 2024
154 of 155 checks passed
@fktn-k fktn-k deleted the feature/428_support_parsing_multiline_plain_scalars branch November 24, 2024 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature new feature possibly with public API changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant