Commit graph

78 commits

Author SHA1 Message Date
Shuhei Kitagawa
c8cc5c583f
Fix indentation for raw string newlines (#625)
https://github.com/goccy/go-yaml/issues/292
2025-01-31 10:27:06 +09:00
hbc
6f80c5700f
fix: empty document should not panic on String() (#630)
fixes #629
2025-01-31 09:56:28 +09:00
Nikita Pivkin
aa0f7eb2da
refactor: remove unused Anchor field from MappingValueNode (#624)
Signed-off-by: Nikita Pivkin <nikita.pivkin@smartforce.io>
2025-01-25 14:40:29 +09:00
Masaaki Goshima
4260634dc8
Fix tag with flow sequence (#618)
* fix tag with flow sequence

* fix lint error
2025-01-16 19:25:38 +09:00
Ivan Ka
25df59f308
issue-281: add tests and fix panic for * (#615)
* issue-281: add tests and fix panic for *

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

* code review. rollback .gitignore changes

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

---------

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
2025-01-16 19:00:30 +09:00
Masaaki Goshima
e2e4400472
fix sequence value for merge key (#603) 2024-12-22 19:43:53 +09:00
Masaaki Goshima
7d56fe29f3
support merge tag (#597) 2024-12-18 10:32:00 +09:00
Shuhei Kitagawa
61bc6c1078
Quote the numbers even if they are out of range (#593)
* Quote the numbers even if they are out of range

https://github.com/goccy/go-yaml/issues/586

* Keep the original interface of the ToNumber function
2024-12-16 18:53:32 +09:00
Masaaki Goshima
438f2d0c37
Fix parsing of directive value (#578)
* fix directive

* fix tag value handling

* remove passed test cases

* add comment
2024-12-09 18:45:26 +09:00
Shunsuke Suzuki
a91fb5be1d
Fix a bug ast.Merge removes comments from SequenceNode (#570)
* fix: fix a bug that merge of sequences loses comments

* fix: append null if ValueHeadComments is empty
2024-12-05 19:09:37 +09:00
Masaaki Goshima
deb129adad
Refactor parser (#545)
* refactor parser
2024-11-26 11:05:45 +09:00
Masaaki Goshima
ff5d41fe8e
Fix parser by using yaml-test-suite (#542)
* fix alias in map key
* fix parsing of wrong-indented-sequence-item
* fix parsing of tab character before comment
* fix parsing of white space in quote
* fix parsing of tab character in quote
2024-11-17 23:58:35 +09:00
Masaaki Goshima
46a94fdd60
fix number parsing (#511) 2024-11-06 17:25:05 +09:00
Masaaki Goshima
61505f3849
fix parsing of number (#498) 2024-11-02 18:44:43 +09:00
Matthew Warman
8713f53d13
feat: preserve line breaks from original input (#412)
* feat: preserve line breaks from original input
* docs: fix spelling error in comment

---------

Co-authored-by: Hilmar Falkenberg <hilmar.falkenberg@sap.com>
2024-11-02 14:24:28 +09:00
Masaaki Goshima
548bbc7d4e
Remove xerrors (#483)
* remove xerrors

* move error variable

* update dependencies
2024-10-28 21:24:15 +09:00
Shuhei Kitagawa
8ad318cffc
Add lint job to CI (#477) 2024-10-28 11:31:15 +09:00
guangwu
42fb764e96
chore: replace loop with n.Values = append(n.Values, target.Values...) (#380) 2023-07-25 18:30:07 +09:00
Martin Sucha
3ca6a75302
Don't trim all space characters in SequenceNode.blockStyleString (#361)
* Don't trim all space characters in SequenceNode.blockStyleString

This fixes https://github.com/goccy/go-yaml/issues/356.
The code would have removed more spaces than it added.

A better solution long-term would probably be to add a specialized
method to StringNode to not add the prefix in the first place.

* Add issue 356 test case for block with first empty line

The indentation level in a block scalar is determined by the first
non-empty line.
2023-03-22 08:31:12 +09:00
Masaaki Goshima
15640065c7
Fix comment option (#349) 2023-03-01 16:59:07 +09:00
Kurochan
dc3fed8f0b
ast: append new line at the end of file (#329) 2022-12-08 22:48:12 +09:00
itchyny
f7e91246a5 Introduce MapKeyNode interface to limit node types for map key 2022-08-18 16:16:40 +09:00
Florian Rey
91b0428dde UTF-8 Support 2022-04-30 00:27:49 +02:00
Masaaki Goshima
9bcbd0aebc
Fix encoding of sequence with multiline string 2022-01-11 17:43:12 +09:00
Martin Sucha
72fff89d6b Fix length calculation in escapeSingleQuote
Thanks goccy for review and suggestion.
2021-10-12 09:40:22 +02:00
Martin Sucha
df4f943b11 Escape single quotes in single-quoted string
According to YAML specification, single quotes must be repeated
in a single-quoted scalar.

https://yaml.org/spec/1.2.2/#732-single-quoted-style

Fixes goccy/go-yaml#255
2021-10-07 17:53:15 +02:00
Masaaki Goshima
afed407e01
Support getting YAMLPath from ast.Node 2021-09-07 17:31:17 +09:00
Masaaki Goshima
43175b6e44 Support WithComment option 2021-07-20 14:26:02 +09:00
Masaaki Goshima
fe709cd48c Fix parsing of literal with comment 2021-07-19 18:48:09 +09:00
Masaaki Goshima
30e4ba7210 Support encoding of comment node 2021-07-16 21:49:17 +09:00
Nikolai Avteniev
24f410415c add method to convert node type to yaml name 2021-06-29 16:49:57 -04:00
Masaaki Goshima
0eb1e3de9f Support to encode ast.Node directly 2021-03-01 13:45:44 +09:00
nakabonne
65b8c9ba18
Allow -0 as an octet integer value 2021-02-02 15:53:34 +09:00
Masaaki Goshima
8b207679af Clear read length 2021-01-29 17:27:48 +09:00
Masaaki Goshima
754055144c Fix flow style for composite type 2020-11-13 11:54:59 +09:00
Iskander Sharipov
e73153fa72 ast: make Walk() type switch exhaustive
ast.Walk() was not entering some nodes.
This patch adds cases for nodes that were not handled.

The CommentNode case is not necessary, but it's added
for the completeness.

Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
2020-09-09 20:13:34 +03:00
Masaaki Goshima
174a7d25e7 Fix column value when merge map node 2020-07-16 15:10:36 +09:00
Masaaki Goshima
367bda16bc Support Merge and Replace for ast.Node 2020-07-16 14:18:26 +09:00
Masaaki Goshima
c6273cdf6e Add ast.Filter and ast.FilterFile 2020-07-15 22:17:01 +09:00
Masaaki Goshima
dbe767003e Add SetName to AnchorNode and AliasNode 2020-07-15 22:16:30 +09:00
Masaaki Goshima
23d3128925 Support io.Reader interface on ast.Node 2020-07-15 22:16:27 +09:00
Masaaki Goshima
6d365f8641 Add MappingKeyNode 2020-07-02 17:21:31 +09:00
Masaaki Goshima
ddce176262 Fix UnmarshalBytes with Quoted string 2020-06-16 15:24:59 +09:00
Masaaki Goshima
bc023734c7 Fix sequence with literal include empty line 2020-06-16 14:58:49 +09:00
Masaaki Goshima
9565ed166b Fix processing of Literal with NewLineCharacter 2020-06-15 20:16:51 +09:00
Masaaki Goshima
b3d4080492 Support parsing with comment 2020-05-28 21:39:06 +09:00
k1LoW
f92ff94578 Combine conditions 2020-03-09 22:53:26 +09:00
k1LoW
6932590a52 Make MappingNode.String() and SequenceNode.String() the same implementation 2020-03-09 22:05:47 +09:00
k1LoW
eee356645b Fix empty style ( slice, map, struct ) 2020-03-09 21:58:05 +09:00
Masaaki Goshima
21ecc76cf7 Fix decoding for literal with BytesUnmarshaler 2020-03-06 08:05:57 +09:00