From 951fd32e0d2cfbe655752c75931e454d294777fc Mon Sep 17 00:00:00 2001 From: Daniel Jeffery Date: Mon, 6 Nov 2023 11:08:54 -0800 Subject: [PATCH] fix: Lifting conditions grammar up to openfga --- syntaxes/cel.injection.json | 28 +--------------------------- syntaxes/openfga.tmLanguage.json | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/syntaxes/cel.injection.json b/syntaxes/cel.injection.json index ab6987d..e78a641 100644 --- a/syntaxes/cel.injection.json +++ b/syntaxes/cel.injection.json @@ -8,22 +8,7 @@ ], "repository": { "condition": { - "begin": "(condition)\\s([_a-zA-Z][_a-zA-Z0-9]+)\\((.*)\\)\\s*{", - "beginCaptures": { - "1": { - "name": "keyword.condition.openfga" - }, - "2": { - "name": "entity.name.function.condition.openfga" - }, - "3": { - "patterns": [ - { - "include": "#cel-prama" - } - ] - } - }, + "begin": "{", "end": "}", "patterns": [ { @@ -35,17 +20,6 @@ ] } ] - }, - "cel-prama": { - "match": "([_a-zA-Z][_a-zA-Z0-9]+)\\:\\s([_a-zA-Z][_a-zA-Z0-9]+),?", - "captures": { - "1": { - "name": "variable.parameter.name.condition.openfga" - }, - "2": { - "name": "variable.parameter.type.condition.openfga" - } - } } } } diff --git a/syntaxes/openfga.tmLanguage.json b/syntaxes/openfga.tmLanguage.json index 2d821d9..4e509d1 100644 --- a/syntaxes/openfga.tmLanguage.json +++ b/syntaxes/openfga.tmLanguage.json @@ -14,9 +14,38 @@ }, { "include": "#symbols" + }, + { + "include": "#condition" } ], "repository": { + "condition": { + "match": "(condition)\\s([_a-zA-Z][_a-zA-Z0-9]+)\\((.*)\\)\\s*", + "captures": { + "1": { + "name": "keyword.condition.openfga" + }, + "2": { + "name": "entity.name.function.condition.openfga" + }, + "3": { + "patterns": [ + { + "match": "([_a-zA-Z][_a-zA-Z0-9]+)\\:\\s([_a-zA-Z][_a-zA-Z0-9]+),?", + "captures": { + "1": { + "name": "variable.parameter.name.condition.openfga" + }, + "2": { + "name": "variable.parameter.type.condition.openfga" + } + } + } + ] + } + } + }, "comments": { "patterns": [ {