|
Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4 |
|
| #
32b3f133 |
| 25-Oct-2022 |
rkayaith <rkayaith@gmail.com> |
[YAML] Trim trailing whitespace from plain scalars
In some cases plain scalars are currently parsed with a trailing newline. In particular this shows up often when parsing JSON files, e.g. note the
[YAML] Trim trailing whitespace from plain scalars
In some cases plain scalars are currently parsed with a trailing newline. In particular this shows up often when parsing JSON files, e.g. note the `\n` after `456` below: ``` $ cat test.yaml { "foo": 123, "bar": 456 } $ yaml-bench test.yaml -canonical %YAML 1.2 --- !!map { ? !!str "foo" : !!str "123", ? !!str "bar" : !!str "456\n", } ... ``` The trailing whitespace ends up causing the conversion of the scalar to int/bool/etc. to fail, causing the issue seen here: https://github.com/llvm/llvm-project/issues/15877
From reading the YAML spec (https://yaml.org/spec/1.2.2/#733-plain-style) it seems like plain scalars should never end with whitespace, so this change trims all trailing whitespace characters from the value (specifically `b-line-feed`, `b-carriage-return`, `s-space`, and `s-tab`).
Reviewed By: scott.linder
Differential Revision: https://reviews.llvm.org/D137118
show more ...
|