From dc642bb6ce7dcdf57667466788ad71bd917dff65 Mon Sep 17 00:00:00 2001 From: Armin Zavada Date: Sat, 5 Oct 2024 21:48:54 +0200 Subject: [PATCH] #13 Added XSTS syntax highlight --- .../oxsts-vs-code/language-configuration.json | 4 +- subprojects/oxsts-vs-code/package.json | 17 +++-- .../syntaxes/xsts.tmLanguage.json | 76 +++++++++++++++++++ .../syntaxes/xsts.tmLanguage.json.license | 3 + 4 files changed, 92 insertions(+), 8 deletions(-) create mode 100644 subprojects/oxsts-vs-code/syntaxes/xsts.tmLanguage.json create mode 100644 subprojects/oxsts-vs-code/syntaxes/xsts.tmLanguage.json.license diff --git a/subprojects/oxsts-vs-code/language-configuration.json b/subprojects/oxsts-vs-code/language-configuration.json index d9aa3ca..677bfbd 100644 --- a/subprojects/oxsts-vs-code/language-configuration.json +++ b/subprojects/oxsts-vs-code/language-configuration.json @@ -17,7 +17,7 @@ "surroundingPairs": [ ["{", "}"], ["[", "]"], - ["(", ")"], + ["(", ")"] ], "folding": { "markers": { @@ -30,4 +30,4 @@ "increaseIndentPattern": "^((?!\\/\\/).)*(\\{[^}\"'`]*|\\([^)\"'`]*|\\[[^\\]\"'`]*)$", "decreaseIndentPattern": "^((?!.*?\\/\\*).*\\*/)?\\s*[\\)\\}\\]].*$" } - } \ No newline at end of file + } diff --git a/subprojects/oxsts-vs-code/package.json b/subprojects/oxsts-vs-code/package.json index 2b148ec..d6b2610 100644 --- a/subprojects/oxsts-vs-code/package.json +++ b/subprojects/oxsts-vs-code/package.json @@ -12,18 +12,18 @@ "activationEvents": [], "main": "./dist/extension.js", "contributes": { - "commands": [ - { - "command": "semantifyr.helloWorld", - "title": "Hello World" - } - ], "languages": [ { "id": "oxsts", "extensions": [".oxsts"], "aliases": ["OXSTS"], "configuration": "./language-configuration.json" + }, + { + "id": "xsts", + "extensions": [".xsts"], + "aliases": ["XSTS"], + "configuration": "./language-configuration.json" } ], "grammars": [ @@ -31,6 +31,11 @@ "language": "oxsts", "scopeName": "source.oxsts", "path": "./syntaxes/oxsts.tmLanguage.json" + }, + { + "language": "xsts", + "scopeName": "source.xsts", + "path": "./syntaxes/xsts.tmLanguage.json" } ] }, diff --git a/subprojects/oxsts-vs-code/syntaxes/xsts.tmLanguage.json b/subprojects/oxsts-vs-code/syntaxes/xsts.tmLanguage.json new file mode 100644 index 0000000..4fbb67f --- /dev/null +++ b/subprojects/oxsts-vs-code/syntaxes/xsts.tmLanguage.json @@ -0,0 +1,76 @@ +{ + "scopeName": "source.xsts", + "name": "xsts", + "patterns": [ + { + "include": "#keywords" + }, + { + "include": "#operators" + }, + { + "include": "#types" + }, + { + "include": "#literals" + }, + { + "include": "#comments" + } + ], + "repository": { + "keywords": { + "patterns": [ + { + "name": "keyword.control.xsts", + "match": "\\b(or|enum|ctrl|assume|var|type|init|havoc|trans|choice|if|else|prop|env)\\b" + } + ] + }, + "operators": { + "patterns": [ + { + "name": "keyword.operator.xsts", + "match": "(==|!=|<=|>=|<|>|\\+|-|&&|\\|\\|)" + }, + { + "name": "keyword.operator.assignment.xsts", + "match": ":=" + } + ] + }, + "types": { + "patterns": [ + { + "name": "storage.type.xsts", + "match": "\\b(Integer|Boolean|Self|Nothing)\\b" + } + ] + }, + "literals": { + "patterns": [ + { + "name": "constant.numeric.xsts", + "match": "\\b\\d+\\b" + }, + { + "name": "constant.language.boolean.xsts", + "match": "\\b(true|false)\\b" + } + ] + }, + "comments": { + "patterns": [ + { + "name": "comment.block.xsts", + "begin": "/\\*", + "end": "\\*/" + }, + { + "name": "comment.line.double-slash.xsts", + "match": "//.*$" + } + ] + } + } +} diff --git a/subprojects/oxsts-vs-code/syntaxes/xsts.tmLanguage.json.license b/subprojects/oxsts-vs-code/syntaxes/xsts.tmLanguage.json.license new file mode 100644 index 0000000..d2ab7bf --- /dev/null +++ b/subprojects/oxsts-vs-code/syntaxes/xsts.tmLanguage.json.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023-2024 The Semantifyr Authors + +SPDX-License-Identifier: EPL-2.0