-
Notifications
You must be signed in to change notification settings - Fork 313
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
Fix logic for document end before directive #174
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6c18adc
to
8598d60
Compare
fbb4fec
to
59b4bc8
Compare
ingydotnet
approved these changes
Apr 18, 2020
Before `1.1` was hardcoded in the emitter. * Also add --directive option to run-emitter-test-suite Allows to easily test how output looks like if %YAML directives are output.
open_ended can have three states now: 0: The previous document was ended explicitly with '...' 1: The previous document wasn't ended with '...' 2: The last scalar event was a block scalar with trailing empty lines |+, and last document wasn't ended with '...'. Important at stream end. This was broken in the past, and fixed in fa1293a. With my last PR #162 I added the faulty behaviour again. The problematic behaviour showed only when all of the following conditions were true: * writing YAML directives * writing unquoted top level scalars * writing more than one document ================== BROKEN ============================== The first example shows that the document end marker is not emitted before the next document. This would be valid in YAML 1.1 if the scalar was quoted, but not if it is plain. This commit fixes this. echo '--- foo --- bar ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --directive 1.1 %YAML 1.1 --- foo %YAML 1.1 --- bar ================== FIXED ============================== echo '--- foo --- bar ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --directive 1.1 %YAML 1.1 --- foo ... %YAML 1.1 --- bar ======================================================= Other examples which should look like this (and were correct already before this fix): Open ended scalars like |+ need '...' at the end of the stream: echo '--- |+ a --- |+ a ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --- |+ a --- |+ a ... ======================================================= If a document is ended with an explicit '...', the code should not print '...' twice: echo '--- foo ... --- bar ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --directive 1.1 %YAML 1.1 --- foo ... %YAML 1.1 --- bar ==========================================================
59b4bc8
to
b37f46f
Compare
Rebased and squashed first two commits. |
uqs
pushed a commit
to freebsd/freebsd-ports
that referenced
this pull request
Apr 22, 2020
libyaml release changes: - yaml/libyaml#143 Add packaging/docker-dist to Makefile.am - yaml/libyaml#174 Fix logic for document end before directive FreeBSD port improvement: - Enable make test target - Use correct license file - Switch download mirror to HTTPS PR: 245813 Submitted by: daniel.engberg.lists@pyret.net git-svn-id: svn+ssh://svn.freebsd.org/ports/head@532485 35697150-7ecd-e111-bb59-0022644237b5
uqs
pushed a commit
to freebsd/freebsd-ports
that referenced
this pull request
Apr 22, 2020
libyaml release changes: - yaml/libyaml#143 Add packaging/docker-dist to Makefile.am - yaml/libyaml#174 Fix logic for document end before directive FreeBSD port improvement: - Enable make test target - Use correct license file - Switch download mirror to HTTPS PR: 245813 Submitted by: daniel.engberg.lists@pyret.net
Jehops
pushed a commit
to Jehops/freebsd-ports-legacy
that referenced
this pull request
Apr 22, 2020
libyaml release changes: - yaml/libyaml#143 Add packaging/docker-dist to Makefile.am - yaml/libyaml#174 Fix logic for document end before directive FreeBSD port improvement: - Enable make test target - Use correct license file - Switch download mirror to HTTPS PR: 245813 Submitted by: daniel.engberg.lists@pyret.net git-svn-id: svn+ssh://svn.freebsd.org/ports/head@532485 35697150-7ecd-e111-bb59-0022644237b5
ericbsd
pushed a commit
to ghostbsd/ghostbsd-ports
that referenced
this pull request
Apr 22, 2020
libyaml release changes: - yaml/libyaml#143 Add packaging/docker-dist to Makefile.am - yaml/libyaml#174 Fix logic for document end before directive FreeBSD port improvement: - Enable make test target - Use correct license file - Switch download mirror to HTTPS PR: 245813 Submitted by: daniel.engberg.lists@pyret.net
bungle
added a commit
to Kong/kong
that referenced
this pull request
May 22, 2020
### Summary - yaml/libyaml#143 Add packaging/docker-dist to Makefile.am - yaml/libyaml#174 Fix logic for document end before directive
bungle
added a commit
to Kong/kong
that referenced
this pull request
May 22, 2020
### Summary - yaml/libyaml#143 Add packaging/docker-dist to Makefile.am - yaml/libyaml#174 Fix logic for document end before directive
svmhdvn
pushed a commit
to svmhdvn/freebsd-ports
that referenced
this pull request
Jan 10, 2024
libyaml release changes: - yaml/libyaml#143 Add packaging/docker-dist to Makefile.am - yaml/libyaml#174 Fix logic for document end before directive FreeBSD port improvement: - Enable make test target - Use correct license file - Switch download mirror to HTTPS PR: 245813 Submitted by: daniel.engberg.lists@pyret.net
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
See yaml/pyyaml#396
open_ended can have three states now:
This was broken in the past, and fixed in fa1293a.
With my last PR #162 I added the faulty behaviour again.
The problematic behaviour showed only when
See the commit message for the second commit for examples how to show the behaviour.
Check out the commit before the fix and running the first example.
Additionally this PR contains:
%YAML 1.2
directive. Before it was valid to pass1.2
but the output was hardcoded to1.1
--directive (1.1|1.2)
to./tests/run-emitter-test-suite
for easy debugging