From fe7bda0f4051f6096dd2e99d8550f84884f798f3 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Thu, 23 Mar 2023 23:40:11 +0100 Subject: [PATCH] Add syntax files for sublime text --- .../SublimeTextPackage/Apfl.sublime-syntax | 37 +++++++++++++++++++ .../ApflTest.sublime-syntax | 15 ++++++++ .../SublimeTextPackage/Default.sublime-keymap | 8 ++++ 3 files changed, 60 insertions(+) create mode 100644 contrib/SublimeTextPackage/Apfl.sublime-syntax create mode 100644 contrib/SublimeTextPackage/ApflTest.sublime-syntax create mode 100644 contrib/SublimeTextPackage/Default.sublime-keymap diff --git a/contrib/SublimeTextPackage/Apfl.sublime-syntax b/contrib/SublimeTextPackage/Apfl.sublime-syntax new file mode 100644 index 0000000..c3c4cf5 --- /dev/null +++ b/contrib/SublimeTextPackage/Apfl.sublime-syntax @@ -0,0 +1,37 @@ +%YAML 1.2 +--- +name: Apfl + +file_extensions: ["apfl"] + +scope: source.apfl + +contexts: + main: + - match: '"' + push: string + - match: "#.*$" + scope: comment.line.number-sign.apfl + - match: "-?[0-9][0-9]*(\\.[0-9]+)?" + scope: constant.numeric.value.apfl + - match: "\\b(if|while|k?each|for|loop)\\b" + scope: keyword.control.apfl + - match: "\\b(true|false)\\b" + scope: constant.language.boolean.apfl + - match: "\\b(nil)\\b" + scope: constant.language.null.apfl + - match: "((?:-[^>0-9]|[^\\s()\\[\\]\\{\\}~\\.@;\\\\,?'#:\"a-zA-Z0-9]=[^\\s()\\[\\]\\{\\}~\\.@;\\\\,?'#:\"a-zA-Z0-9]*|[^\\s()\\[\\]\\{\\}~\\.@;\\\\,?'#:\"=])+)\\s*:?=\\s*\\{" + captures: + 1: entity.name.function.apfl + - match: "(-[^>0-9]|[^\\s()\\[\\]\\{\\}~\\.@;\\\\,?'#:\"a-zA-Z0-9]=[^\\s()\\[\\]\\{\\}~\\.@;\\\\,?'#:\"a-zA-Z0-9]*|[^\\s()\\[\\]\\{\\}~\\.@;\\\\,?'#:\"=])+" + scope: meta.generic-name.apfl + - match: "'(-[^\\s()\\[\\]\\{\\}~\\.@;\\\\,?'#:\">0-9]|[^\\s()\\[\\]\\{\\}~\\.@;\\\\,?'#:\"a-zA-Z0-9]=[^\\s()\\[\\]\\{\\}~\\.@;\\\\,?'#:\"a-zA-Z0-9]*|[^\\s()\\[\\]\\{\\}~\\.@;\\\\,?'#:\"=])+" + scope: string.apfl + string: + - meta_scope: string.quoted.double.apfl + - match: "\\\\[xX][0-9a-fA-F]{2}" + scope: constant.character.escape.apfl + - match: \\. + scope: constant.character.escape.apfl + - match: '"' + pop: true diff --git a/contrib/SublimeTextPackage/ApflTest.sublime-syntax b/contrib/SublimeTextPackage/ApflTest.sublime-syntax new file mode 100644 index 0000000..6366697 --- /dev/null +++ b/contrib/SublimeTextPackage/ApflTest.sublime-syntax @@ -0,0 +1,15 @@ +%YAML 1.2 +--- +name: Apfl Test + +file_extensions: ["at"] + +scope: source.apfl-test + +contexts: + main: + - match: "^===== script =====.*$" + push: Packages/Apfl/Apfl.sublime-syntax + with_prototype: + - match: "^=====" + pop: true diff --git a/contrib/SublimeTextPackage/Default.sublime-keymap b/contrib/SublimeTextPackage/Default.sublime-keymap new file mode 100644 index 0000000..488f69d --- /dev/null +++ b/contrib/SublimeTextPackage/Default.sublime-keymap @@ -0,0 +1,8 @@ +[ + { "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'"}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selector", "operator": "equal", "operand": "source.apfl", "match_all": true} + ] + } +]