commit | 503fecdd6eb356c0795db09bb8a0335634b22852 | [log] [tgz] |
---|---|---|
author | Adieu <adieu@adieu.me> | Fri Nov 22 08:29:32 2019 -0800 |
committer | Marcel van Lohuizen <mpvl@golang.org> | Fri Nov 22 20:19:15 2019 +0000 |
tree | b5e0a6791483ad1a6bc30233ee3b3daa8ecc62a9 | |
parent | d7d2837b5723d4ef159c9341fe33bd2e8344614e [diff] |
Decode null as NULL token in yaml decoder This PR will fix #185 as `BasicLit` will be returned for null value. When we walk through the ast to create the instance, null value will be handled as `BasicLit` instead of `Ident`. Closes #186 https://github.com/cuelang/cue/pull/186 GitOrigin-RevId: 9dadc296c30e8d6b39a04d6cf5775de226f3af39 Change-Id: I8bfd84c5c1c4ab60bbc1fbfcd76bb5a4561a8237 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/4100 Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/internal/third_party/yaml/decode.go b/internal/third_party/yaml/decode.go index 40ddfed..ffcbdb6 100644 --- a/internal/third_party/yaml/decode.go +++ b/internal/third_party/yaml/decode.go
@@ -443,7 +443,11 @@ } } if resolved == nil { - return d.ident(n, "null") + return &ast.BasicLit{ + ValuePos: d.start(n), + Kind: token.NULL, + Value: "null", + } } switch tag { // TODO: use parse literal or parse expression instead.