diff --git a/cmd/arrai/sync_darwin.go b/cmd/arrai/sync_darwin.go
index f69c896b..9b1b512e 100644
--- a/cmd/arrai/sync_darwin.go
+++ b/cmd/arrai/sync_darwin.go
@@ -1,3 +1,4 @@
+//go:build darwin
// +build darwin
package main
diff --git a/cmd/arrai/sync_other.go b/cmd/arrai/sync_other.go
index 9fed5f7a..cc5d4d36 100644
--- a/cmd/arrai/sync_other.go
+++ b/cmd/arrai/sync_other.go
@@ -1,3 +1,4 @@
+//go:build !darwin
// +build !darwin
package main
diff --git a/docs/docs/std/encoding.md b/docs/docs/std/encoding.md
index bd6340d0..1e555aa8 100644
--- a/docs/docs/std/encoding.md
+++ b/docs/docs/std/encoding.md
@@ -10,20 +10,21 @@ For details of how Arr.ai encodes XML, see [Encoding](#Encoding) below.
Usage:
| example | equals |
-|:-|:-|
+|:---|:---|
| `//encoding.xml.decode('')` | `[(xmldecl: 'version="1.0"'), (elem: 'root')]` |
## `//encoding.xml.decoder(config <: (:trimSurroundingWhitespace <: bool)).decode(xml <: string|bytes) <: array`
`decoder` takes a tuple used to configure decoding and returns the decoding function:
+
| config | description |
-|:-|:-|
+|:---|:---|
| `trimSurroundingWhitespace` | Strips newline strings `'\n'` used only for xml file formatting |
Usage:
| example | equals |
-|:-|:-|
+|:---|:---|
| `//encoding.xml.decoder((trimSurroundingWhitespace: true)).decode('\n')` | `[(xmldecl: 'version="1.0"')]` |
| `//encoding.xml.decoder((trimSurroundingWhitespace: false)).decode('\n')` | `[(xmldecl: 'version="1.0"'), '\n']` |
@@ -38,7 +39,7 @@ For details of the limitations of XML encoding, see [Limitations](#Limitations)
Usage:
| example | equals |
-|:-|:-|
+|:---|:---|
| `//encoding.xml.encode([(xmldecl: 'version="1.0"')])` | `` |
## `//encoding.csv.decode(csv <: string|bytes) <: array`
@@ -48,14 +49,15 @@ Usage:
Usage:
| example | equals |
-|:-|:-|
+|:---|:---|
| `//encoding.csv.decode('a,b,c\n1,2,3')` | `[['a', 'b', 'c'], ['1', '2', '3']]` |
## `//encoding.csv.decoder(config <: (comma <: int, comment <: int)) <: ((csv <: string|bytes) <: array)`
`decoder` takes a tuple used to configure decoding and returns the decoding function.
+
| config | description |
-|:-|:-|
+|:---|:---|
| `comma` | Configures the separator used (defaults to `%,`). |
| `comment` | Ignores lines from the input that start with the given character (defaults to regarding all lines as value input). |
| `trimLeadingSpace` | Leading white space in a field is ignored. This is ignored even if the field delimiter, comma, is white space. |
@@ -65,7 +67,7 @@ Usage:
Usage:
| example | equals |
-|:-|:-|
+|:---|:---|
| `//encoding.csv.decoder((comma: %:))('a:b:c\n1:2:3')` | `[['a', 'b', 'c'], ['1', '2', '3']]` |
| `//encoding.csv.decoder((comment: %#))('a,b,c\n#1,2,3')` | `[['a', 'b', 'c']]` |
@@ -76,21 +78,22 @@ Usage:
Usage:
| example | equals |
-|:-|:-|
+|:---|:---|
| `//encoding.csv.encode([['a', 'b', 'c'], ['1', '2', '3']])` | `<<'a,b,c\n1,2,3'>>` |
## `//encoding.csv.encoder(config <: (comma <: int, crlf <: bool)) <: (\(csv <: array) <: bytes)`
`encoder` takes a tuple used to configure encoding and returns the encoding function:
+
| config | description |
-|:-|:-|
+|:---|:---|
| `comma` | Configures the separator used (defaults to `%,`). |
| `crlf` | Encodes new lines as either `'\r\n'` when `true` or `'\n'` when `false` (defaults to `false`). |
Usage:
| example | equals |
-|:-|:-|
+|:---|:---|
| `//encoding.csv.encoder((comma: %:))([['a', 'b', 'c'], ['1', '2', '3']])` | `<<'a:b:c\n1:2:3'>>` |
| `//encoding.csv.encoder((crlf: true))([['a', 'b', 'c'], ['1', '2', '3']])` | `<<'a,b,c\r\n1,2,3'>>` |
@@ -103,7 +106,7 @@ Because empty sets are indistinguishable to `""`, `false`, and `[]`, `decode`
maps incoming JSON values as follows:
| JSON encoding | maps to… | notes |
-|:-|:-|:-|
+|:---|:---|:---|
| `"abc"` | `(s: "abc")` |
| `[1, 2, 3]` | `(a: [1, 2, 3])` |
| `false`/`true` | `(b: false)`/`(b: true)` |
@@ -114,7 +117,7 @@ maps incoming JSON values as follows:
Usage:
| example | equals |
-|:-|:-|
+|:---|:---|
| `//encoding.json.decode('{"hi": "abc", "hello": 123}')` | `{'hello': 123, 'hi': (s: 'abc')}` |
## `//encoding.json.decoder(config <: (strict <: bool)) <: ((json <: string|bytes) <: array)`
@@ -122,39 +125,39 @@ Usage:
`decoder` takes a tuple used to configure decoding and returns the decoding function:
| config | description |
-|:-|:-|
+|:---|:---|
| `strict` | For types that are indistinguishable when empty (strings, bools, and arrays), wrap values in tuples with a discriminating key (defaults to `true`). |
Usage:
| example | equals |
-|:-|:-|
+|:---|:---|
| `//encoding.json.decoder(())('{"arr": [1], "null": null, "str": "2"}')` | `<<'{'arr': (a: [1]), 'null': (), 'str': (s: '2')}'>>` |
| `//encoding.json.decoder((strict: false))('{"arr": [1], "null": null, "str": "2"}')` | `<<'{"arr": [1], "null": (), "str": "2"}'>>` |
-## `//encoding.json.encode(jsonDefinition <: set) <: string|bytes`
+## `//encoding.json.encode(jsonDefinition <: set) <: bytes`
`encode` is the reverse of `decode`. It takes a built-in arr.ai value to `bytes` that represents a JSON object.
Usage:
| example | equals |
-|:-|:-|
+|:---|:---|
| `//encoding.json.encode({'hello': 123, 'hi': (s: 'abc'), 'yo': (a: [1,2,3])})` | `'{"hello":123,"hi":"abc","yo":[1,2,3]}'` |
-## `//encoding.json.encode_indent(jsonDefinition <: set) <: string|bytes`
+## `//encoding.json.encode_indent(jsonDefinition <: set) <: bytes`
`encode_indent` is like `encode` but applies indentations to format the output.
-## `//encoding.json.encoder(config <: (strict <: bool, prefix <: string, indent: string, escapeHTML <: bool)) <: ((json <: string|bytes) <: array)`
+## `//encoding.json.encoder(config <: (strict <: bool, prefix <: string, indent: string, escapeHTML <: bool)) <: ((jsonDefinition <: set) <: bytes)`
`encoder` takes a tuple used to configure encoding and returns the encoding function:
| config | description |
-|:-|:-|
-| prefix | The string to prepend to each line of encoded output (default `""`). |
-| indent | The string to use for each indent on each line of encoded output (default `""`).
If empty, the output will be encoded on a single line. |
-| escapeHTML | Whether [problematic HTML characters](https://pkg.go.dev/encoding/json#Encoder.SetEscapeHTML) should be escaped inside JSON quoted strings (default `false`). |
+|:---|:---|
+| `prefix` | The string to prepend to each line of encoded output (default `""`). |
+| `indent` | The string to use for each indent on each line of encoded output (default `""`).
If empty, the output will be encoded on a single line. |
+| `escapeHTML` | Whether [problematic HTML characters](https://pkg.go.dev/encoding/json#Encoder.SetEscapeHTML) should be escaped inside JSON quoted strings (default `false`). |
| `strict` | For types that are indistinguishable when empty (strings, bools, and arrays), require values to be wrapped in tuples with a discriminating key (defaults to `true`).
If `false`, all empty sets will be encoded as `null`. |
Example:
@@ -178,7 +181,20 @@ Example:
## `//encoding.yaml.decode(json <: string|bytes) <: set`
-Exactly the same as `//encoding.json.decode`, but takes either a `string` or `bytes` that represents a YAML object.
+Exactly the same as `//encoding.json.decode` but takes either a `string` or `bytes` that represents a YAML object.
+
+## `//encoding.yaml.encode(yamlDefinition <: set) <: bytes`
+
+Exactly the same as `//encoding.json.encode` but returns `bytes` that represents a YAML object.
+
+## `//encoding.yaml.encoder(config <: (strict <: bool, indent: int)) <: ((yamlDefinition <: set) <: bytes)`
+
+`encoder` takes a tuple used to configure encoding and returns the encoding function:
+
+| config | description |
+|:---|:---|
+| `indent` | The number of spaces to indent sections with (default `4`). |
+| `strict` | For types that are indistinguishable when empty (strings, bools, and arrays), require values to be wrapped in tuples with a discriminating key (defaults to `true`).
If `false`, all empty sets will be encoded as `null`. |
## `//encoding.proto.descriptor(protobufDefinition <: bytes) <: tuple`
@@ -241,7 +257,7 @@ Note that unlike standard `decode` functions, this is not reversible; its output
### Encoding
| Description | XML Encoding | Arr.ai Encoding |
-|:-|:-|:-|
+|:---|:---|:---|
| Declaration | `` | `[(xmldecl: 'version="1.0"')]` |
| Directive |`>` | `(directive: 'DOCTYPE foo ')` |
| Text | `Hello world` | `'Hello world'` |
diff --git a/go.mod b/go.mod
index 47016d05..39e62e0c 100644
--- a/go.mod
+++ b/go.mod
@@ -32,6 +32,5 @@ require (
google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d // indirect
google.golang.org/grpc v1.38.0
google.golang.org/protobuf v1.26.0
- gopkg.in/yaml.v2 v2.3.0
- gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
+ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
)
diff --git a/go.sum b/go.sum
index 6ed5d0ef..a44bb14f 100644
--- a/go.sum
+++ b/go.sum
@@ -540,8 +540,6 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
-gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
diff --git a/pkg/importcache/import_cache_test.go b/pkg/importcache/import_cache_test.go
index 3acf02ea..b77364e4 100644
--- a/pkg/importcache/import_cache_test.go
+++ b/pkg/importcache/import_cache_test.go
@@ -1,3 +1,4 @@
+//go:build timingsensitive
// +build timingsensitive
package importcache
diff --git a/pkg/shell/shell.go b/pkg/shell/shell.go
index e19edad5..cfb22f0f 100644
--- a/pkg/shell/shell.go
+++ b/pkg/shell/shell.go
@@ -1,4 +1,5 @@
-//+build !wasm
+//go:build !wasm
+// +build !wasm
package shell
diff --git a/pkg/shell/shell_cmd.go b/pkg/shell/shell_cmd.go
index d1acb976..eebd279d 100644
--- a/pkg/shell/shell_cmd.go
+++ b/pkg/shell/shell_cmd.go
@@ -1,4 +1,5 @@
-//+build !wasm
+//go:build !wasm
+// +build !wasm
package shell
diff --git a/pkg/shell/shell_completion.go b/pkg/shell/shell_completion.go
index d55b6444..a75e8c83 100644
--- a/pkg/shell/shell_completion.go
+++ b/pkg/shell/shell_completion.go
@@ -1,4 +1,5 @@
-//+build !wasm
+//go:build !wasm
+// +build !wasm
package shell
diff --git a/pkg/shell/shell_wasm.go b/pkg/shell/shell_wasm.go
index 0ad6a09c..6adc49cc 100644
--- a/pkg/shell/shell_wasm.go
+++ b/pkg/shell/shell_wasm.go
@@ -1,4 +1,5 @@
-//+build wasm
+//go:build wasm
+// +build wasm
package shell
diff --git a/pkg/test/runner_test.go b/pkg/test/runner_test.go
index 12e21824..7e1267c4 100644
--- a/pkg/test/runner_test.go
+++ b/pkg/test/runner_test.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package test
diff --git a/syntax/embed/stdlib-safe.arraiz b/syntax/embed/stdlib-safe.arraiz
index 3091a059..b7b5a779 100644
Binary files a/syntax/embed/stdlib-safe.arraiz and b/syntax/embed/stdlib-safe.arraiz differ
diff --git a/syntax/embed/stdlib-unsafe.arraiz b/syntax/embed/stdlib-unsafe.arraiz
index fb77020d..a0774941 100644
Binary files a/syntax/embed/stdlib-unsafe.arraiz and b/syntax/embed/stdlib-unsafe.arraiz differ
diff --git a/syntax/std_encoding_json.go b/syntax/std_encoding_json.go
index a4bb4613..2be6971f 100644
--- a/syntax/std_encoding_json.go
+++ b/syntax/std_encoding_json.go
@@ -37,6 +37,7 @@ func stdEncodingJSON() rel.Attr {
return jsonDecodeFnBody("json.decode", value, newJSONDecodeConfig())
}),
+ //nolint:dupl // Not a duplicate of JSON encoder
rel.NewNativeFunctionAttr(decoderAttr, func(_ context.Context, configValue rel.Value) (rel.Value, error) {
fn := "json.decoder"
config := newJSONDecodeConfig()
diff --git a/syntax/std_encoding_json_test.go b/syntax/std_encoding_json_test.go
index e8224ec9..f572770d 100644
--- a/syntax/std_encoding_json_test.go
+++ b/syntax/std_encoding_json_test.go
@@ -28,7 +28,6 @@ func TestJSONDecode_NonStrict(t *testing.T) {
AssertCodesEvalToSameValue(t, "{}", `//encoding.json.decoder((strict: false))('[]')`)
AssertCodeErrors(t, "", `//encoding.json.decoder((strict: false))(123)`)
AssertCodesEvalToSameValue(t, "123", `//encoding.json.decoder((strict: false))('123')`)
- AssertCodesEvalToSameValue(t, "123", `//encoding.json.decoder((strict: false))('123')`)
json := testJSONString()
expected := testArraiStringLoose()
diff --git a/syntax/std_encoding_yaml.go b/syntax/std_encoding_yaml.go
index cd22ef8f..1099933f 100644
--- a/syntax/std_encoding_yaml.go
+++ b/syntax/std_encoding_yaml.go
@@ -1,8 +1,11 @@
package syntax
import (
+ "bytes"
"context"
+ "gopkg.in/yaml.v3"
+
"github.com/go-errors/errors"
"github.com/arr-ai/arrai/rel"
@@ -13,10 +16,19 @@ func newYAMLDecodeConfig() yamlDecodeConfig {
return yamlDecodeConfig{strict: true}
}
+func newYAMLEncodeConfig() yamlEncodeConfig {
+ return yamlEncodeConfig{strict: true, indent: 4}
+}
+
type yamlDecodeConfig struct {
strict bool
}
+type yamlEncodeConfig struct {
+ strict bool
+ indent int
+}
+
func stdEncodingYAML() rel.Attr {
return rel.NewTupleAttr(
"yaml",
@@ -24,6 +36,7 @@ func stdEncodingYAML() rel.Attr {
return yamlDecodeFnBody("yaml.decode", value, newYAMLDecodeConfig())
}),
+ //nolint:dupl // Not a duplicate of YAML encoder
rel.NewNativeFunctionAttr(decoderAttr, func(_ context.Context, configValue rel.Value) (rel.Value, error) {
fn := "yaml.decoder"
config := newYAMLDecodeConfig()
@@ -41,6 +54,34 @@ func stdEncodingYAML() rel.Attr {
return yamlDecodeFnBody("yaml.decoder payload", value, config)
}), nil
}),
+
+ rel.NewNativeFunctionAttr("encode", func(_ context.Context, value rel.Value) (rel.Value, error) {
+ return yamlEncodeFnBody(value, newYAMLEncodeConfig())
+ }),
+
+ rel.NewNativeFunctionAttr("encoder", func(_ context.Context, configValue rel.Value) (rel.Value, error) {
+ fn := "yaml.encoder"
+ config := newYAMLEncodeConfig()
+
+ configTuple, ok := configValue.(rel.Tuple)
+ if !ok {
+ return nil, errors.Errorf("first arg to %s must be tuple, not %s", fn, rel.ValueTypeAsString(configValue))
+ }
+
+ indent, err := getConfigInt(configTuple, fn, "indent", config.indent)
+ if err != nil {
+ return nil, err
+ }
+ config.indent = indent
+
+ if strict, ok := getConfigBool(configTuple, "strict"); ok {
+ config.strict = strict
+ }
+
+ return rel.NewNativeFunction("encode", func(_ context.Context, value rel.Value) (rel.Value, error) {
+ return yamlEncodeFnBody(value, config)
+ }), nil
+ }),
)
}
@@ -55,3 +96,19 @@ func yamlDecodeFnBody(fn string, value rel.Value, config yamlDecodeConfig) (rel.
}
return val, nil
}
+
+func yamlEncodeFnBody(value rel.Value, config yamlEncodeConfig) (rel.Value, error) {
+ t := translate.NewTranslator(config.strict)
+ data, err := t.FromArrai(value)
+ if err != nil {
+ return nil, err
+ }
+ result := bytes.NewBuffer([]byte{})
+ enc := yaml.NewEncoder(result)
+ enc.SetIndent(config.indent)
+ err = enc.Encode(data)
+ if err != nil {
+ return nil, err
+ }
+ return rel.NewBytes(result.Bytes()), nil
+}
diff --git a/syntax/std_encoding_yaml_test.go b/syntax/std_encoding_yaml_test.go
index 3e7b9556..1e779768 100644
--- a/syntax/std_encoding_yaml_test.go
+++ b/syntax/std_encoding_yaml_test.go
@@ -4,41 +4,87 @@ import "testing"
func TestYAMLDecode(t *testing.T) {
t.Parallel()
- AssertCodeErrors(t, "", `//encoding.yaml.decode(':')`)
-
- expected := `{
- "a": (s: "string"),
- "b": 123,
- "c": 123.321,
- "d": (a: [1, (s: "string again"), (a: []), {}]),
- "e": {
- "f": {
- "g": (s: "321")
- },
- "h": (a: [])
- },
- "i": (a: [(b: true), (b: false)]),
- "j": (s: {}),
- "k": (),
- "l": ()
- }`
-
- encoding := `
+
+ AssertCodesEvalToSameValue(t, "()", `//encoding.yaml.decode('null')`)
+ AssertCodesEvalToSameValue(t, "{}", `//encoding.yaml.decode('{}')`)
+ AssertCodesEvalToSameValue(t, "(a: [])", `//encoding.yaml.decode('[]')`)
+ AssertCodeErrors(t, "", `//encoding.yaml.decode(123)`)
+ AssertCodesEvalToSameValue(t, "123", `//encoding.yaml.decode('123')`)
+
+ expected := testArraiString()
+ yaml := testYAMLString()
+
+ // String
+ AssertCodesEvalToSameValue(t, expected, `//encoding.yaml.decode(`+yaml+`)`)
+ // Bytes
+ AssertCodesEvalToSameValue(t, expected, `//encoding.yaml.decode(<<`+yaml+`>>)`)
+}
+
+func TestYAMLDecode_NonStrict(t *testing.T) {
+ t.Parallel()
+
+ AssertCodesEvalToSameValue(t, "()", `//encoding.yaml.decoder((strict: false))('null')`)
+ AssertCodesEvalToSameValue(t, "{}", `//encoding.yaml.decoder((strict: false))('{}')`)
+ AssertCodesEvalToSameValue(t, "{}", `//encoding.yaml.decoder((strict: false))('[]')`)
+ AssertCodeErrors(t, "", `//encoding.yaml.decoder((strict: false))(123)`)
+ AssertCodesEvalToSameValue(t, "123", `//encoding.yaml.decoder((strict: false))('123')`)
+
+ yaml := testYAMLString()
+ expected := testArraiStringLoose()
+
+ // String
+ AssertCodesEvalToSameValue(t, expected, `//encoding.yaml.decoder((strict: false))(`+yaml+`)`)
+ // Bytes
+ AssertCodesEvalToSameValue(t, expected, `//encoding.yaml.decoder((strict: false))(<<`+yaml+`>>)`)
+}
+
+func TestYAMLEncode(t *testing.T) {
+ t.Parallel()
+
+ AssertCodesEvalToSameValue(t, `<<'null\n'>>`, `//encoding.yaml.encode(())`)
+ AssertCodesEvalToSameValue(t, `<<'{}\n'>>`, `//encoding.yaml.encode({})`)
+ AssertCodesEvalToSameValue(t, `<<'{}\n'>>`, `//encoding.yaml.encode({123})`)
+ AssertCodesEvalToSameValue(t, `<<'[]\n'>>`, `//encoding.yaml.encode((a: []))`)
+ AssertCodesEvalToSameValue(t, `<<'123\n'>>`, `//encoding.yaml.encode(123)`)
+ AssertCodesEvalToSameValue(t, `<<'- 123\n'>>`, `//encoding.yaml.encode([123])`)
+ AssertCodesEvalToSameValue(t, `<<'key: 123\n'>>`, `//encoding.yaml.encode({"key": 123})`)
+ AssertCodesEvalToSameValue(t, `<<'abcde\n'>>`, `//encoding.yaml.encode("abcde")`)
+ AssertCodesEvalToSameValue(t, `<<"'>'\n">>`, `//encoding.yaml.encode(">")`)
+
+ AssertCodeErrors(t, "", `//encoding.yaml.encode((a: [], s: ""))`)
+
+ encoding := testArraiString()
+ expected := `<<` + testYAMLString() + `>>`
+
+ AssertCodesEvalToSameValue(t, expected, `//encoding.yaml.encoder((indent: 2))(`+encoding+`)`)
+}
+
+func TestYAMLEncodeIndent(t *testing.T) {
+ t.Parallel()
+
+ AssertCodesEvalToSameValue(t, `<<'a:\n b: 1\n'>>`, `//encoding.yaml.encode({"a": {"b": 1}})`) // 4 spaces by default
+ AssertCodesEvalToSameValue(t, `<<'a:\n b: 1\n'>>`, `//encoding.yaml.encoder((indent:2))({"a": {"b": 1}})`)
+ AssertCodesEvalToSameValue(t, `<<'a:\n b: 1\n'>>`, `//encoding.yaml.encoder((indent:4))({"a": {"b": 1}})`)
+}
+
+func testYAMLString() string {
+ return `
'a: string
b: 123
c: 123.321
-d: [1, string again, [], {}]
+d:
+ - 1
+ - string again
+ - []
+ - {}
e:
f:
g: "321"
h: []
-i: [true, false]
-j: ""
-k: null
-l: '`
-
- // String
- AssertCodesEvalToSameValue(t, expected, `//encoding.yaml.decode(`+encoding+`)`)
- // Bytes
- AssertCodesEvalToSameValue(t, expected, `//encoding.yaml.decode(<<`+encoding+`>>)`)
+i: null
+j:
+ - true
+ - false
+k: ""
+'`
}
diff --git a/syntax/std_os_nonwasm.go b/syntax/std_os_nonwasm.go
index 6a3ecc85..028776ba 100644
--- a/syntax/std_os_nonwasm.go
+++ b/syntax/std_os_nonwasm.go
@@ -1,3 +1,4 @@
+//go:build !wasm
// +build !wasm
package syntax
diff --git a/syntax/std_os_wasm.go b/syntax/std_os_wasm.go
index 516aad56..93c4dc5c 100644
--- a/syntax/std_os_wasm.go
+++ b/syntax/std_os_wasm.go
@@ -1,3 +1,4 @@
+//go:build wasm
// +build wasm
package syntax
diff --git a/translate/translator_yaml_test.go b/translate/translator_yaml_test.go
index 98b88905..fb26cb1b 100644
--- a/translate/translator_yaml_test.go
+++ b/translate/translator_yaml_test.go
@@ -3,7 +3,7 @@ package translate_test
import (
"testing"
- "gopkg.in/yaml.v2"
+ "gopkg.in/yaml.v3"
"github.com/stretchr/testify/require"
diff --git a/translate/yaml.go b/translate/yaml.go
index f0719e6b..340ad7a6 100644
--- a/translate/yaml.go
+++ b/translate/yaml.go
@@ -1,7 +1,7 @@
package translate
import (
- "gopkg.in/yaml.v2"
+ "gopkg.in/yaml.v3"
"github.com/arr-ai/arrai/rel"
)