apfl/contrib/SublimeTextPackage/Apfl.sublime-syntax
Laria Carolin Chabowski aa6346eafa tokenizer: Add backtick delimited strings
This is useful when writing strings that contain a lot of backslashes,
e.g. in regular expressions.
2023-11-07 21:45:27 +01:00

45 lines
1.6 KiB
YAML

%YAML 1.2
---
name: Apfl
file_extensions: ["apfl"]
scope: source.apfl
contexts:
main:
- match: '`'
push: backtick_string
- 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
backtick_string:
- meta_scope: string.quoted.backtick.apfl
- match: "``"
scope: constant.character.escape.apfl
- match: '`(?!`)'
pop: true