From e20832bde6d7b85a9eb600f8f3c58276eb07c20c Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Mon, 28 Oct 2024 15:13:56 +0100 Subject: [PATCH] add comments, snapshot tests --- package.json | 3 +- .../rover/src/test.apollo.jsonselection | 10 - .../sampleWorkspace.code-workspace | 3 + .../fixtures/test.apollo.jsonselection | 137 +++ .../fixtures/test.apollo.jsonselection.snap | 918 ++++++++++++++++++ syntaxes/connectors.jsonselection.json | 15 + syntaxes/connectors.jsonselection.yaml | 8 + 7 files changed, 1083 insertions(+), 11 deletions(-) delete mode 100644 sampleWorkspace/rover/src/test.apollo.jsonselection create mode 100644 src/__tests__/fixtures/test.apollo.jsonselection create mode 100644 src/__tests__/fixtures/test.apollo.jsonselection.snap diff --git a/package.json b/package.json index e94e600f..74a18864 100644 --- a/package.json +++ b/package.json @@ -186,7 +186,8 @@ "scopeName": "inline.connectors.graphql", "path": "./syntaxes/graphql.connectors.json", "embeddedLanguages": { - "meta.embedded.block.jsonselection.graphql": "apollo.jsonselection" + "meta.embedded.block.jsonselection.graphql": "apollo.jsonselection", + "meta.embedded.block.string.jsonselection.graphql": "apollo.jsonselection" } }, { diff --git a/sampleWorkspace/rover/src/test.apollo.jsonselection b/sampleWorkspace/rover/src/test.apollo.jsonselection deleted file mode 100644 index 7dac897f..00000000 --- a/sampleWorkspace/rover/src/test.apollo.jsonselection +++ /dev/null @@ -1,10 +0,0 @@ -foo: bar - $.results { - id - name - } - listing: { - title: $args.input.title - costPerNight: $args.input.costPerNight - numOfBeds: $args.input.numOfBeds - } diff --git a/sampleWorkspace/sampleWorkspace.code-workspace b/sampleWorkspace/sampleWorkspace.code-workspace index ef042bc2..0fd4b2b4 100644 --- a/sampleWorkspace/sampleWorkspace.code-workspace +++ b/sampleWorkspace/sampleWorkspace.code-workspace @@ -23,6 +23,9 @@ }, { "path": "../src/language-server/__tests__/fixtures/documents" + }, + { + "path": "../src/__tests__/fixtures" } ], "settings": {} diff --git a/src/__tests__/fixtures/test.apollo.jsonselection b/src/__tests__/fixtures/test.apollo.jsonselection new file mode 100644 index 00000000..1234c5a1 --- /dev/null +++ b/src/__tests__/fixtures/test.apollo.jsonselection @@ -0,0 +1,137 @@ +# Examples from https://github.com/apollographql/router/blob/next/apollo-federation/src/sources/connect/json_selection/README.md + +id +name +abc: some.nested.path { a b c } +id +name +some.nested.path { a b c } +names: { + first: firstName + last: lastName +} +# Also allowed: +firstName +lastName +postID +title +author: { + id: authorID + name: authorName +} + title + year: publication.year + authorName: author.name +id +created +model + +# The { role content } SubSelection is mandatory so the output keys +# can be statically determined: +choices->first.message { role content } + +# Multiple PathWithSubSelections are allowed in the same SubSelection: +choices->last.message { lastContent: content } + # For some reason /users/{$args.id} returns an object with name + # and email but no id, so we inject the id manually: + id: $args.id + name + email +id name friends: friend_ids { id: $ } +items: data.nested.items { id name } +firstItem: data.nested.items->first { id name } +firstItemName: data.nested.items->first.name +$.data { id name } +id: data.id +name: data.name +all: $.first->and($.second)->and($.third) +wrapped: field->echo({ fieldValue: @ }) +children: parent->echo([@.child1, @.child2, @.child3]) +doubled: numbers->map({ value: @->mul(2) }) +types: values->map(@->typeof) +__typename: $("Product") +condition: $(true) +alphabetSlice: $("abcdefghijklmnopqrstuvwxyz")->slice($args.start, $args.end) +suffix: results.slice($(-1)->mul($args.suffixLength)) +# The ->echo method returns its first input argument as-is, ignoring +# the input data. Useful for embedding literal values, as in +# $->echo("give me this string"), or wrapping the input value. +__typename: $->echo("Book") +wrapped: field->echo({ fieldValue: @ }) + +# Returns the type of the data as a string, e.g. "object", "array", +# "string", "number", "boolean", or "null". Note that `typeof null` is +# "object" in JavaScript but "null" for our purposes. +typeOfValue: value->typeof + +# When invoked against an array, ->map evaluates its first argument +# against each element of the array, binding the element values to `@`, +# and returns an array of the results. When invoked against a non-array, +# ->map evaluates its first argument against that value and returns the +# result without wrapping it in an array. +doubled: numbers->map(@->mul(2)) +types: values->map(@->typeof) + +# Returns true if the data is deeply equal to the first argument, false +# otherwise. Equality is solely value-based (all JSON), no references. +isObject: value->typeof->eq("object") + +# Takes any number of pairs [candidate, value], and returns value for +# the first candidate that equals the input data. If none of the +# pairs match, a runtime error is reported, but a single-element +# [] array as the final argument guarantees a default value. +__typename: kind->match( + ["dog", "Canine"], + ["cat", "Feline"], + ["Exotic"] +) + +# Like ->match, but expects the first element of each pair to evaluate +# to a boolean, returning the second element of the first pair whose +# first element is true. This makes providing a final catch-all case +# easy, since the last pair can be [true, ]. +__typename: kind->matchIf( + [@->eq("dog"), "Canine"], + [@->eq("cat"), "Feline"], + [true, "Exotic"] +) + +# Arithmetic methods, supporting both integers and floating point values, +# similar to JavaScript. +sum: $.a->add($.b)->add($.c) +difference: $.a->sub($.b)->sub($.c) +product: $.a->mul($.b, $.c) +quotient: $.a->div($.b) +remainder: $.a->mod($.b) + +# Array/string methods +first: list->first +last: list->last +index3: list->get(3) +secondToLast: list->get(-2) +slice: list->slice(0, 5) +substring: string->slice(2, 5) +arraySize: array->size +stringLength: string->size + +# Object methods +aValue: $->echo({ a: 123 })->get("a") +hasKey: object->has("key") +hasAB: object->has("a")->and(object->has("b")) +numberOfProperties: object->size +keys: object->keys +values: object->values +entries: object->entries +keysFromEntries: object->entries.key +valuesFromEntries: object->entries.value + +# Logical methods +negation: $.condition->not +bangBang: $.condition->not->not +disjunction: $.a->or($.b)->or($.c) +conjunction: $.a->and($.b, $.c) +aImpliesB: $.a->not->or($.b) +excludedMiddle: $.toBe->or($.toBe->not)->eq(true) + +# Tests from https://github.com/apollographql/router/blob/next/apollo-federation/src/sources/connect/url_template.rs + diff --git a/src/__tests__/fixtures/test.apollo.jsonselection.snap b/src/__tests__/fixtures/test.apollo.jsonselection.snap new file mode 100644 index 00000000..d0c5bc4f --- /dev/null +++ b/src/__tests__/fixtures/test.apollo.jsonselection.snap @@ -0,0 +1,918 @@ +># Examples from https://github.com/apollographql/router/blob/next/apollo-federation/src/sources/connect/json_selection/README.md +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +> +>id +#^^ source.apollo.jsonselection variable.KeyPath.key.identifier +>name +#^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +>abc: some.nested.path { a b c } +#^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.NamedFieldSelection.key +# ^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.NamedFieldSelection.key +# ^^ source.apollo.jsonselection +>id +#^^ source.apollo.jsonselection variable.KeyPath.key.identifier +>name +#^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +>some.nested.path { a b c } +#^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.NamedFieldSelection.key +# ^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.NamedFieldSelection.key +# ^^ source.apollo.jsonselection +>names: { +#^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^^ source.apollo.jsonselection +> first: firstName +#^^ source.apollo.jsonselection +# ^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +> last: lastName +#^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +>} +#^ source.apollo.jsonselection +># Also allowed: +#^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +>firstName +#^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +>lastName +#^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +>postID +#^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +>title +#^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +>author: { +#^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^^ source.apollo.jsonselection +> id: authorID +#^^ source.apollo.jsonselection +# ^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +> name: authorName +#^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +>} +#^ source.apollo.jsonselection +> title +#^^^^^^ source.apollo.jsonselection +# ^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +> year: publication.year +#^^^^^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +> authorName: author.name +#^^^^^^ source.apollo.jsonselection +# ^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +>id +#^^ source.apollo.jsonselection variable.KeyPath.key.identifier +>created +#^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +>model +#^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +> +># The { role content } SubSelection is mandatory so the output keys +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># can be statically determined: +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +>choices->first.message { role content } +#^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection +# ^^^^^^^ source.apollo.jsonselection variable.NamedFieldSelection.key +# ^^ source.apollo.jsonselection +> +># Multiple PathWithSubSelections are allowed in the same SubSelection: +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +>choices->last.message { lastContent: content } +#^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^^ source.apollo.jsonselection +# ^^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +> # For some reason /users/{$args.id} returns an object with name +#^^^^^^ source.apollo.jsonselection comment.line.jsonselection punctuation.whitespace.comment.leading.jsonselection +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +> # and email but no id, so we inject the id manually: +#^^^^^^ source.apollo.jsonselection comment.line.jsonselection punctuation.whitespace.comment.leading.jsonselection +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +> id: $args.id +#^^^^^^ source.apollo.jsonselection +# ^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^ source.apollo.jsonselection variable.PathStep.key.identifier +> name +#^^^^^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +> email +#^^^^^^ source.apollo.jsonselection +# ^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +>id name friends: friend_ids { id: $ } +#^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.NamedFieldSelection.key +# ^ source.apollo.jsonselection +# ^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^^ source.apollo.jsonselection +# ^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^^ source.apollo.jsonselection +>items: data.nested.items { id name } +#^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^^ source.apollo.jsonselection +# ^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.NamedFieldSelection.key +# ^^ source.apollo.jsonselection +>firstItem: data.nested.items->first { id name } +#^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^^^ source.apollo.jsonselection +# ^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.NamedFieldSelection.key +# ^^ source.apollo.jsonselection +>firstItemName: data.nested.items->first.name +#^^^^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +>$.data { id name } +#^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^^ source.apollo.jsonselection +# ^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.NamedFieldSelection.key +# ^^ source.apollo.jsonselection +>id: data.id +#^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^ source.apollo.jsonselection variable.PathStep.key.identifier +>name: data.name +#^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +>all: $.first->and($.second)->and($.third) +#^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^^^^^^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^^^^^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>wrapped: field->echo({ fieldValue: @ }) +#^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject punctuation.LitObject.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject +# ^^^^^^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty variable.LitProperty.key +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty punctuation.colon.LitProperty +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty variable.AtPath.at +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject punctuation.LitObject.close +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>children: parent->echo([@.child1, @.child2, @.child3]) +#^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.LitArray.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray variable.AtPath.at +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray variable.PathStep.dot +# ^^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.comma.LitArray.separator +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray variable.AtPath.at +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray variable.PathStep.dot +# ^^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.comma.LitArray.separator +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray variable.AtPath.at +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray variable.PathStep.dot +# ^^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.LitArray.close +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>doubled: numbers->map({ value: @->mul(2) }) +#^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject punctuation.LitObject.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject +# ^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty variable.LitProperty.key +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty punctuation.colon.LitProperty +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty variable.AtPath.at +# ^^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty meta.MethodArgs constant.numeric.LitNumber +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty meta.MethodArgs punctuation.brace.round.MethodArgs.close +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject punctuation.LitObject.close +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>types: values->map(@->typeof) +#^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.AtPath.at +# ^^ source.apollo.jsonselection meta.MethodArgs punctuation.PathStep.arrow +# ^^^^^^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>__typename: $("Product") +#^^ source.apollo.jsonselection +# ^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.ExprPathArgs punctuation.brace.round.ExprPathArgs.open +# ^^^^^^^^^ source.apollo.jsonselection meta.ExprPathArgs string.quoted.LitString +# ^ source.apollo.jsonselection meta.ExprPathArgs punctuation.brace.round.ExprPathArgs.close +>condition: $(true) +#^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.ExprPathArgs punctuation.brace.round.ExprPathArgs.open +# ^^^^ source.apollo.jsonselection meta.ExprPathArgs constant.language.LitPrimitive +# ^ source.apollo.jsonselection meta.ExprPathArgs punctuation.brace.round.ExprPathArgs.close +>alphabetSlice: $("abcdefghijklmnopqrstuvwxyz")->slice($args.start, $args.end) +#^^^^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.ExprPathArgs punctuation.brace.round.ExprPathArgs.open +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection meta.ExprPathArgs string.quoted.LitString +# ^ source.apollo.jsonselection meta.ExprPathArgs punctuation.brace.round.ExprPathArgs.close +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^^^^ source.apollo.jsonselection meta.MethodArgs variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^^^^^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.comma.MethodArgs.separator +# ^ source.apollo.jsonselection meta.MethodArgs +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^^^^ source.apollo.jsonselection meta.MethodArgs variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^^^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>suffix: results.slice($(-1)->mul($args.suffixLength)) +#^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs meta.ExprPathArgs punctuation.brace.round.ExprPathArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.ExprPathArgs +# ^ source.apollo.jsonselection meta.MethodArgs meta.ExprPathArgs constant.numeric.LitNumber +# ^ source.apollo.jsonselection meta.MethodArgs meta.ExprPathArgs punctuation.brace.round.ExprPathArgs.close +# ^^ source.apollo.jsonselection meta.MethodArgs punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.MethodArgs variable.ExprPath.dollar +# ^^^^ source.apollo.jsonselection meta.MethodArgs meta.MethodArgs variable.KeyPath.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs meta.MethodArgs variable.PathStep.dot +# ^^^^^^^^^^^^ source.apollo.jsonselection meta.MethodArgs meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs meta.MethodArgs punctuation.brace.round.MethodArgs.close +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +># The ->echo method returns its first input argument as-is, ignoring +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># the input data. Useful for embedding literal values, as in +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># $->echo("give me this string"), or wrapping the input value. +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +>__typename: $->echo("Book") +#^^ source.apollo.jsonselection +# ^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^^^^^^ source.apollo.jsonselection meta.MethodArgs string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>wrapped: field->echo({ fieldValue: @ }) +#^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject punctuation.LitObject.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject +# ^^^^^^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty variable.LitProperty.key +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty punctuation.colon.LitProperty +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty variable.AtPath.at +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject punctuation.LitObject.close +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +> +># Returns the type of the data as a string, e.g. "object", "array", +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># "string", "number", "boolean", or "null". Note that `typeof null` is +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># "object" in JavaScript but "null" for our purposes. +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +>typeOfValue: value->typeof +#^^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^^^ source.apollo.jsonselection variable.PathStep.identifier +> +># When invoked against an array, ->map evaluates its first argument +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># against each element of the array, binding the element values to `@`, +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># and returns an array of the results. When invoked against a non-array, +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># ->map evaluates its first argument against that value and returns the +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># result without wrapping it in an array. +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +>doubled: numbers->map(@->mul(2)) +#^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.AtPath.at +# ^^ source.apollo.jsonselection meta.MethodArgs punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.MethodArgs constant.numeric.LitNumber +# ^ source.apollo.jsonselection meta.MethodArgs meta.MethodArgs punctuation.brace.round.MethodArgs.close +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>types: values->map(@->typeof) +#^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.AtPath.at +# ^^ source.apollo.jsonselection meta.MethodArgs punctuation.PathStep.arrow +# ^^^^^^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +> +># Returns true if the data is deeply equal to the first argument, false +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># otherwise. Equality is solely value-based (all JSON), no references. +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +>isObject: value->typeof->eq("object") +#^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^^^^^^^^ source.apollo.jsonselection meta.MethodArgs string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +> +># Takes any number of pairs [candidate, value], and returns value for +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># the first candidate that equals the input data. If none of the +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># pairs match, a runtime error is reported, but a single-element +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># [] array as the final argument guarantees a default value. +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +>__typename: kind->match( +#^^ source.apollo.jsonselection +# ^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +> ["dog", "Canine"], +#^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.LitArray.open +# ^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.comma.LitArray.separator +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray +# ^^^^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.LitArray.close +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.comma.MethodArgs.separator +> ["cat", "Feline"], +#^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.LitArray.open +# ^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.comma.LitArray.separator +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray +# ^^^^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.LitArray.close +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.comma.MethodArgs.separator +> ["Exotic"] +#^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.LitArray.open +# ^^^^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.LitArray.close +>) +#^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +> +># Like ->match, but expects the first element of each pair to evaluate +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># to a boolean, returning the second element of the first pair whose +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># first element is true. This makes providing a final catch-all case +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># easy, since the last pair can be [true, ]. +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +>__typename: kind->matchIf( +#^^ source.apollo.jsonselection +# ^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +> [@->eq("dog"), "Canine"], +#^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.LitArray.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray variable.AtPath.at +# ^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.PathStep.arrow +# ^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray meta.MethodArgs string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray meta.MethodArgs punctuation.brace.round.MethodArgs.close +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.comma.LitArray.separator +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray +# ^^^^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.LitArray.close +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.comma.MethodArgs.separator +> [@->eq("cat"), "Feline"], +#^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.LitArray.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray variable.AtPath.at +# ^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.PathStep.arrow +# ^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray meta.MethodArgs string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray meta.MethodArgs punctuation.brace.round.MethodArgs.close +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.comma.LitArray.separator +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray +# ^^^^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.LitArray.close +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.comma.MethodArgs.separator +> [true, "Exotic"] +#^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.LitArray.open +# ^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray constant.language.LitPrimitive +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.comma.LitArray.separator +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray +# ^^^^^^^^ source.apollo.jsonselection meta.MethodArgs meta.LitArray string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitArray punctuation.LitArray.close +>) +#^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +> +># Arithmetic methods, supporting both integers and floating point values, +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +># similar to JavaScript. +#^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +>sum: $.a->add($.b)->add($.c) +#^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>difference: $.a->sub($.b)->sub($.c) +#^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>product: $.a->mul($.b, $.c) +#^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.comma.MethodArgs.separator +# ^ source.apollo.jsonselection meta.MethodArgs +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>quotient: $.a->div($.b) +#^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>remainder: $.a->mod($.b) +#^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +> +># Array/string methods +#^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +>first: list->first +#^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^^ source.apollo.jsonselection variable.PathStep.identifier +>last: list->last +#^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^ source.apollo.jsonselection variable.PathStep.identifier +>index3: list->get(3) +#^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs constant.numeric.LitNumber +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>secondToLast: list->get(-2) +#^^^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs +# ^ source.apollo.jsonselection meta.MethodArgs constant.numeric.LitNumber +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>slice: list->slice(0, 5) +#^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs constant.numeric.LitNumber +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.comma.MethodArgs.separator +# ^ source.apollo.jsonselection meta.MethodArgs +# ^ source.apollo.jsonselection meta.MethodArgs constant.numeric.LitNumber +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>substring: string->slice(2, 5) +#^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs constant.numeric.LitNumber +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.comma.MethodArgs.separator +# ^ source.apollo.jsonselection meta.MethodArgs +# ^ source.apollo.jsonselection meta.MethodArgs constant.numeric.LitNumber +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>arraySize: array->size +#^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^ source.apollo.jsonselection variable.PathStep.identifier +>stringLength: string->size +#^^^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^ source.apollo.jsonselection variable.PathStep.identifier +> +># Object methods +#^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +>aValue: $->echo({ a: 123 })->get("a") +#^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject punctuation.LitObject.open +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty variable.LitProperty.key +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty punctuation.colon.LitProperty +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty +# ^^^ source.apollo.jsonselection meta.MethodArgs meta.LitObject meta.LitProperty constant.numeric.LitNumber +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject +# ^ source.apollo.jsonselection meta.MethodArgs meta.LitObject punctuation.LitObject.close +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^^^ source.apollo.jsonselection meta.MethodArgs string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>hasKey: object->has("key") +#^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^^^^^ source.apollo.jsonselection meta.MethodArgs string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>hasAB: object->has("a")->and(object->has("b")) +#^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^^^ source.apollo.jsonselection meta.MethodArgs string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^^^^^^ source.apollo.jsonselection meta.MethodArgs variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection meta.MethodArgs punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^^^ source.apollo.jsonselection meta.MethodArgs meta.MethodArgs string.quoted.LitString +# ^ source.apollo.jsonselection meta.MethodArgs meta.MethodArgs punctuation.brace.round.MethodArgs.close +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>numberOfProperties: object->size +#^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^ source.apollo.jsonselection variable.PathStep.identifier +>keys: object->keys +#^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^ source.apollo.jsonselection variable.PathStep.identifier +>values: object->values +#^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^^^ source.apollo.jsonselection variable.PathStep.identifier +>entries: object->entries +#^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^^^^ source.apollo.jsonselection variable.PathStep.identifier +>keysFromEntries: object->entries.key +#^^^^^^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^ source.apollo.jsonselection variable.PathStep.key.identifier +>valuesFromEntries: object->entries.value +#^^^^^^^^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^^^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +> +># Logical methods +#^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +>negation: $.condition->not +#^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^^^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +>bangBang: $.condition->not->not +#^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^^^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +>disjunction: $.a->or($.b)->or($.c) +#^^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>conjunction: $.a->and($.b, $.c) +#^^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.comma.MethodArgs.separator +# ^ source.apollo.jsonselection meta.MethodArgs +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>aImpliesB: $.a->not->or($.b) +#^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection variable.PathStep.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +>excludedMiddle: $.toBe->or($.toBe->not)->eq(true) +#^^^^^^^^^^^^^^ source.apollo.jsonselection variable.KeyPath.key.identifier +# ^^ source.apollo.jsonselection +# ^ source.apollo.jsonselection variable.ExprPath.dollar +# ^ source.apollo.jsonselection variable.PathStep.dot +# ^^^^ source.apollo.jsonselection variable.PathStep.key.identifier +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^ source.apollo.jsonselection meta.MethodArgs variable.ExprPath.dollar +# ^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.dot +# ^^^^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.key.identifier +# ^^ source.apollo.jsonselection meta.MethodArgs punctuation.PathStep.arrow +# ^^^ source.apollo.jsonselection meta.MethodArgs variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +# ^^ source.apollo.jsonselection punctuation.PathStep.arrow +# ^^ source.apollo.jsonselection variable.PathStep.identifier +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.open +# ^^^^ source.apollo.jsonselection meta.MethodArgs constant.language.LitPrimitive +# ^ source.apollo.jsonselection meta.MethodArgs punctuation.brace.round.MethodArgs.close +> +># Tests from https://github.com/apollographql/router/blob/next/apollo-federation/src/sources/connect/url_template.rs +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.apollo.jsonselection comment.line.jsonselection +> +> \ No newline at end of file diff --git a/syntaxes/connectors.jsonselection.json b/syntaxes/connectors.jsonselection.json index ad02ba34..4bfb6fef 100644 --- a/syntaxes/connectors.jsonselection.json +++ b/syntaxes/connectors.jsonselection.json @@ -18,6 +18,9 @@ }, { "include": "#NamedSelection" + }, + { + "include": "#Comment" } ] }, @@ -38,6 +41,9 @@ "patterns": [ { "include": "#NamedSelection" + }, + { + "include": "#Comment" } ] }, @@ -357,6 +363,15 @@ } ] }, + "Comment": { + "name": "comment.line.jsonselection", + "match": "(\\s*)(#).*", + "captures": { + "1": { + "name": "punctuation.whitespace.comment.leading.jsonselection" + } + } + }, "JSONSelectionString": { "contentName": "string.quoted.JSONSelectionString", "begin": "((\"))", diff --git a/syntaxes/connectors.jsonselection.yaml b/syntaxes/connectors.jsonselection.yaml index 2e4b04c1..996ac386 100644 --- a/syntaxes/connectors.jsonselection.yaml +++ b/syntaxes/connectors.jsonselection.yaml @@ -12,6 +12,7 @@ repository: patterns: - include: "#PathSelection" - include: "#NamedSelection" + - include: "#Comment" # SubSelection ::= "{" NamedSelection* "}" SubSelection: name: "meta.SubSelection" @@ -25,6 +26,7 @@ repository: name: "punctuation.SubSelection.close" patterns: - include: "#NamedSelection" + - include: "#Comment" # NamedSelection ::= NamedPathSelection | PathWithSubSelection | NamedFieldSelection | NamedGroupSelection NamedSelection: name: "meta.NamedSelection" @@ -232,6 +234,12 @@ repository: # SpacesOrComments ::= (Spaces | Comment)+ # Spaces ::= ("⎵" | "\t" | "\r" | "\n")+ # Comment ::= "#" [^\n]* + Comment: + name: "comment.line.jsonselection" + match: "(\\s*)(#).*" + captures: + "1": + name: "punctuation.whitespace.comment.leading.jsonselection" # additional rules used for strings, e.g. in `POST: "/foo/bar/{$id}"` JSONSelectionString: