Add syntax files for sublime text

This commit is contained in:
Laria 2023-03-23 23:40:11 +01:00
parent 1cff056e53
commit fe7bda0f40
3 changed files with 60 additions and 0 deletions

View file

@ -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

View file

@ -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

View file

@ -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}
]
}
]