From 34732a8587148909e7138b30cfd17356480d0d7e Mon Sep 17 00:00:00 2001 From: Patrick Desaulniers Date: Fri, 23 Aug 2024 21:23:26 -0400 Subject: [PATCH] Syntax highlighting for interfaces --- syntaxes/teal.tmLanguage.json | 47 ++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/syntaxes/teal.tmLanguage.json b/syntaxes/teal.tmLanguage.json index 1df1ef4..caa2f95 100644 --- a/syntaxes/teal.tmLanguage.json +++ b/syntaxes/teal.tmLanguage.json @@ -204,7 +204,7 @@ "include": "#table-constructor" }, { - "include": "#record-block" + "include": "#record-or-interface-block" }, { "include": "#enum-block" @@ -621,19 +621,54 @@ } ] }, - "record-block": { - "begin": "\\brecord\\b", + "record-or-interface-block": { + "begin": "\\b(record|interface)\\b", "end": "\\bend\\b", "captures": { "0": { "name": "storage.type.record.teal" } }, - "name": "statement.record-block.teal", + "name": "statement.record-or-interface-block.teal", "patterns": [ { "include": "#comment" }, + { + "begin": "\\b(is)\\b", + "end": "(?=\\bend\\b|\\bwhere\\b|\\brecord\\b|\\benum\\b|\\buserdata\\b|\\bmetamethod\\b|\\[|^\\s*[a-zA-Z_][a-zA-Z0-9_]*\\s*:)", + "captures": { + "0": { + "name": "keyword.other.teal" + } + }, + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#type" + } + ] + }, + { + "begin": "\\b(where)\\b", + "end": "(?=\\bend\\b|\\brecord\\b|\\benum\\b|\\buserdata\\b|\\bmetamethod\\b|\\[|^\\s*[a-zA-Z_][a-zA-Z0-9_]*\\s*:)", + "name": "where-clause.teal", + "captures": { + "0": { + "name": "keyword.control.teal" + } + }, + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#expression" + } + ] + }, { "comment": "Support ['key'] notation in record declarations; see https://github.com/teal-language/tl/issues/746#issuecomment-2108757909", "include": "#brackets" @@ -642,7 +677,7 @@ "include": "#enum-block" }, { - "include": "#record-block" + "include": "#record-or-interface-block" }, { "include": "#new-type-declaration" @@ -713,7 +748,7 @@ "include": "#function-call" }, { - "include": "#record-block" + "include": "#record-or-interface-block" }, { "include": "#enum-block"