forked from google/go-jsonnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves a false-positive detection of multi-doc YAML streams (google…
…#693) Fixes google#673.
- Loading branch information
Showing
4 changed files
with
100 additions
and
26 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,41 @@ | ||
{ | ||
"aaa": { }, | ||
"foo": "bar", | ||
"xxx": [ | ||
42, | ||
"asdf", | ||
{ } | ||
[ | ||
{ | ||
"aaa": { }, | ||
"foo": "bar", | ||
"xxx": [ | ||
42, | ||
"asdf", | ||
{ } | ||
], | ||
"ąę": "ćż" | ||
}, | ||
[ | ||
{ | ||
"a": 1 | ||
}, | ||
{ | ||
"a": 2 | ||
} | ||
], | ||
"ąę": "ćż" | ||
} | ||
[ | ||
{ | ||
"a": 1 | ||
}, | ||
{ | ||
"a": 2 | ||
} | ||
], | ||
[ | ||
{ | ||
"a": 1 | ||
}, | ||
{ | ||
"a": 2 | ||
} | ||
], | ||
{ | ||
"---a": 2, | ||
"a": 1, | ||
"a---": 3 | ||
} | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,46 @@ | ||
std.parseYaml( | ||
||| | ||
foo: bar | ||
aaa: {} | ||
ąę: ćż | ||
xxx: | ||
- 42 | ||
- asdf | ||
- {} | ||
||| | ||
) | ||
[ | ||
std.parseYaml(text) | ||
for text in [ | ||
// various node types | ||
||| | ||
foo: bar | ||
aaa: {} | ||
ąę: ćż | ||
xxx: | ||
- 42 | ||
- asdf | ||
- {} | ||
|||, | ||
|
||
// Returns an array of documents when there is an explicit document(s), i.e. | ||
// the text is a "multi-doc" stream | ||
||| | ||
--- | ||
a: 1 | ||
--- | ||
a: 2 | ||
|||, | ||
|
||
// The first document in a "multi-doc" stream can be an implicit document. | ||
||| | ||
a: 1 | ||
--- | ||
a: 2 | ||
|||, | ||
|
||
// Whitespaces are allowed after the document start marker | ||
||| | ||
--- | ||
a: 1 | ||
--- | ||
a: 2 | ||
|||, | ||
|
||
// Document start marker needs a following line break or a whitespace. | ||
||| | ||
a: 1 | ||
---a: 2 | ||
a---: 3 | ||
|||, | ||
] | ||
] |
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