diff --git a/editors/vscode/syntaxes/bifrost-rql.tmLanguage.json b/editors/vscode/syntaxes/bifrost-rql.tmLanguage.json index 79670bb..05c2cee 100644 --- a/editors/vscode/syntaxes/bifrost-rql.tmLanguage.json +++ b/editors/vscode/syntaxes/bifrost-rql.tmLanguage.json @@ -58,7 +58,7 @@ }, { "name": "support.function.wrapper.bifrost-rql", - "match": "\\b(?:absent[-_]member|correlate|require[-_]both|configuration[-_]key|dependency[-_]configuration|dependency[-_]evidence|configuration[-_]facts|filter|call-input|call[-_]shape|class[-_]set|call[-_]results|call[-_]argument[-_]groups|call[-_]arguments|call[-_]result[-_]contracts|callable[-_]signature|signature[-_]parameters|callable[-_]applicability|overload[-_]selection|jsx[-_]attribute[-_]value|field[-_]write[-_]value|local[-_]value|call-sites-from|call-sites-to|callees|callers|cfg-edge-source|cfg-edge-target|cfg-entry|cfg-exits|cfg-predecessor-edges|cfg-successor-edges|cfg_edge_source|cfg_edge_target|cfg_entry|cfg_exits|cfg_predecessor_edges|cfg_successor_edges|concurrent[-_]access[-_]conflicts|enclosing-decl|except|explain|file-of|importers-of|imports-of|inside-decl|inside_decl|inside|intersect|language|languages|limit|member-targets|member[-_]selection|members|generation[-_]sites|generates|generated[-_]by|dispatch[-_]outcome|dispatch[-_]targets|member[-_]family|family[-_]edges|declaration[-_]state[-_]of|implementation[-_]of|stubs[-_]of|export[-_]target|exports|export|binding[-_]of|binding[-_]occurrence|bindings[-_]in|bindings|binding|candidate[-_]hierarchy|candidate[-_]target|candidates[-_]of|edge[-_]target|edges[-_]from|edges[-_]of|state[-_]events[-_]of|control[-_]relations|guards[-_]of|flow[-_]relations[-_]of|flow[-_]source|flow[-_]target|result[-_]contract[-_](?:calls|uses|operation[-_]uses|failure[-_]uses)|rewrite[-_]paths[-_]of|not-inside|occurrences[-_]of|occurrences[-_]in|occurrence[-_]target|occurrences|occurrence|owner|points-to|scope[-_]ancestors|scope[-_]of|scopes|scope|paths|path|segments[-_]of|segment[-_]target|procedure-of|procedure_of|profile|receiver-targets|receiver[-_]outcome|receiver[-_]evidence|references-of|result-detail|rust[-_]pointer[-_]findings|subtypes|supertypes|taint|typestate|union|used-by|uses|value-flow|value_flow|where|witness)\\b" + "match": "(? { assertScoped(tokens, "local_value", "support.function.wrapper.bifrost-rql"); }); +void test("keeps wrapper boundaries exact for anchor and local-value forms", async () => { + const loaded = await grammar(); + const positive = tokenizeGrammar( + loaded, + "(anchor (capture finding)) (local-value (identifier)) (local_value (identifier))" + ); + assertScoped(positive, "anchor", "support.function.wrapper.bifrost-rql"); + assertScoped(positive, "local-value", "support.function.wrapper.bifrost-rql"); + assertScoped(positive, "local_value", "support.function.wrapper.bifrost-rql"); + + for (const nearMiss of [ + "(anchor-extra (capture finding))", + "(not-anchor (capture finding))", + "(:anchor (capture finding))", + "(local-value-extra (identifier))", + "(foo-local-value (identifier))", + "(local_value_extra (identifier))" + ]) { + const tokens = tokenizeGrammar(loaded, nearMiss); + assert.ok( + tokens.every((token) => !token.scopes.includes("support.function.wrapper.bifrost-rql")), + `expected ${JSON.stringify(nearMiss)} to have no wrapper scope` + ); + } +}); + void test("highlights declaration-bounded containment", async () => { const tokens = tokenizeGrammar(await grammar(), "(inside-decl (loop) (call))"); assertScoped(tokens, "inside-decl", "support.function.wrapper.bifrost-rql");