diff --git a/packages/cel-spec/scripts/go.mod b/packages/cel-spec/scripts/go.mod index 3e809008..b3f0c4bf 100644 --- a/packages/cel-spec/scripts/go.mod +++ b/packages/cel-spec/scripts/go.mod @@ -2,16 +2,16 @@ module github.com/bufbuild/cel-es/packages/scripts go 1.23.2 -require github.com/google/cel-go v0.26.1 +require github.com/google/cel-go v0.29.0 require ( - cel.dev/expr v0.25.0 + cel.dev/expr v0.25.1 google.golang.org/protobuf v1.36.10 ) require ( github.com/antlr4-go/antlr/v4 v4.13.1 // indirect - github.com/stoewer/go-strcase v1.3.0 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect golang.org/x/text v0.22.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20241223144023-3abc09e42ca8 // indirect diff --git a/packages/cel-spec/scripts/go.sum b/packages/cel-spec/scripts/go.sum index f8c8378c..907f3ecb 100644 --- a/packages/cel-spec/scripts/go.sum +++ b/packages/cel-spec/scripts/go.sum @@ -1,25 +1,13 @@ -cel.dev/expr v0.25.0 h1:qbCFvDJJthxLvf3TqeF9Ys7pjjWrO7LMzfYhpJUc30g= -cel.dev/expr v0.25.0/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +cel.dev/expr v0.25.1 h1:1KrZg61W6TWSxuNZ37Xy49ps13NUovb66QLprthtwi4= +cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/cel-go v0.26.1 h1:iPbVVEdkhTX++hpe3lzSk7D3G3QSYqLGoHOcEio+UXQ= -github.com/google/cel-go v0.26.1/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM= +github.com/google/cel-go v0.29.0 h1:fEG+Ja3YRwNOqnQxTyJwoByAUAvTuxUGiro/jhrm4F4= +github.com/google/cel-go v0.29.0/go.mod h1:X0bD6iVNR8pkROSOoHVdgTkzmRcosof7WQqCD6wcMc8= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= -github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 h1:1UoZQm6f0P/ZO0w1Ri+f+ifG/gXhegadRdwBIXEFWDo= golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= @@ -30,7 +18,5 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA= google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/packages/cel-spec/src/testdata/checking.ts b/packages/cel-spec/src/testdata/checking.ts index a18c8109..db9ce53d 100644 --- a/packages/cel-spec/src/testdata/checking.ts +++ b/packages/cel-spec/src/testdata/checking.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Generated from cel-go github.com/google/cel-go@v0.26.1/checker/checker_test.go +// Generated from cel-go github.com/google/cel-go@v0.29.0/checker/checker_test.go import type { SerializedIncrementalTestSuite } from "./tests.js"; export const tests: SerializedIncrementalTestSuite = { name: "checking", @@ -1651,7 +1651,7 @@ export const tests: SerializedIncrementalTestSuite = { }, ast: "NotAMessage{}^#*expr.Expr_StructExpr#", error: - "ERROR: \u003cinput\u003e:1:12: 'wrapper(int)' is not a type\n | NotAMessage{}\n | ...........^", + "ERROR: \u003cinput\u003e:1:12: undeclared reference to 'NotAMessage' (in container '')\n | NotAMessage{}\n | ...........^", }, { original: { expr: "{}.map(c,[c,type(c)])" }, @@ -1660,5 +1660,94 @@ export const tests: SerializedIncrementalTestSuite = { "__comprehension__(\n // Variable\n c,\n // Target\n {}~map(dyn, dyn),\n // Accumulator\n @result,\n // Init\n []~list(list(dyn)),\n // LoopCondition\n true~bool,\n // LoopStep\n _+_(\n @result~list(list(dyn))^@result,\n [\n [\n c~dyn^c,\n type(\n c~dyn^c\n )~type(dyn)^type\n ]~list(dyn)\n ]~list(list(dyn))\n )~list(list(dyn))^add_list,\n // Result\n @result~list(list(dyn))^@result)~list(list(dyn))", type: "list(list(dyn))", }, + { + original: { + expr: "[{'z': 0}].exists(y, y.z == 0)", + typeEnv: [ + { + name: "cel.example.y", + ident: { + type: { + mapType: { + keyType: { primitive: "STRING" }, + valueType: { primitive: "INT64" }, + }, + }, + }, + }, + ], + }, + ast: '__comprehension__(\n // Variable\n y,\n // Target\n [\n {\n "z"^#*expr.Constant_StringValue#:0^#*expr.Constant_Int64Value#^#*expr.Expr_CreateStruct_Entry#\n }^#*expr.Expr_StructExpr#\n ]^#*expr.Expr_ListExpr#,\n // Accumulator\n @result,\n // Init\n false^#*expr.Constant_BoolValue#,\n // LoopCondition\n @not_strictly_false(\n !_(\n @result^#*expr.Expr_IdentExpr#\n )^#*expr.Expr_CallExpr#\n )^#*expr.Expr_CallExpr#,\n // LoopStep\n _||_(\n @result^#*expr.Expr_IdentExpr#,\n _==_(\n y^#*expr.Expr_IdentExpr#.z^#*expr.Expr_SelectExpr#,\n 0^#*expr.Constant_Int64Value#\n )^#*expr.Expr_CallExpr#\n )^#*expr.Expr_CallExpr#,\n // Result\n @result^#*expr.Expr_IdentExpr#)^#*expr.Expr_ComprehensionExpr#', + checkedAst: + '__comprehension__(\n // Variable\n y,\n // Target\n [\n {\n "z"~string:0~int\n }~map(string, int)\n ]~list(map(string, int)),\n // Accumulator\n @result,\n // Init\n false~bool,\n // LoopCondition\n @not_strictly_false(\n !_(\n @result~bool^@result\n )~bool^logical_not\n )~bool^not_strictly_false,\n // LoopStep\n _||_(\n @result~bool^@result,\n _==_(\n y~map(string, int)^y.z~int,\n 0~int\n )~bool^equals\n )~bool^logical_or,\n // Result\n @result~bool^@result)~bool', + type: "bool", + }, + { + original: { + expr: "[{'y': 0}].exists(x, x.y == 0)", + typeEnv: [ + { + name: "x", + ident: { + type: { + mapType: { + keyType: { primitive: "STRING" }, + valueType: { primitive: "INT64" }, + }, + }, + }, + }, + ], + }, + ast: '__comprehension__(\n // Variable\n x,\n // Target\n [\n {\n "y"^#*expr.Constant_StringValue#:0^#*expr.Constant_Int64Value#^#*expr.Expr_CreateStruct_Entry#\n }^#*expr.Expr_StructExpr#\n ]^#*expr.Expr_ListExpr#,\n // Accumulator\n @result,\n // Init\n false^#*expr.Constant_BoolValue#,\n // LoopCondition\n @not_strictly_false(\n !_(\n @result^#*expr.Expr_IdentExpr#\n )^#*expr.Expr_CallExpr#\n )^#*expr.Expr_CallExpr#,\n // LoopStep\n _||_(\n @result^#*expr.Expr_IdentExpr#,\n _==_(\n x^#*expr.Expr_IdentExpr#.y^#*expr.Expr_SelectExpr#,\n 0^#*expr.Constant_Int64Value#\n )^#*expr.Expr_CallExpr#\n )^#*expr.Expr_CallExpr#,\n // Result\n @result^#*expr.Expr_IdentExpr#)^#*expr.Expr_ComprehensionExpr#', + checkedAst: + '__comprehension__(\n // Variable\n x,\n // Target\n [\n {\n "y"~string:0~int\n }~map(string, int)\n ]~list(map(string, int)),\n // Accumulator\n @result,\n // Init\n false~bool,\n // LoopCondition\n @not_strictly_false(\n !_(\n @result~bool^@result\n )~bool^logical_not\n )~bool^not_strictly_false,\n // LoopStep\n _||_(\n @result~bool^@result,\n _==_(\n x~map(string, int)^x.y~int,\n 0~int\n )~bool^equals\n )~bool^logical_or,\n // Result\n @result~bool^@result)~bool', + type: "bool", + }, + { + original: { + expr: "[0].exists(x, x != .x)", + typeEnv: [{ name: "x", ident: { type: { primitive: "INT64" } } }], + }, + ast: "__comprehension__(\n // Variable\n x,\n // Target\n [\n 0^#*expr.Constant_Int64Value#\n ]^#*expr.Expr_ListExpr#,\n // Accumulator\n @result,\n // Init\n false^#*expr.Constant_BoolValue#,\n // LoopCondition\n @not_strictly_false(\n !_(\n @result^#*expr.Expr_IdentExpr#\n )^#*expr.Expr_CallExpr#\n )^#*expr.Expr_CallExpr#,\n // LoopStep\n _||_(\n @result^#*expr.Expr_IdentExpr#,\n _!=_(\n x^#*expr.Expr_IdentExpr#,\n .x^#*expr.Expr_IdentExpr#\n )^#*expr.Expr_CallExpr#\n )^#*expr.Expr_CallExpr#,\n // Result\n @result^#*expr.Expr_IdentExpr#)^#*expr.Expr_ComprehensionExpr#", + checkedAst: + "__comprehension__(\n // Variable\n x,\n // Target\n [\n 0~int\n ]~list(int),\n // Accumulator\n @result,\n // Init\n false~bool,\n // LoopCondition\n @not_strictly_false(\n !_(\n @result~bool^@result\n )~bool^logical_not\n )~bool^not_strictly_false,\n // LoopStep\n _||_(\n @result~bool^@result,\n _!=_(\n x~int^x,\n .x~int^.x\n )~bool^not_equals\n )~bool^logical_or,\n // Result\n @result~bool^@result)~bool", + type: "bool", + }, + { + original: { + expr: "[{'z': 0}].exists(y, .y.z == y.z)", + typeEnv: [{ name: "y.z", ident: { type: { primitive: "INT64" } } }], + }, + ast: '__comprehension__(\n // Variable\n y,\n // Target\n [\n {\n "z"^#*expr.Constant_StringValue#:0^#*expr.Constant_Int64Value#^#*expr.Expr_CreateStruct_Entry#\n }^#*expr.Expr_StructExpr#\n ]^#*expr.Expr_ListExpr#,\n // Accumulator\n @result,\n // Init\n false^#*expr.Constant_BoolValue#,\n // LoopCondition\n @not_strictly_false(\n !_(\n @result^#*expr.Expr_IdentExpr#\n )^#*expr.Expr_CallExpr#\n )^#*expr.Expr_CallExpr#,\n // LoopStep\n _||_(\n @result^#*expr.Expr_IdentExpr#,\n _==_(\n .y^#*expr.Expr_IdentExpr#.z^#*expr.Expr_SelectExpr#,\n y^#*expr.Expr_IdentExpr#.z^#*expr.Expr_SelectExpr#\n )^#*expr.Expr_CallExpr#\n )^#*expr.Expr_CallExpr#,\n // Result\n @result^#*expr.Expr_IdentExpr#)^#*expr.Expr_ComprehensionExpr#', + checkedAst: + '__comprehension__(\n // Variable\n y,\n // Target\n [\n {\n "z"~string:0~int\n }~map(string, int)\n ]~list(map(string, int)),\n // Accumulator\n @result,\n // Init\n false~bool,\n // LoopCondition\n @not_strictly_false(\n !_(\n @result~bool^@result\n )~bool^logical_not\n )~bool^not_strictly_false,\n // LoopStep\n _||_(\n @result~bool^@result,\n _==_(\n .y.z~int^.y.z,\n y~map(string, int)^y.z~int\n )~bool^equals\n )~bool^logical_or,\n // Result\n @result~bool^@result)~bool', + type: "bool", + }, + { + original: { + expr: "TestAllTypes{?singleInt32: {}.?i}", + container: "google.expr.proto2.test", + }, + error: + "ERROR: :1:14: unsupported syntax '?'\n | TestAllTypes{?singleInt32: {}.?i}\n | .............^", + }, + { + original: { + expr: "TestAllTypes{?singleInt32: {'i': 20}.?i}.singleInt32", + container: "google.expr.proto2.test", + }, + error: + "ERROR: :1:14: unsupported syntax '?'\n | TestAllTypes{?singleInt32: {'i': 20}.?i}.singleInt32\n | .............^", + }, + { + original: { + expr: "TestAllTypes{singleInt32: 1, single_bool: true}.singleInt32", + container: "google.expr.proto2.test", + }, + ast: "TestAllTypes{\n singleInt32:1^#*expr.Constant_Int64Value#^#*expr.Expr_CreateStruct_Entry#,\n single_bool:true^#*expr.Constant_BoolValue#^#*expr.Expr_CreateStruct_Entry#\n}^#*expr.Expr_StructExpr#.singleInt32^#*expr.Expr_SelectExpr#", + error: + "ERROR: \u003cinput\u003e:1:25: undefined field 'singleInt32'\n | TestAllTypes{singleInt32: 1, single_bool: true}.singleInt32\n | ........................^\nERROR: \u003cinput\u003e:1:48: undefined field 'singleInt32'\n | TestAllTypes{singleInt32: 1, single_bool: true}.singleInt32\n | ...............................................^", + }, ], } as const; diff --git a/packages/cel-spec/src/testdata/comprehension.ts b/packages/cel-spec/src/testdata/comprehension.ts index 1fc6705e..46141207 100644 --- a/packages/cel-spec/src/testdata/comprehension.ts +++ b/packages/cel-spec/src/testdata/comprehension.ts @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Generated from cel-go github.com/google/cel-go@v0.26.1/ext/comprehensions_test.go +// Generated from cel-go github.com/google/cel-go@v0.29.0/ext/comprehensions_test.go import type { SerializedIncrementalTestSuite } from "./tests.js"; export const tests: SerializedIncrementalTestSuite = { - name: "comprehensions", + name: "comprehension", tests: [ { original: { diff --git a/packages/cel-spec/src/testdata/conformance.ts b/packages/cel-spec/src/testdata/conformance.ts index 9c9703d1..4fc40d24 100644 --- a/packages/cel-spec/src/testdata/conformance.ts +++ b/packages/cel-spec/src/testdata/conformance.ts @@ -13222,8 +13222,10 @@ export const tests: SerializedIncrementalTestSuite = { expr: "{'/api/v1': true, '/api/v2': false}.`/api/v1`", value: { boolValue: true }, }, - error: - "ERROR: field_access_slash:1:37: unsupported syntax: '`'\n | {'/api/v1': true, '/api/v2': false}.`/api/v1`\n | ....................................^", + ast: '{\n "/api/v1"^#*expr.Constant_StringValue#:true^#*expr.Constant_BoolValue#^#*expr.Expr_CreateStruct_Entry#,\n "/api/v2"^#*expr.Constant_StringValue#:false^#*expr.Constant_BoolValue#^#*expr.Expr_CreateStruct_Entry#\n}^#*expr.Expr_StructExpr#./api/v1^#*expr.Expr_SelectExpr#', + checkedAst: + '{\n "/api/v1"~string:true~bool,\n "/api/v2"~string:false~bool\n}~map(string, bool)./api/v1~bool', + type: "bool", }, { original: { @@ -13231,8 +13233,10 @@ export const tests: SerializedIncrementalTestSuite = { expr: "{'content-type': 'application/json', 'content-length': 145}.`content-type` == 'application/json'", value: { boolValue: true }, }, - error: - "ERROR: field_access_dash:1:61: unsupported syntax: '`'\n | {'content-type': 'application/json', 'content-length': 145}.`content-type` == 'application/json'\n | ............................................................^", + ast: '_==_(\n {\n "content-type"^#*expr.Constant_StringValue#:"application/json"^#*expr.Constant_StringValue#^#*expr.Expr_CreateStruct_Entry#,\n "content-length"^#*expr.Constant_StringValue#:145^#*expr.Constant_Int64Value#^#*expr.Expr_CreateStruct_Entry#\n }^#*expr.Expr_StructExpr#.content-type^#*expr.Expr_SelectExpr#,\n "application/json"^#*expr.Constant_StringValue#\n)^#*expr.Expr_CallExpr#', + checkedAst: + '_==_(\n {\n "content-type"~string:"application/json"~string,\n "content-length"~string:145~int\n }~map(string, dyn).content-type~dyn,\n "application/json"~string\n)~bool^equals', + type: "bool", }, { original: { @@ -13240,8 +13244,10 @@ export const tests: SerializedIncrementalTestSuite = { expr: "{'foo.txt': 32, 'bar.csv': 1024}.`foo.txt`", value: { int64Value: "32" }, }, - error: - "ERROR: field_access_dot:1:34: unsupported syntax: '`'\n | {'foo.txt': 32, 'bar.csv': 1024}.`foo.txt`\n | .................................^", + ast: '{\n "foo.txt"^#*expr.Constant_StringValue#:32^#*expr.Constant_Int64Value#^#*expr.Expr_CreateStruct_Entry#,\n "bar.csv"^#*expr.Constant_StringValue#:1024^#*expr.Constant_Int64Value#^#*expr.Expr_CreateStruct_Entry#\n}^#*expr.Expr_StructExpr#.foo.txt^#*expr.Expr_SelectExpr#', + checkedAst: + '{\n "foo.txt"~string:32~int,\n "bar.csv"~string:1024~int\n}~map(string, int).foo.txt~int', + type: "int", }, { original: { @@ -13249,8 +13255,10 @@ export const tests: SerializedIncrementalTestSuite = { expr: "has({'/api/v1': true, '/api/v2': false}.`/api/v3`)", value: { boolValue: false }, }, - error: - "ERROR: has_field_slash:1:41: unsupported syntax: '`'\n | has({'/api/v1': true, '/api/v2': false}.`/api/v3`)\n | ........................................^", + ast: '{\n "/api/v1"^#*expr.Constant_StringValue#:true^#*expr.Constant_BoolValue#^#*expr.Expr_CreateStruct_Entry#,\n "/api/v2"^#*expr.Constant_StringValue#:false^#*expr.Constant_BoolValue#^#*expr.Expr_CreateStruct_Entry#\n}^#*expr.Expr_StructExpr#./api/v3~test-only~^#*expr.Expr_SelectExpr#', + checkedAst: + '{\n "/api/v1"~string:true~bool,\n "/api/v2"~string:false~bool\n}~map(string, bool)./api/v3~test-only~~bool', + type: "bool", }, { original: { @@ -13258,8 +13266,10 @@ export const tests: SerializedIncrementalTestSuite = { expr: "has({'content-type': 'application/json', 'content-length': 145}.`content-type`)", value: { boolValue: true }, }, - error: - "ERROR: has_field_dash:1:65: unsupported syntax: '`'\n | has({'content-type': 'application/json', 'content-length': 145}.`content-type`)\n | ................................................................^", + ast: '{\n "content-type"^#*expr.Constant_StringValue#:"application/json"^#*expr.Constant_StringValue#^#*expr.Expr_CreateStruct_Entry#,\n "content-length"^#*expr.Constant_StringValue#:145^#*expr.Constant_Int64Value#^#*expr.Expr_CreateStruct_Entry#\n}^#*expr.Expr_StructExpr#.content-type~test-only~^#*expr.Expr_SelectExpr#', + checkedAst: + '{\n "content-type"~string:"application/json"~string,\n "content-length"~string:145~int\n}~map(string, dyn).content-type~test-only~~bool', + type: "bool", }, { original: { @@ -13267,8 +13277,10 @@ export const tests: SerializedIncrementalTestSuite = { expr: "has({'foo.txt': 32, 'bar.csv': 1024}.`foo.txt`)", value: { boolValue: true }, }, - error: - "ERROR: has_field_dot:1:38: unsupported syntax: '`'\n | has({'foo.txt': 32, 'bar.csv': 1024}.`foo.txt`)\n | .....................................^", + ast: '{\n "foo.txt"^#*expr.Constant_StringValue#:32^#*expr.Constant_Int64Value#^#*expr.Expr_CreateStruct_Entry#,\n "bar.csv"^#*expr.Constant_StringValue#:1024^#*expr.Constant_Int64Value#^#*expr.Expr_CreateStruct_Entry#\n}^#*expr.Expr_StructExpr#.foo.txt~test-only~^#*expr.Expr_SelectExpr#', + checkedAst: + '{\n "foo.txt"~string:32~int,\n "bar.csv"~string:1024~int\n}~map(string, int).foo.txt~test-only~~bool', + type: "bool", }, ], }, @@ -19016,7 +19028,7 @@ export const tests: SerializedIncrementalTestSuite = { }, ast: "_==_(\n type(\n optional^#*expr.Expr_IdentExpr#.none()^#*expr.Expr_CallExpr#\n )^#*expr.Expr_CallExpr#,\n optional_type^#*expr.Expr_IdentExpr#\n)^#*expr.Expr_CallExpr#", checkedAst: - "_==_(\n type(\n optional.none()~optional_type(dyn)^optional_none\n )~type(optional_type(dyn))^type,\n optional_type~type(optional_type)^optional_type\n)~bool^equals", + "_==_(\n type(\n optional.none()~optional_type(dyn)^optional_none\n )~type(optional_type(dyn))^type,\n optional_type~type(optional_type(dyn))^optional_type\n)~bool^equals", type: "bool", }, { @@ -23687,8 +23699,10 @@ export const tests: SerializedIncrementalTestSuite = { container: "cel.expr.conformance.proto2", value: { boolValue: false }, }, - error: - "ERROR: set_field_with_quoted_name:1:14: unsupported syntax: '`'\n | TestAllTypes{`in`: true} == TestAllTypes{}\n | .............^", + ast: "_==_(\n TestAllTypes{\n in:true^#*expr.Constant_BoolValue#^#*expr.Expr_CreateStruct_Entry#\n }^#*expr.Expr_StructExpr#,\n TestAllTypes{}^#*expr.Expr_StructExpr#\n)^#*expr.Expr_CallExpr#", + checkedAst: + "_==_(\n cel.expr.conformance.proto2.TestAllTypes{\n in:true~bool\n }~cel.expr.conformance.proto2.TestAllTypes^cel.expr.conformance.proto2.TestAllTypes,\n cel.expr.conformance.proto2.TestAllTypes{}~cel.expr.conformance.proto2.TestAllTypes^cel.expr.conformance.proto2.TestAllTypes\n)~bool^equals", + type: "bool", }, { original: { @@ -23697,8 +23711,10 @@ export const tests: SerializedIncrementalTestSuite = { container: "cel.expr.conformance.proto2", value: { boolValue: true }, }, - error: - "ERROR: get_field_with_quoted_name:1:14: unsupported syntax: '`'\n | TestAllTypes{`in`: true}.`in`\n | .............^\nERROR: get_field_with_quoted_name:1:26: unsupported syntax: '`'\n | TestAllTypes{`in`: true}.`in`\n | .........................^", + ast: "TestAllTypes{\n in:true^#*expr.Constant_BoolValue#^#*expr.Expr_CreateStruct_Entry#\n}^#*expr.Expr_StructExpr#.in^#*expr.Expr_SelectExpr#", + checkedAst: + "cel.expr.conformance.proto2.TestAllTypes{\n in:true~bool\n}~cel.expr.conformance.proto2.TestAllTypes^cel.expr.conformance.proto2.TestAllTypes.in~bool", + type: "bool", }, ], }, @@ -23731,8 +23747,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: package_scoped_int32:1:9: unsupported syntax: '`'\n | has(msg.`cel.expr.conformance.proto2.int32_ext`)\n | ........^", + ast: "msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.int32_ext~test-only~^#*expr.Expr_SelectExpr#", + checkedAst: + "msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.int32_ext~test-only~~bool", + type: "bool", }, { original: { @@ -23760,8 +23778,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: package_scoped_nested_ext:1:9: unsupported syntax: '`'\n | has(msg.`cel.expr.conformance.proto2.nested_ext`)\n | ........^", + ast: "msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.nested_ext~test-only~^#*expr.Expr_SelectExpr#", + checkedAst: + "msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.nested_ext~test-only~~bool", + type: "bool", }, { original: { @@ -23789,8 +23809,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: package_scoped_test_all_types_ext:1:9: unsupported syntax: '`'\n | has(msg.`cel.expr.conformance.proto2.test_all_types_ext`)\n | ........^", + ast: "msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.test_all_types_ext~test-only~^#*expr.Expr_SelectExpr#", + checkedAst: + "msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.test_all_types_ext~test-only~~bool", + type: "bool", }, { original: { @@ -23818,8 +23840,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: package_scoped_test_all_types_nested_enum_ext:1:9: unsupported syntax: '`'\n | has(msg.`cel.expr.conformance.proto2.nested_enum_ext`)\n | ........^", + ast: "msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.nested_enum_ext~test-only~^#*expr.Expr_SelectExpr#", + checkedAst: + "msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.nested_enum_ext~test-only~~bool", + type: "bool", }, { original: { @@ -23848,8 +23872,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: package_scoped_repeated_test_all_types:1:9: unsupported syntax: '`'\n | has(msg.`cel.expr.conformance.proto2.repeated_test_all_types`)\n | ........^", + ast: "msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.repeated_test_all_types~test-only~^#*expr.Expr_SelectExpr#", + checkedAst: + "msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.repeated_test_all_types~test-only~~bool", + type: "bool", }, { original: { @@ -23878,8 +23904,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: message_scoped_int64:1:9: unsupported syntax: '`'\n | has(msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext`)\n | ........^", + ast: "msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext~test-only~^#*expr.Expr_SelectExpr#", + checkedAst: + "msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext~test-only~~bool", + type: "bool", }, { original: { @@ -23908,8 +23936,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: message_scoped_nested_ext:1:9: unsupported syntax: '`'\n | has(msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext`)\n | ........^", + ast: "msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext~test-only~^#*expr.Expr_SelectExpr#", + checkedAst: + "msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext~test-only~~bool", + type: "bool", }, { original: { @@ -23938,8 +23968,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: message_scoped_nested_enum_ext:1:9: unsupported syntax: '`'\n | has(msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext`)\n | ........^", + ast: "msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext~test-only~^#*expr.Expr_SelectExpr#", + checkedAst: + "msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext~test-only~~bool", + type: "bool", }, { original: { @@ -23968,8 +24000,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: message_scoped_repeated_test_all_types:1:9: unsupported syntax: '`'\n | has(msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types`)\n | ........^", + ast: "msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types~test-only~^#*expr.Expr_SelectExpr#", + checkedAst: + "msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types~test-only~~bool", + type: "bool", }, ], }, @@ -24002,8 +24036,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: package_scoped_int32:1:5: unsupported syntax: '`'\n | msg.`cel.expr.conformance.proto2.int32_ext` == 42\n | ....^", + ast: "_==_(\n msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.int32_ext^#*expr.Expr_SelectExpr#,\n 42^#*expr.Constant_Int64Value#\n)^#*expr.Expr_CallExpr#", + checkedAst: + "_==_(\n msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.int32_ext~int,\n 42~int\n)~bool^equals", + type: "bool", }, { original: { @@ -24031,8 +24067,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: package_scoped_nested_ext:1:5: unsupported syntax: '`'\n | msg.`cel.expr.conformance.proto2.nested_ext` == cel.expr.conformance.proto2.TestAllTypes{}\n | ....^", + ast: "_==_(\n msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.nested_ext^#*expr.Expr_SelectExpr#,\n cel.expr.conformance.proto2.TestAllTypes{}^#*expr.Expr_StructExpr#\n)^#*expr.Expr_CallExpr#", + checkedAst: + "_==_(\n msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.nested_ext~cel.expr.conformance.proto2.TestAllTypes,\n cel.expr.conformance.proto2.TestAllTypes{}~cel.expr.conformance.proto2.TestAllTypes^cel.expr.conformance.proto2.TestAllTypes\n)~bool^equals", + type: "bool", }, { original: { @@ -24060,8 +24098,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: package_scoped_test_all_types_ext:1:5: unsupported syntax: '`'\n | msg.`cel.expr.conformance.proto2.test_all_types_ext` == cel.expr.conformance.proto2.TestAllTypes{}\n | ....^", + ast: "_==_(\n msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.test_all_types_ext^#*expr.Expr_SelectExpr#,\n cel.expr.conformance.proto2.TestAllTypes{}^#*expr.Expr_StructExpr#\n)^#*expr.Expr_CallExpr#", + checkedAst: + "_==_(\n msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.test_all_types_ext~cel.expr.conformance.proto2.TestAllTypes,\n cel.expr.conformance.proto2.TestAllTypes{}~cel.expr.conformance.proto2.TestAllTypes^cel.expr.conformance.proto2.TestAllTypes\n)~bool^equals", + type: "bool", }, { original: { @@ -24089,8 +24129,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: package_scoped_test_all_types_nested_enum_ext:1:5: unsupported syntax: '`'\n | msg.`cel.expr.conformance.proto2.nested_enum_ext` == cel.expr.conformance.proto2.TestAllTypes.NestedEnum.BAR\n | ....^", + ast: "_==_(\n msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.nested_enum_ext^#*expr.Expr_SelectExpr#,\n cel^#*expr.Expr_IdentExpr#.expr^#*expr.Expr_SelectExpr#.conformance^#*expr.Expr_SelectExpr#.proto2^#*expr.Expr_SelectExpr#.TestAllTypes^#*expr.Expr_SelectExpr#.NestedEnum^#*expr.Expr_SelectExpr#.BAR^#*expr.Expr_SelectExpr#\n)^#*expr.Expr_CallExpr#", + checkedAst: + "_==_(\n msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.nested_enum_ext~int,\n cel.expr.conformance.proto2.TestAllTypes.NestedEnum.BAR~int^cel.expr.conformance.proto2.TestAllTypes.NestedEnum.BAR\n)~bool^equals", + type: "bool", }, { original: { @@ -24119,8 +24161,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: package_scoped_repeated_test_all_types:1:5: unsupported syntax: '`'\n | msg.`cel.expr.conformance.proto2.repeated_test_all_types` == [cel.expr.conformance.proto2.TestAllTypes{single_int64: 1}, cel.expr.conformance.proto2.TestAllTypes{single_bool: true}]\n | ....^", + ast: "_==_(\n msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.repeated_test_all_types^#*expr.Expr_SelectExpr#,\n [\n cel.expr.conformance.proto2.TestAllTypes{\n single_int64:1^#*expr.Constant_Int64Value#^#*expr.Expr_CreateStruct_Entry#\n }^#*expr.Expr_StructExpr#,\n cel.expr.conformance.proto2.TestAllTypes{\n single_bool:true^#*expr.Constant_BoolValue#^#*expr.Expr_CreateStruct_Entry#\n }^#*expr.Expr_StructExpr#\n ]^#*expr.Expr_ListExpr#\n)^#*expr.Expr_CallExpr#", + checkedAst: + "_==_(\n msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.repeated_test_all_types~list(cel.expr.conformance.proto2.TestAllTypes),\n [\n cel.expr.conformance.proto2.TestAllTypes{\n single_int64:1~int\n }~cel.expr.conformance.proto2.TestAllTypes^cel.expr.conformance.proto2.TestAllTypes,\n cel.expr.conformance.proto2.TestAllTypes{\n single_bool:true~bool\n }~cel.expr.conformance.proto2.TestAllTypes^cel.expr.conformance.proto2.TestAllTypes\n ]~list(cel.expr.conformance.proto2.TestAllTypes)\n)~bool^equals", + type: "bool", }, { original: { @@ -24149,8 +24193,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: message_scoped_int64:1:5: unsupported syntax: '`'\n | msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext` == 42\n | ....^", + ast: "_==_(\n msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext^#*expr.Expr_SelectExpr#,\n 42^#*expr.Constant_Int64Value#\n)^#*expr.Expr_CallExpr#", + checkedAst: + "_==_(\n msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext~int,\n 42~int\n)~bool^equals", + type: "bool", }, { original: { @@ -24179,8 +24225,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: message_scoped_nested_ext:1:5: unsupported syntax: '`'\n | msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext` == cel.expr.conformance.proto2.TestAllTypes{}\n | ....^", + ast: "_==_(\n msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext^#*expr.Expr_SelectExpr#,\n cel.expr.conformance.proto2.TestAllTypes{}^#*expr.Expr_StructExpr#\n)^#*expr.Expr_CallExpr#", + checkedAst: + "_==_(\n msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext~cel.expr.conformance.proto2.TestAllTypes,\n cel.expr.conformance.proto2.TestAllTypes{}~cel.expr.conformance.proto2.TestAllTypes^cel.expr.conformance.proto2.TestAllTypes\n)~bool^equals", + type: "bool", }, { original: { @@ -24209,8 +24257,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: message_scoped_nested_enum_ext:1:5: unsupported syntax: '`'\n | msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext` == cel.expr.conformance.proto2.TestAllTypes.NestedEnum.BAR\n | ....^", + ast: "_==_(\n msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext^#*expr.Expr_SelectExpr#,\n cel^#*expr.Expr_IdentExpr#.expr^#*expr.Expr_SelectExpr#.conformance^#*expr.Expr_SelectExpr#.proto2^#*expr.Expr_SelectExpr#.TestAllTypes^#*expr.Expr_SelectExpr#.NestedEnum^#*expr.Expr_SelectExpr#.BAR^#*expr.Expr_SelectExpr#\n)^#*expr.Expr_CallExpr#", + checkedAst: + "_==_(\n msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext~int,\n cel.expr.conformance.proto2.TestAllTypes.NestedEnum.BAR~int^cel.expr.conformance.proto2.TestAllTypes.NestedEnum.BAR\n)~bool^equals", + type: "bool", }, { original: { @@ -24239,8 +24289,10 @@ export const tests: SerializedIncrementalTestSuite = { }, }, }, - error: - "ERROR: message_scoped_repeated_test_all_types:1:5: unsupported syntax: '`'\n | msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types` == [cel.expr.conformance.proto2.TestAllTypes{single_int64: 1}, cel.expr.conformance.proto2.TestAllTypes{single_bool: true}]\n | ....^", + ast: "_==_(\n msg^#*expr.Expr_IdentExpr#.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types^#*expr.Expr_SelectExpr#,\n [\n cel.expr.conformance.proto2.TestAllTypes{\n single_int64:1^#*expr.Constant_Int64Value#^#*expr.Expr_CreateStruct_Entry#\n }^#*expr.Expr_StructExpr#,\n cel.expr.conformance.proto2.TestAllTypes{\n single_bool:true^#*expr.Constant_BoolValue#^#*expr.Expr_CreateStruct_Entry#\n }^#*expr.Expr_StructExpr#\n ]^#*expr.Expr_ListExpr#\n)^#*expr.Expr_CallExpr#", + checkedAst: + "_==_(\n msg~cel.expr.conformance.proto2.TestAllTypes^msg.cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types~list(cel.expr.conformance.proto2.TestAllTypes),\n [\n cel.expr.conformance.proto2.TestAllTypes{\n single_int64:1~int\n }~cel.expr.conformance.proto2.TestAllTypes^cel.expr.conformance.proto2.TestAllTypes,\n cel.expr.conformance.proto2.TestAllTypes{\n single_bool:true~bool\n }~cel.expr.conformance.proto2.TestAllTypes^cel.expr.conformance.proto2.TestAllTypes\n ]~list(cel.expr.conformance.proto2.TestAllTypes)\n)~bool^equals", + type: "bool", }, ], }, @@ -25976,8 +26028,10 @@ export const tests: SerializedIncrementalTestSuite = { container: "cel.expr.conformance.proto3", value: { boolValue: false }, }, - error: - "ERROR: set_field:1:14: unsupported syntax: '`'\n | TestAllTypes{`in`: true} == TestAllTypes{}\n | .............^", + ast: "_==_(\n TestAllTypes{\n in:true^#*expr.Constant_BoolValue#^#*expr.Expr_CreateStruct_Entry#\n }^#*expr.Expr_StructExpr#,\n TestAllTypes{}^#*expr.Expr_StructExpr#\n)^#*expr.Expr_CallExpr#", + checkedAst: + "_==_(\n cel.expr.conformance.proto3.TestAllTypes{\n in:true~bool\n }~cel.expr.conformance.proto3.TestAllTypes^cel.expr.conformance.proto3.TestAllTypes,\n cel.expr.conformance.proto3.TestAllTypes{}~cel.expr.conformance.proto3.TestAllTypes^cel.expr.conformance.proto3.TestAllTypes\n)~bool^equals", + type: "bool", }, { original: { @@ -25986,8 +26040,10 @@ export const tests: SerializedIncrementalTestSuite = { container: "cel.expr.conformance.proto3", value: { boolValue: true }, }, - error: - "ERROR: get_field:1:14: unsupported syntax: '`'\n | TestAllTypes{`in`: true}.`in`\n | .............^\nERROR: get_field:1:26: unsupported syntax: '`'\n | TestAllTypes{`in`: true}.`in`\n | .........................^", + ast: "TestAllTypes{\n in:true^#*expr.Constant_BoolValue#^#*expr.Expr_CreateStruct_Entry#\n}^#*expr.Expr_StructExpr#.in^#*expr.Expr_SelectExpr#", + checkedAst: + "cel.expr.conformance.proto3.TestAllTypes{\n in:true~bool\n}~cel.expr.conformance.proto3.TestAllTypes^cel.expr.conformance.proto3.TestAllTypes.in~bool", + type: "bool", }, ], }, diff --git a/packages/cel-spec/src/testdata/parsing.ts b/packages/cel-spec/src/testdata/parsing.ts index 081da260..ac2572c1 100644 --- a/packages/cel-spec/src/testdata/parsing.ts +++ b/packages/cel-spec/src/testdata/parsing.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Generated from cel-go github.com/google/cel-go@v0.26.1/parser/parser_test.go +// Generated from cel-go github.com/google/cel-go@v0.29.0/parser/parser_test.go import type { SerializedIncrementalTestSuite } from "./tests.js"; export const tests: SerializedIncrementalTestSuite = { name: "parsing", @@ -966,28 +966,39 @@ export const tests: SerializedIncrementalTestSuite = { }, { original: { expr: "a.`b-c`" }, - error: "ERROR: :1:3: unsupported syntax: '`'\n | a.`b-c`\n | ..^", + ast: "a^#*expr.Expr_IdentExpr#.b-c^#*expr.Expr_SelectExpr#", + error: + "ERROR: \u003cinput\u003e:1:1: undeclared reference to 'a' (in container '')\n | a.`b-c`\n | ^", }, { original: { expr: "a.`b c`" }, - error: "ERROR: :1:3: unsupported syntax: '`'\n | a.`b c`\n | ..^", + ast: "a^#*expr.Expr_IdentExpr#.b c^#*expr.Expr_SelectExpr#", + error: + "ERROR: \u003cinput\u003e:1:1: undeclared reference to 'a' (in container '')\n | a.`b c`\n | ^", }, { original: { expr: "a.`b.c`" }, - error: "ERROR: :1:3: unsupported syntax: '`'\n | a.`b.c`\n | ..^", + ast: "a^#*expr.Expr_IdentExpr#.b.c^#*expr.Expr_SelectExpr#", + error: + "ERROR: \u003cinput\u003e:1:1: undeclared reference to 'a' (in container '')\n | a.`b.c`\n | ^", }, { original: { expr: "a.`in`" }, - error: "ERROR: :1:3: unsupported syntax: '`'\n | a.`in`\n | ..^", + ast: "a^#*expr.Expr_IdentExpr#.in^#*expr.Expr_SelectExpr#", + error: + "ERROR: \u003cinput\u003e:1:1: undeclared reference to 'a' (in container '')\n | a.`in`\n | ^", }, { original: { expr: "a.`/foo`" }, - error: "ERROR: :1:3: unsupported syntax: '`'\n | a.`/foo`\n | ..^", + ast: "a^#*expr.Expr_IdentExpr#./foo^#*expr.Expr_SelectExpr#", + error: + "ERROR: \u003cinput\u003e:1:1: undeclared reference to 'a' (in container '')\n | a.`/foo`\n | ^", }, { original: { expr: "Message{`in`: true}" }, + ast: "Message{\n in:true^#*expr.Constant_BoolValue#^#*expr.Expr_CreateStruct_Entry#\n}^#*expr.Expr_StructExpr#", error: - "ERROR: :1:9: unsupported syntax: '`'\n | Message{`in`: true}\n | ........^", + "ERROR: \u003cinput\u003e:1:8: undeclared reference to 'Message' (in container '')\n | Message{`in`: true}\n | .......^", }, { original: { expr: "`b-c`" }, @@ -1007,28 +1018,37 @@ export const tests: SerializedIncrementalTestSuite = { { original: { expr: "a.`b.c`()" }, error: - "ERROR: :1:3: unsupported syntax: '`'\n | a.`b.c`()\n | ..^\nERROR: :1:8: Syntax error: mismatched input '(' expecting \u003cEOF\u003e\n | a.`b.c`()\n | .......^", + "ERROR: :1:8: Syntax error: mismatched input '(' expecting \u003cEOF\u003e\n | a.`b.c`()\n | .......^", }, { original: { expr: "a.`b-c`" }, - error: "ERROR: :1:3: unsupported syntax: '`'\n | a.`b-c`\n | ..^", + ast: "a^#*expr.Expr_IdentExpr#.b-c^#*expr.Expr_SelectExpr#", + error: + "ERROR: \u003cinput\u003e:1:1: undeclared reference to 'a' (in container '')\n | a.`b-c`\n | ^", }, { original: { expr: "a.`b.c`" }, - error: "ERROR: :1:3: unsupported syntax: '`'\n | a.`b.c`\n | ..^", + ast: "a^#*expr.Expr_IdentExpr#.b.c^#*expr.Expr_SelectExpr#", + error: + "ERROR: \u003cinput\u003e:1:1: undeclared reference to 'a' (in container '')\n | a.`b.c`\n | ^", }, { original: { expr: "a.`in`" }, - error: "ERROR: :1:3: unsupported syntax: '`'\n | a.`in`\n | ..^", + ast: "a^#*expr.Expr_IdentExpr#.in^#*expr.Expr_SelectExpr#", + error: + "ERROR: \u003cinput\u003e:1:1: undeclared reference to 'a' (in container '')\n | a.`in`\n | ^", }, { original: { expr: "a.`/foo`" }, - error: "ERROR: :1:3: unsupported syntax: '`'\n | a.`/foo`\n | ..^", + ast: "a^#*expr.Expr_IdentExpr#./foo^#*expr.Expr_SelectExpr#", + error: + "ERROR: \u003cinput\u003e:1:1: undeclared reference to 'a' (in container '')\n | a.`/foo`\n | ^", }, { original: { expr: "Message{`in`: true}" }, + ast: "Message{\n in:true^#*expr.Constant_BoolValue#^#*expr.Expr_CreateStruct_Entry#\n}^#*expr.Expr_StructExpr#", error: - "ERROR: :1:9: unsupported syntax: '`'\n | Message{`in`: true}\n | ........^", + "ERROR: \u003cinput\u003e:1:8: undeclared reference to 'Message' (in container '')\n | Message{`in`: true}\n | .......^", }, { original: { expr: "noop_macro(123)" }, diff --git a/packages/cel-spec/turbo.json b/packages/cel-spec/turbo.json index a60951e3..44b3de7e 100644 --- a/packages/cel-spec/turbo.json +++ b/packages/cel-spec/turbo.json @@ -28,9 +28,9 @@ "env": ["GO*"], "outputLogs": "new-only" }, - "fetch-comprehensions": { + "fetch-comprehension": { "inputs": ["scripts/*.go", "scripts/go.*", "package.json"], - "outputs": ["src/testdata/comprehensions.ts"], + "outputs": ["src/testdata/comprehension.ts"], "env": ["GO*"], "outputLogs": "new-only" }, @@ -50,7 +50,7 @@ "generate", "fetch-parsing", "fetch-checking", - "fetch-comprehensions", + "fetch-comprehension", "fetch-conformance" ], "inputs": ["src/**", "scripts/**"], diff --git a/packages/cel/src/cel.peggy b/packages/cel/src/cel.peggy index a38480a3..ced86b97 100644 --- a/packages/cel/src/cel.peggy +++ b/packages/cel/src/cel.peggy @@ -165,7 +165,7 @@ MemberTail = (S @Access)* Access - = "." S field:Selector S ![(] + = "." S field:FieldSelector S ![(] { return ((prevExpr: Expr) => builder.newSelectExpr(offset(), prevExpr, field)) } / "." S func:Selector S "(" args:ExprList ")" { return ((prevExpr: Expr) => builder.newMemberCallExpr(offset(), prevExpr, func, args)) } @@ -191,7 +191,7 @@ ExprList FieldInits = ( - S key:Selector $(S ":") value:Expr + S key:FieldSelector $(S ":") value:Expr { return builder.newStructEntry(offset(), key, value) } )|0.., ","| @@ -225,6 +225,13 @@ Selector "selector" return selector; } +FieldSelector + = Selector / QuotedIdentifier + +QuotedIdentifier "quoted identifier" + = "`" name:$([^`$]+) "`" + { return name } + Literal = FloatLiteral / UnsignedIntLiteral / IntLiteral / StringLiteral / BytesLiteral / BooleanLiteral / NullLiteral diff --git a/packages/cel/src/checker.test.ts b/packages/cel/src/checker.test.ts index 6fb6ad37..bff7600d 100644 --- a/packages/cel/src/checker.test.ts +++ b/packages/cel/src/checker.test.ts @@ -100,6 +100,11 @@ const filter = createExpressionFilter([ "[?a, ?b, 'world']", "null_int == null || null == null_int || null_msg == null || null == null_msg", "NotAMessage{}", + // Comprehension expressions are not yet supported by the checker. + "[{'z': 0}].exists(y, y.z == 0)", + "[{'y': 0}].exists(x, x.y == 0)", + "[0].exists(x, x != .x)", + "[{'z': 0}].exists(y, .y.z == y.z)", "{}.map(c,[c,type(c)])", ]); diff --git a/packages/cel/src/conformance.test.ts b/packages/cel/src/conformance.test.ts index 35cd53c2..e523aa60 100644 --- a/packages/cel/src/conformance.test.ts +++ b/packages/cel/src/conformance.test.ts @@ -20,12 +20,8 @@ import { import { getConformanceSuite } from "@bufbuild/cel-spec/testdata/tests.js"; const filter = createPathFilter([ - // Requires update to the parser to support quoted fields. - ["fields", "quoted_map_fields"], - ["proto2", "quoted_fields"], ["proto2", "extensions_get"], ["proto2", "extensions_has"], - ["proto3", "quoted_fields"], // We don't have full support for type-checking. ["type_deductions", "complex_initializers"], ["type_deductions", "field_access"], diff --git a/packages/cel/src/parser.ts b/packages/cel/src/parser.ts index d66031f8..1a661535 100644 --- a/packages/cel/src/parser.ts +++ b/packages/cel/src/parser.ts @@ -456,75 +456,87 @@ const item413: runtime.Expectation = { type: "literal", value: "{", }; -const item423: runtime.Expectation = { +const item427: runtime.Expectation = { type: "literal", - value: ":", + value: "`", }; const item432: runtime.Expectation = { + type: "class", + value: "/^[^`$]/g", +}; +const item436: runtime.Expectation = { + type: "other", + value: "quoted identifier", +}; +const item440: runtime.Expectation = { + type: "literal", + value: ":", +}; +const item449: runtime.Expectation = { type: "literal", value: "}", }; -const item451: runtime.Expectation = { +const item467: runtime.Expectation = { type: "literal", value: "[", }; -const item456: runtime.Expectation = { +const item472: runtime.Expectation = { type: "literal", value: "]", }; -const item524: runtime.Expectation = { +const item540: runtime.Expectation = { type: "literal", value: "!", }; -const item540: runtime.Expectation = { +const item556: runtime.Expectation = { type: "class", value: "/^[*\\/%]/g", }; -const item577: runtime.Expectation = { +const item593: runtime.Expectation = { type: "literal", value: "<=", }; -const item579: runtime.Expectation = { +const item595: runtime.Expectation = { type: "literal", value: "<", }; -const item581: runtime.Expectation = { +const item597: runtime.Expectation = { type: "literal", value: ">=", }; -const item583: runtime.Expectation = { +const item599: runtime.Expectation = { type: "literal", value: ">", }; -const item585: runtime.Expectation = { +const item601: runtime.Expectation = { type: "literal", value: "==", }; -const item587: runtime.Expectation = { +const item603: runtime.Expectation = { type: "literal", value: "!=", }; -const item591: runtime.Expectation = { +const item607: runtime.Expectation = { type: "literal", value: "in", }; -const item593: runtime.Expectation = { +const item609: runtime.Expectation = { type: "other", value: "relational operator", }; -const item601: runtime.Expectation = { +const item617: runtime.Expectation = { type: "literal", value: "&&", }; -const item607: runtime.Expectation = { +const item623: runtime.Expectation = { type: "literal", value: "||", }; -const item616: runtime.Expectation = { +const item632: runtime.Expectation = { type: "literal", value: "?", }; -const item624: runtime.Expectation = { +const item640: runtime.Expectation = { type: "end", value: "end of input", }; @@ -683,14 +695,17 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } return selector; } - function item427( + function item435(name: string): string { + return name; + } + function item444( offset: () => number, key: string, value: Expr, ): Expr_CreateStruct_Entry { return builder.newStructEntry(offset(), key, value); } - function item434( + function item451( offset: () => number, dot: "." | null, name: string[], @@ -702,32 +717,32 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { (dot !== null ? dot : "") + name.join("."), ); } - function item441(offset: () => number, name: string): Expr { + function item457(offset: () => number, name: string): Expr { return builder.newIdentExpr(offset(), name); } - function item458(offset: () => number, elements: Expr[]): Expr { + function item474(offset: () => number, elements: Expr[]): Expr { return builder.newListExpr(offset(), elements); } - function item472( + function item488( offset: () => number, key: Expr, value: Expr, ): Expr_CreateStruct_Entry { return builder.newMapEntry(offset(), key, value); } - function item481( + function item497( offset: () => number, entries: Expr_CreateStruct_Entry[], ): Expr { return builder.newStructExpr(offset(), entries); } - function item497( + function item513( offset: () => number, field: string, ): (prevExpr: Expr) => Expr { return (prevExpr: Expr) => builder.newSelectExpr(offset(), prevExpr, field); } - function item506( + function item522( offset: () => number, func: string, args: Expr[], @@ -735,21 +750,21 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return (prevExpr: Expr) => builder.newMemberCallExpr(offset(), prevExpr, func, args); } - function item513( + function item529( offset: () => number, index: Expr, ): (prevExpr: Expr) => Expr { return (prevExpr: Expr) => builder.newCallExpr(offset(), "_[_]", [prevExpr, index]); } - function item516(primary: Expr, tail: ((prevExpr: Expr) => Expr)[]): Expr { + function item532(primary: Expr, tail: ((prevExpr: Expr) => Expr)[]): Expr { /* : Expr */ if (tail.length === 0) { return primary; } return tail.reduce((expr, op) => op(expr), primary); } - function item529(offset: () => number, ops: string, expr: Expr): Expr { + function item545(offset: () => number, ops: string, expr: Expr): Expr { /* : Expr */ if (ops.length % 2 === 0) { return expr; @@ -762,10 +777,10 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } return builder.newCallExpr(offset(), `${ops[0]}_`, [expr]); } - function item541(o: string): string { + function item557(o: string): string { return `_${o}_`; } - function item544( + function item560( offset: () => number, operator: string, nextExpr: Expr, @@ -773,7 +788,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return (prevExpr: Expr) => builder.newCallExpr(offset(), operator, [prevExpr, nextExpr]); } - function item546( + function item562( unary: Expr, tail: ((prevExpr: Expr) => Expr)[] | null, ): Expr { @@ -783,10 +798,10 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } return tail.reduce((expr, op) => op(expr), unary); } - function item557(o: string): string { + function item573(o: string): string { return `_${o}_`; } - function item559( + function item575( offset: () => number, operator: string, nextExpr: Expr, @@ -794,7 +809,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return (prevExpr: Expr) => builder.newCallExpr(offset(), operator, [prevExpr, nextExpr]); } - function item561( + function item577( multiplication: Expr, tail: ((prevExpr: Expr) => Expr)[] | null, ): Expr { @@ -804,13 +819,13 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } return tail.reduce((expr, op) => op(expr), multiplication); } - function item588(operator: string): string { + function item604(operator: string): string { return `_${operator}_`; } - function item592(): string { + function item608(): string { return "@in"; } - function item595( + function item611( offset: () => number, operator: string, nextExpr: Expr, @@ -818,7 +833,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return (prevExpr: Expr) => builder.newCallExpr(offset(), operator, [prevExpr, nextExpr]); } - function item597( + function item613( addition: Expr, tail: ((prevExpr: Expr) => Expr)[] | null, ): Expr { @@ -828,7 +843,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } return tail.reduce((expr, op) => op(expr), addition); } - function item603(offset: () => number, relation: Expr[]): Expr { + function item619(offset: () => number, relation: Expr[]): Expr { /* : Expr */ if (relation.length === 1) { return relation[0]; @@ -843,7 +858,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } return logicManager.toExpr(); } - function item609(offset: () => number, and: Expr[]): Expr { + function item625(offset: () => number, and: Expr[]): Expr { /* : Expr */ if (and.length === 1) { return and[0]; @@ -858,11 +873,11 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } return logicManager.toExpr(); } - function item621(t: Expr, f: Expr): [Expr, Expr] { + function item637(t: Expr, f: Expr): [Expr, Expr] { /* : [Expr, Expr] */ return [t, f]; } - function item623( + function item639( offset: () => number, or: Expr, tail: [Expr, Expr] | null, @@ -884,7 +899,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { remainder: result.remainder, failedExpectations: [ { - expectation: item624, + expectation: item640, remainder: result.remainder, }, ], @@ -907,7 +922,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { if (result.success === true) { return { success: true, - value: item623( + value: item639( () => input.length - text.length, result.value[0], result.value[1], @@ -956,7 +971,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } remainder = remainder.slice(result1[0].length); - const result2 = item611(remainder); + const result2 = item627(remainder); failedExpectations.push(...result2.failedExpectations); if (result2.success === false) { return { @@ -995,7 +1010,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { if (result.success === true) { return { success: true, - value: item609(() => input.length - text.length, result.value), + value: item625(() => input.length - text.length, result.value), remainder: result.remainder, failedExpectations: [], }; @@ -1010,7 +1025,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { while (true) { let r = remainder; if (values.length > 0) { - const result = item604(r); + const result = item620(r); failedExpectations.push(...result.failedExpectations); if (result.success === false) { break; @@ -1052,7 +1067,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { if (result.success === true) { return { success: true, - value: item603(() => input.length - text.length, result.value), + value: item619(() => input.length - text.length, result.value), remainder: result.remainder, failedExpectations: [], }; @@ -1067,7 +1082,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { while (true) { let r = remainder; if (values.length > 0) { - const result = item598(r); + const result = item614(r); failedExpectations.push(...result.failedExpectations); if (result.success === false) { break; @@ -1101,7 +1116,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { if (result.success === true) { return { success: true, - value: item597(result.value[0], result.value[1]), + value: item613(result.value[0], result.value[1]), remainder: result.remainder, failedExpectations: [], }; @@ -1126,7 +1141,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } remainder = result0.remainder; - const result1 = item563(remainder); + const result1 = item579(remainder); failedExpectations.push(...result1.failedExpectations); if (result1.success === false) { return { @@ -1157,7 +1172,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { if (result.success === true) { return { success: true, - value: item561(result.value[0], result.value[1]), + value: item577(result.value[0], result.value[1]), remainder: result.remainder, failedExpectations: [], }; @@ -1182,7 +1197,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } remainder = result0.remainder; - const result1 = item548(remainder); + const result1 = item564(remainder); failedExpectations.push(...result1.failedExpectations); if (result1.success === false) { return { @@ -1213,7 +1228,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { if (result.success === true) { return { success: true, - value: item546(result.value[0], result.value[1]), + value: item562(result.value[0], result.value[1]), remainder: result.remainder, failedExpectations: [], }; @@ -1238,7 +1253,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } remainder = result0.remainder; - const result1 = item531(remainder); + const result1 = item547(remainder); failedExpectations.push(...result1.failedExpectations); if (result1.success === false) { return { @@ -1270,7 +1285,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { // return builder.newCallExpr(offset(), `${ops[0]}_`, [expr]); // } function item28(text: string): runtime.Success | runtime.Failure { - const choices = [item30, item517]; + const choices = [item30, item533]; let failedExpectations: runtime.FailedExpectation[] = []; for ( let func = choices.shift(); @@ -1308,7 +1323,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { if (result.success === true) { return { success: true, - value: item516(result.value[0], result.value[1]), + value: item532(result.value[0], result.value[1]), remainder: result.remainder, failedExpectations: [], }; @@ -1352,7 +1367,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } remainder = result1.remainder; - const result2 = item484(remainder); + const result2 = item500(remainder); failedExpectations.push(...result2.failedExpectations); if (result2.success === false) { return { @@ -1702,10 +1717,10 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { item65, item362, item391, - item435, - item442, - item447, - item459, + item452, + item458, + item463, + item475, ]; let failedExpectations: runtime.FailedExpectation[] = []; for ( @@ -4438,7 +4453,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { if (result.success === true) { return { success: true, - value: item434( + value: item451( () => input.length - text.length, result.value[0], result.value[1], @@ -4579,7 +4594,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { remainder = remainder.slice(result7[0].length); const result8 = remainder.match(/^\}/g); failedExpectations.push({ - expectation: item432, + expectation: item449, remainder: remainder, }); if (result8?.length !== 1) { @@ -4816,7 +4831,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } // ( - // S key:Selector $(S ":") value:Expr + // S key:FieldSelector $(S ":") value:Expr // { return builder.newStructEntry(offset(), key, value) } // )|0.., ","| function item416( @@ -4828,7 +4843,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { while (true) { let r = remainder; if (values.length > 0) { - const result = item428(r); + const result = item445(r); failedExpectations.push(...result.failedExpectations); if (result.success === false) { break; @@ -4845,7 +4860,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } return { success: true, value: values, remainder, failedExpectations }; } - // S key:Selector $(S ":") value:Expr + // S key:FieldSelector $(S ":") value:Expr // { return builder.newStructEntry(offset(), key, value) } function item417( text: string, @@ -4854,7 +4869,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { if (result.success === true) { return { success: true, - value: item427( + value: item444( () => input.length - text.length, result.value[0], result.value[1], @@ -4865,7 +4880,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } return result; } - // S key:Selector $(S ":") value:Expr + // S key:FieldSelector $(S ":") value:Expr function item418( text: string, ): runtime.Success<[string, Expr]> | runtime.Failure { @@ -4892,7 +4907,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } remainder = remainder.slice(result0[0].length); - const result1 = item399(remainder); + const result1 = item421(remainder); failedExpectations.push(...result1.failedExpectations); if (result1.success === false) { return { @@ -4915,7 +4930,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { remainder: remainder, }, { - expectation: item423, + expectation: item440, remainder: remainder, }, ); @@ -4944,8 +4959,137 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { failedExpectations, }; } + // Selector / QuotedIdentifier + function item421(text: string): runtime.Success | runtime.Failure { + const choices = [item399, item423]; + let failedExpectations: runtime.FailedExpectation[] = []; + for ( + let func = choices.shift(); + func !== undefined; + func = choices.shift() + ) { + const result = func(text); + failedExpectations.push(...result.failedExpectations); + if (result.success === true) { + return { + success: true, + value: result.value, + remainder: result.remainder, + failedExpectations, + }; + } + } + return { + success: false, + remainder: text, + failedExpectations, + }; + } + // QuotedIdentifier "quoted identifier" + // = "`" name:$([^`$]+) "`" + // { return name } + // + function item423(text: string): runtime.Success | runtime.Failure { + const result = item424(text); + if (result.success === true) { + return result; + } + return { + success: false, + remainder: result.remainder, + failedExpectations: [ + { + expectation: item436, + remainder: result.remainder, + }, + ], + }; + } + // "`" name:$([^`$]+) "`" + // { return name } + function item424(text: string): runtime.Success | runtime.Failure { + const result = item425(text); + if (result.success === true) { + return { + success: true, + value: item435(result.value[0]), + remainder: result.remainder, + failedExpectations: [], + }; + } + return result; + } + // "`" name:$([^`$]+) "`" + function item425(text: string): runtime.Success<[string]> | runtime.Failure { + const failedExpectations: runtime.FailedExpectation[] = []; + let remainder = text; + const result0 = remainder.match(/^`/g); + failedExpectations.push({ + expectation: item427, + remainder: remainder, + }); + if (result0?.length !== 1) { + return { + success: false, + remainder, + failedExpectations, + }; + } + remainder = remainder.slice(result0[0].length); + const result1 = item429(remainder); + failedExpectations.push(...result1.failedExpectations); + if (result1.success === false) { + return { + success: false, + remainder: result1.remainder, + failedExpectations, + }; + } + remainder = result1.remainder; + const result2 = remainder.match(/^`/g); + failedExpectations.push({ + expectation: item427, + remainder: remainder, + }); + if (result2?.length !== 1) { + return { + success: false, + remainder, + failedExpectations, + }; + } + remainder = remainder.slice(result2[0].length); + return { + success: true, + value: [result1.value], + remainder, + failedExpectations, + }; + } + // $([^`$]+) + function item429(text: string): runtime.Success | runtime.Failure { + const matches = text.match(/^([^`$])+/g); + if (matches?.length === 1) { + return { + success: true, + value: matches[0], + remainder: text.slice(matches[0].length), + failedExpectations: [], + }; + } + return { + success: false, + remainder: text, + failedExpectations: [ + { + expectation: item432, + remainder: text, + }, + ], + }; + } // "," - function item428(text: string): runtime.Success<","> | runtime.Failure { + function item445(text: string): runtime.Success<","> | runtime.Failure { if (text.startsWith(",")) { return { success: true, @@ -4967,12 +5111,12 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } // "."? S name:Selector // { return builder.newIdentExpr(offset(), name) } - function item435(text: string): runtime.Success | runtime.Failure { - const result = item436(text); + function item452(text: string): runtime.Success | runtime.Failure { + const result = item453(text); if (result.success === true) { return { success: true, - value: item441(() => input.length - text.length, result.value[0]), + value: item457(() => input.length - text.length, result.value[0]), remainder: result.remainder, failedExpectations: [], }; @@ -4980,7 +5124,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return result; } // "."? S name:Selector - function item436(text: string): runtime.Success<[string]> | runtime.Failure { + function item453(text: string): runtime.Success<[string]> | runtime.Failure { const failedExpectations: runtime.FailedExpectation[] = []; let remainder = text; const result0 = remainder.match(/^(\.)?/g); @@ -5035,7 +5179,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } // "(" @Expr ")" - function item442(text: string): runtime.Success | runtime.Failure { + function item458(text: string): runtime.Success | runtime.Failure { const failedExpectations: runtime.FailedExpectation[] = []; let remainder = text; const result0 = remainder.match(/^\(/g); @@ -5083,12 +5227,12 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } // elements:("[" @ExprList (",")? S "]") // { return builder.newListExpr(offset(), elements) } - function item447(text: string): runtime.Success | runtime.Failure { - const result = item449(text); + function item463(text: string): runtime.Success | runtime.Failure { + const result = item465(text); if (result.success === true) { return { success: true, - value: item458(() => input.length - text.length, result.value), + value: item474(() => input.length - text.length, result.value), remainder: result.remainder, failedExpectations: [], }; @@ -5096,12 +5240,12 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return result; } // "[" @ExprList (",")? S "]" - function item449(text: string): runtime.Success | runtime.Failure { + function item465(text: string): runtime.Success | runtime.Failure { const failedExpectations: runtime.FailedExpectation[] = []; let remainder = text; const result0 = remainder.match(/^\[/g); failedExpectations.push({ - expectation: item451, + expectation: item467, remainder: remainder, }); if (result0?.length !== 1) { @@ -5158,7 +5302,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { remainder = remainder.slice(result3[0].length); const result4 = remainder.match(/^\]/g); failedExpectations.push({ - expectation: item456, + expectation: item472, remainder: remainder, }); if (result4?.length !== 1) { @@ -5178,12 +5322,12 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } // entries:("{" @MapInits $((",")? S "}")) // { return builder.newStructExpr(offset(), entries) } - function item459(text: string): runtime.Success | runtime.Failure { - const result = item461(text); + function item475(text: string): runtime.Success | runtime.Failure { + const result = item477(text); if (result.success === true) { return { success: true, - value: item481(() => input.length - text.length, result.value), + value: item497(() => input.length - text.length, result.value), remainder: result.remainder, failedExpectations: [], }; @@ -5191,7 +5335,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return result; } // "{" @MapInits $((",")? S "}") - function item461( + function item477( text: string, ): runtime.Success | runtime.Failure { const failedExpectations: runtime.FailedExpectation[] = []; @@ -5209,7 +5353,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } remainder = remainder.slice(result0[0].length); - const result1 = item465(remainder); + const result1 = item481(remainder); failedExpectations.push(...result1.failedExpectations); if (result1.success === false) { return { @@ -5236,7 +5380,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { remainder: remainder, }, { - expectation: item432, + expectation: item449, remainder: remainder, }, ); @@ -5259,7 +5403,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { // key:Expr ":" value:Expr // { return builder.newMapEntry(offset(), key, value) } // )|0.., ","| - function item465( + function item481( text: string, ): runtime.Success | runtime.Failure { const values: Array = []; @@ -5268,14 +5412,14 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { while (true) { let r = remainder; if (values.length > 0) { - const result = item473(r); + const result = item489(r); failedExpectations.push(...result.failedExpectations); if (result.success === false) { break; } r = result.remainder; } - const result = item466(r); + const result = item482(r); failedExpectations.push(...result.failedExpectations); if (result.success === false) { break; @@ -5287,14 +5431,14 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } // key:Expr ":" value:Expr // { return builder.newMapEntry(offset(), key, value) } - function item466( + function item482( text: string, ): runtime.Success | runtime.Failure { - const result = item467(text); + const result = item483(text); if (result.success === true) { return { success: true, - value: item472( + value: item488( () => input.length - text.length, result.value[0], result.value[1], @@ -5306,7 +5450,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return result; } // key:Expr ":" value:Expr - function item467( + function item483( text: string, ): runtime.Success<[Expr, Expr]> | runtime.Failure { const failedExpectations: runtime.FailedExpectation[] = []; @@ -5323,7 +5467,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { remainder = result0.remainder; const result1 = remainder.match(/^:/g); failedExpectations.push({ - expectation: item423, + expectation: item440, remainder: remainder, }); if (result1?.length !== 1) { @@ -5352,7 +5496,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } // "," - function item473(text: string): runtime.Success<","> | runtime.Failure { + function item489(text: string): runtime.Success<","> | runtime.Failure { if (text.startsWith(",")) { return { success: true, @@ -5373,7 +5517,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } // (S @Access)* - function item484( + function item500( text: string, ): runtime.Success<((prevExpr: Expr) => Expr)[]> | runtime.Failure { const values: Array<(prevExpr: Expr) => Expr> = []; @@ -5381,7 +5525,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { let remainder = text; while (true) { let r = remainder; - const result = item485(r); + const result = item501(r); failedExpectations.push(...result.failedExpectations); if (result.success === false) { break; @@ -5392,7 +5536,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return { success: true, value: values, remainder, failedExpectations }; } // S @Access - function item485( + function item501( text: string, ): runtime.Success<(prevExpr: Expr) => Expr> | runtime.Failure { const failedExpectations: runtime.FailedExpectation[] = []; @@ -5418,7 +5562,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } remainder = remainder.slice(result0[0].length); - const result1 = item488(remainder); + const result1 = item504(remainder); failedExpectations.push(...result1.failedExpectations); if (result1.success === false) { return { @@ -5435,16 +5579,16 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { failedExpectations, }; } - // "." S field:Selector S ![(] + // "." S field:FieldSelector S ![(] // { return ((prevExpr: Expr) => builder.newSelectExpr(offset(), prevExpr, field)) } // / "." S func:Selector S "(" args:ExprList ")" // { return ((prevExpr: Expr) => builder.newMemberCallExpr(offset(), prevExpr, func, args)) } // / "[" index:Expr "]" // { return ((prevExpr: Expr) => builder.newCallExpr(offset(), "_[_]", [prevExpr, index])) } - function item488( + function item504( text: string, ): runtime.Success<(prevExpr: Expr) => Expr> | runtime.Failure { - const choices = [item489, item498, item507]; + const choices = [item505, item514, item523]; let failedExpectations: runtime.FailedExpectation[] = []; for ( let func = choices.shift(); @@ -5468,24 +5612,24 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { failedExpectations, }; } - // "." S field:Selector S ![(] + // "." S field:FieldSelector S ![(] // { return ((prevExpr: Expr) => builder.newSelectExpr(offset(), prevExpr, field)) } - function item489( + function item505( text: string, ): runtime.Success<(prevExpr: Expr) => Expr> | runtime.Failure { - const result = item490(text); + const result = item506(text); if (result.success === true) { return { success: true, - value: item497(() => input.length - text.length, result.value[0]), + value: item513(() => input.length - text.length, result.value[0]), remainder: result.remainder, failedExpectations: [], }; } return result; } - // "." S field:Selector S ![(] - function item490(text: string): runtime.Success<[string]> | runtime.Failure { + // "." S field:FieldSelector S ![(] + function item506(text: string): runtime.Success<[string]> | runtime.Failure { const failedExpectations: runtime.FailedExpectation[] = []; let remainder = text; const result0 = remainder.match(/^\./g); @@ -5522,7 +5666,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } remainder = remainder.slice(result1[0].length); - const result2 = item399(remainder); + const result2 = item421(remainder); failedExpectations.push(...result2.failedExpectations); if (result2.success === false) { return { @@ -5572,14 +5716,14 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } // "." S func:Selector S "(" args:ExprList ")" // { return ((prevExpr: Expr) => builder.newMemberCallExpr(offset(), prevExpr, func, args)) } - function item498( + function item514( text: string, ): runtime.Success<(prevExpr: Expr) => Expr> | runtime.Failure { - const result = item499(text); + const result = item515(text); if (result.success === true) { return { success: true, - value: item506( + value: item522( () => input.length - text.length, result.value[0], result.value[1], @@ -5591,7 +5735,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return result; } // "." S func:Selector S "(" args:ExprList ")" - function item499( + function item515( text: string, ): runtime.Success<[string, Expr[]]> | runtime.Failure { const failedExpectations: runtime.FailedExpectation[] = []; @@ -5706,14 +5850,14 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } // "[" index:Expr "]" // { return ((prevExpr: Expr) => builder.newCallExpr(offset(), "_[_]", [prevExpr, index])) } - function item507( + function item523( text: string, ): runtime.Success<(prevExpr: Expr) => Expr> | runtime.Failure { - const result = item508(text); + const result = item524(text); if (result.success === true) { return { success: true, - value: item513(() => input.length - text.length, result.value[0]), + value: item529(() => input.length - text.length, result.value[0]), remainder: result.remainder, failedExpectations: [], }; @@ -5721,12 +5865,12 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return result; } // "[" index:Expr "]" - function item508(text: string): runtime.Success<[Expr]> | runtime.Failure { + function item524(text: string): runtime.Success<[Expr]> | runtime.Failure { const failedExpectations: runtime.FailedExpectation[] = []; let remainder = text; const result0 = remainder.match(/^\[/g); failedExpectations.push({ - expectation: item451, + expectation: item467, remainder: remainder, }); if (result0?.length !== 1) { @@ -5749,7 +5893,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { remainder = result1.remainder; const result2 = remainder.match(/^\]/g); failedExpectations.push({ - expectation: item456, + expectation: item472, remainder: remainder, }); if (result2?.length !== 1) { @@ -5780,12 +5924,12 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { // // return builder.newCallExpr(offset(), `${ops[0]}_`, [expr]); // } - function item517(text: string): runtime.Success | runtime.Failure { - const result = item518(text); + function item533(text: string): runtime.Success | runtime.Failure { + const result = item534(text); if (result.success === true) { return { success: true, - value: item529( + value: item545( () => input.length - text.length, result.value[0], result.value[1], @@ -5797,7 +5941,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return result; } // S ops:$( "!"+ / "-"+ ) expr:Member - function item518( + function item534( text: string, ): runtime.Success<[string, Expr]> | runtime.Failure { const failedExpectations: runtime.FailedExpectation[] = []; @@ -5823,7 +5967,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } remainder = remainder.slice(result0[0].length); - const result1 = item520(remainder); + const result1 = item536(remainder); failedExpectations.push(...result1.failedExpectations); if (result1.success === false) { return { @@ -5851,7 +5995,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } // $( "!"+ / "-"+ ) - function item520(text: string): runtime.Success | runtime.Failure { + function item536(text: string): runtime.Success | runtime.Failure { const matches = text.match(/^((!)+|(-)+)/g); if (matches?.length === 1) { return { @@ -5866,7 +6010,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { remainder: text, failedExpectations: [ { - expectation: item524, + expectation: item540, remainder: text, }, { @@ -5877,10 +6021,10 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } // MultiplicationTail? - function item531( + function item547( text: string, ): runtime.Success<((prevExpr: Expr) => Expr)[] | null> | runtime.Failure { - const result = item533(text); + const result = item549(text); if (result.success === true) { return result; } @@ -5895,7 +6039,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { // S operator:( o:[*/%] { return `_${o}_` } ) nextExpr:Unary // { return ((prevExpr: Expr) => builder.newCallExpr(offset(), operator, [prevExpr, nextExpr])) } // )+ - function item533( + function item549( text: string, ): runtime.Success<((prevExpr: Expr) => Expr)[]> | runtime.Failure { const values: Array<(prevExpr: Expr) => Expr> = []; @@ -5903,7 +6047,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { let remainder = text; while (true) { let r = remainder; - const result = item534(r); + const result = item550(r); failedExpectations.push(...result.failedExpectations); if (result.success === false) { break; @@ -5918,14 +6062,14 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } // S operator:( o:[*/%] { return `_${o}_` } ) nextExpr:Unary // { return ((prevExpr: Expr) => builder.newCallExpr(offset(), operator, [prevExpr, nextExpr])) } - function item534( + function item550( text: string, ): runtime.Success<(prevExpr: Expr) => Expr> | runtime.Failure { - const result = item535(text); + const result = item551(text); if (result.success === true) { return { success: true, - value: item544( + value: item560( () => input.length - text.length, result.value[0], result.value[1], @@ -5937,7 +6081,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return result; } // S operator:( o:[*/%] { return `_${o}_` } ) nextExpr:Unary - function item535( + function item551( text: string, ): runtime.Success<[string, Expr]> | runtime.Failure { const failedExpectations: runtime.FailedExpectation[] = []; @@ -5963,7 +6107,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } remainder = remainder.slice(result0[0].length); - const result1 = item537(remainder); + const result1 = item553(remainder); failedExpectations.push(...result1.failedExpectations); if (result1.success === false) { return { @@ -5991,12 +6135,12 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } // o:[*/%] { return `_${o}_` } - function item537(text: string): runtime.Success | runtime.Failure { - const result = item539(text); + function item553(text: string): runtime.Success | runtime.Failure { + const result = item555(text); if (result.success === true) { return { success: true, - value: item541(result.value), + value: item557(result.value), remainder: result.remainder, failedExpectations: [], }; @@ -6004,7 +6148,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return result; } // [*/%] - function item539(text: string): runtime.Success | runtime.Failure { + function item555(text: string): runtime.Success | runtime.Failure { if (/^[*\/%]/g.test(text)) { return { success: true, @@ -6018,17 +6162,17 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { remainder: text, failedExpectations: [ { - expectation: item540, + expectation: item556, remainder: text, }, ], }; } // AdditionTail? - function item548( + function item564( text: string, ): runtime.Success<((prevExpr: Expr) => Expr)[] | null> | runtime.Failure { - const result = item550(text); + const result = item566(text); if (result.success === true) { return result; } @@ -6043,7 +6187,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { // S operator:( o:[+-] { return `_${o}_` } ) nextExpr:Multiplication // { return ((prevExpr: Expr) => builder.newCallExpr(offset(), operator, [prevExpr, nextExpr])) } // )+ - function item550( + function item566( text: string, ): runtime.Success<((prevExpr: Expr) => Expr)[]> | runtime.Failure { const values: Array<(prevExpr: Expr) => Expr> = []; @@ -6051,7 +6195,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { let remainder = text; while (true) { let r = remainder; - const result = item551(r); + const result = item567(r); failedExpectations.push(...result.failedExpectations); if (result.success === false) { break; @@ -6066,14 +6210,14 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } // S operator:( o:[+-] { return `_${o}_` } ) nextExpr:Multiplication // { return ((prevExpr: Expr) => builder.newCallExpr(offset(), operator, [prevExpr, nextExpr])) } - function item551( + function item567( text: string, ): runtime.Success<(prevExpr: Expr) => Expr> | runtime.Failure { - const result = item552(text); + const result = item568(text); if (result.success === true) { return { success: true, - value: item559( + value: item575( () => input.length - text.length, result.value[0], result.value[1], @@ -6085,7 +6229,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return result; } // S operator:( o:[+-] { return `_${o}_` } ) nextExpr:Multiplication - function item552( + function item568( text: string, ): runtime.Success<[string, Expr]> | runtime.Failure { const failedExpectations: runtime.FailedExpectation[] = []; @@ -6111,7 +6255,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } remainder = remainder.slice(result0[0].length); - const result1 = item554(remainder); + const result1 = item570(remainder); failedExpectations.push(...result1.failedExpectations); if (result1.success === false) { return { @@ -6139,12 +6283,12 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } // o:[+-] { return `_${o}_` } - function item554(text: string): runtime.Success | runtime.Failure { - const result = item556(text); + function item570(text: string): runtime.Success | runtime.Failure { + const result = item572(text); if (result.success === true) { return { success: true, - value: item557(result.value), + value: item573(result.value), remainder: result.remainder, failedExpectations: [], }; @@ -6152,7 +6296,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return result; } // [+-] - function item556(text: string): runtime.Success | runtime.Failure { + function item572(text: string): runtime.Success | runtime.Failure { if (/^[+\-]/g.test(text)) { return { success: true, @@ -6173,10 +6317,10 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } // RelationTail? - function item563( + function item579( text: string, ): runtime.Success<((prevExpr: Expr) => Expr)[] | null> | runtime.Failure { - const result = item565(text); + const result = item581(text); if (result.success === true) { return result; } @@ -6191,7 +6335,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { // S operator:Relop nextExpr:Addition // { return ((prevExpr: Expr) => builder.newCallExpr(offset(), operator, [prevExpr, nextExpr])) } // )+ - function item565( + function item581( text: string, ): runtime.Success<((prevExpr: Expr) => Expr)[]> | runtime.Failure { const values: Array<(prevExpr: Expr) => Expr> = []; @@ -6199,7 +6343,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { let remainder = text; while (true) { let r = remainder; - const result = item566(r); + const result = item582(r); failedExpectations.push(...result.failedExpectations); if (result.success === false) { break; @@ -6214,14 +6358,14 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } // S operator:Relop nextExpr:Addition // { return ((prevExpr: Expr) => builder.newCallExpr(offset(), operator, [prevExpr, nextExpr])) } - function item566( + function item582( text: string, ): runtime.Success<(prevExpr: Expr) => Expr> | runtime.Failure { - const result = item567(text); + const result = item583(text); if (result.success === true) { return { success: true, - value: item595( + value: item611( () => input.length - text.length, result.value[0], result.value[1], @@ -6233,7 +6377,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return result; } // S operator:Relop nextExpr:Addition - function item567( + function item583( text: string, ): runtime.Success<[string, Expr]> | runtime.Failure { const failedExpectations: runtime.FailedExpectation[] = []; @@ -6259,7 +6403,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { }; } remainder = remainder.slice(result0[0].length); - const result1 = item570(remainder); + const result1 = item586(remainder); failedExpectations.push(...result1.failedExpectations); if (result1.success === false) { return { @@ -6293,8 +6437,8 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { // ) // / "in" { return "@in" } // - function item570(text: string): runtime.Success | runtime.Failure { - const result = item571(text); + function item586(text: string): runtime.Success | runtime.Failure { + const result = item587(text); if (result.success === true) { return result; } @@ -6303,7 +6447,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { remainder: result.remainder, failedExpectations: [ { - expectation: item593, + expectation: item609, remainder: result.remainder, }, ], @@ -6314,8 +6458,8 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { // { return `_${operator}_` } // ) // / "in" { return "@in" } - function item571(text: string): runtime.Success | runtime.Failure { - const choices = [item572, item589]; + function item587(text: string): runtime.Success | runtime.Failure { + const choices = [item588, item605]; let failedExpectations: runtime.FailedExpectation[] = []; for ( let func = choices.shift(); @@ -6341,12 +6485,12 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { } // operator:$("<=" / "<" / ">=" / ">" / "==" / "!=") // { return `_${operator}_` } - function item572(text: string): runtime.Success | runtime.Failure { - const result = item574(text); + function item588(text: string): runtime.Success | runtime.Failure { + const result = item590(text); if (result.success === true) { return { success: true, - value: item588(result.value), + value: item604(result.value), remainder: result.remainder, failedExpectations: [], }; @@ -6354,7 +6498,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return result; } // $("<=" / "<" / ">=" / ">" / "==" / "!=") - function item574(text: string): runtime.Success | runtime.Failure { + function item590(text: string): runtime.Success | runtime.Failure { const matches = text.match(/^(<=|<|>=|>|==|!=)/g); if (matches?.length === 1) { return { @@ -6369,39 +6513,39 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { remainder: text, failedExpectations: [ { - expectation: item577, + expectation: item593, remainder: text, }, { - expectation: item579, + expectation: item595, remainder: text, }, { - expectation: item581, + expectation: item597, remainder: text, }, { - expectation: item583, + expectation: item599, remainder: text, }, { - expectation: item585, + expectation: item601, remainder: text, }, { - expectation: item587, + expectation: item603, remainder: text, }, ], }; } // "in" { return "@in" } - function item589(text: string): runtime.Success | runtime.Failure { - const result = item590(text); + function item605(text: string): runtime.Success | runtime.Failure { + const result = item606(text); if (result.success === true) { return { success: true, - value: item592(), + value: item608(), remainder: result.remainder, failedExpectations: [], }; @@ -6409,7 +6553,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return result; } // "in" - function item590(text: string): runtime.Success<"in"> | runtime.Failure { + function item606(text: string): runtime.Success<"in"> | runtime.Failure { if (text.startsWith("in")) { return { success: true, @@ -6423,14 +6567,14 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { remainder: text, failedExpectations: [ { - expectation: item591, + expectation: item607, remainder: text, }, ], }; } // $(S "&&") - function item598(text: string): runtime.Success | runtime.Failure { + function item614(text: string): runtime.Success | runtime.Failure { const matches = text.match( /^(([\t\n\f\r ])+)?(\/\/([^\r\n])*([\r\n])+)?(([\t\n\f\r ])+)?&&/g, ); @@ -6455,14 +6599,14 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { remainder: text, }, { - expectation: item601, + expectation: item617, remainder: text, }, ], }; } // $(S "||") - function item604(text: string): runtime.Success | runtime.Failure { + function item620(text: string): runtime.Success | runtime.Failure { const matches = text.match( /^(([\t\n\f\r ])+)?(\/\/([^\r\n])*([\r\n])+)?(([\t\n\f\r ])+)?\|\|/g, ); @@ -6487,17 +6631,17 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { remainder: text, }, { - expectation: item607, + expectation: item623, remainder: text, }, ], }; } // TernaryTail? - function item611( + function item627( text: string, ): runtime.Success<[Expr, Expr] | null> | runtime.Failure { - const result = item613(text); + const result = item629(text); if (result.success === true) { return result; } @@ -6513,14 +6657,14 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { // /* : [Expr, Expr] */ // return [t, f]; // } - function item613( + function item629( text: string, ): runtime.Success<[Expr, Expr]> | runtime.Failure { - const result = item614(text); + const result = item630(text); if (result.success === true) { return { success: true, - value: item621(result.value[0], result.value[1]), + value: item637(result.value[0], result.value[1]), remainder: result.remainder, failedExpectations: [], }; @@ -6528,14 +6672,14 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { return result; } // "?" t:ConditionalOr S ":" f:Expr S - function item614( + function item630( text: string, ): runtime.Success<[Expr, Expr]> | runtime.Failure { const failedExpectations: runtime.FailedExpectation[] = []; let remainder = text; const result0 = remainder.match(/^\?/g); failedExpectations.push({ - expectation: item616, + expectation: item632, remainder: remainder, }); if (result0?.length !== 1) { @@ -6579,7 +6723,7 @@ export function parse(input: string, options: runtime.ParseOptions = {}): Expr { remainder = remainder.slice(result2[0].length); const result3 = remainder.match(/^:/g); failedExpectations.push({ - expectation: item423, + expectation: item440, remainder: remainder, }); if (result3?.length !== 1) {