Last active
December 14, 2016 00:55
-
-
Save achun/c65c2218c44807e2354ac128aa96b8ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%YAML 1.2 | |
--- | |
# http://www.sublimetext.com/docs/3/syntax.html | |
name: zxx | |
file_extensions: | |
- zxx | |
first_line_match: "-[*]-( Mode:)? Zxx -[*]-" | |
scope: source.zxx | |
contexts: | |
main: | |
- match: ^(use|let|def|fun)\s | |
scope: keyword.declaration.zxx | |
- match: ^[^\t] | |
push: | |
- meta_scope: comment.line.number-sign.zxx | |
- match: \z | |
pop: true | |
- match: '#' | |
push: | |
- meta_scope: comment.line.number-sign.zxx | |
- match: \z | |
pop: true | |
- match: '\t ' | |
push: | |
- meta_scope: comment.line.documentation.zxx | |
- match: \z | |
pop: true | |
- match: '"' | |
captures: | |
0: punctuation.definition.string.begin.zxx | |
push: | |
- meta_scope: string.quoted.double.zxx | |
- match: '"' | |
captures: | |
0: punctuation.definition.string.end.zxx | |
pop: true | |
- include: string_placeholder | |
- include: string_escaped_char | |
- match: "'" | |
captures: | |
0: punctuation.definition.string.begin.zxx | |
push: | |
- meta_scope: string.quoted.single.zxx | |
- match: "'" | |
captures: | |
0: punctuation.definition.string.end.zxx | |
pop: true | |
- include: string_placeholder | |
- include: string_escaped_char | |
- match: "`" | |
captures: | |
0: punctuation.definition.string.begin.zxx | |
push: | |
- meta_scope: string.quoted.raw.zxx | |
- match: "`" | |
captures: | |
0: punctuation.definition.string.end.zxx | |
pop: true | |
- include: template_placeholder | |
- include: string_escaped_char | |
#datetime | |
- match: '\b(\d{4}(-?(0[1-9]|1[0-2])(-?(0[1-9]|[12][0-9]|3[01]))?)?T(\d\d(:?\d\d){0,2}(\.\d{1,9})?)?(Z|[-+]\d\d(:?\d\d)?)?)\b' | |
scope: constant.datetime.zxx | |
- match: '\b(\d+(([eE][-+]?\d+)|\.\d+([eE][-+]?\d+)?))\b' | |
scope: constant.numeric.floating-point.zxx | |
- match: '\b(0f([0-9a-fA-F]{16}|[0-9a-fA-F]{8}))\b' | |
scope: constant.numeric.floating-point.zxx | |
- match: '\b(0x[0-9a-fA-F]+|0b[01]+|[0-9]+)\b' | |
scope: constant.numeric.integer.zxx | |
- match: (==|<>|<|<=|>|>=) | |
scope: keyword.operator.comparison.zxx | |
- match: (\+\+) | |
scope: keyword.operator.increment.zxx | |
- match: (--) | |
scope: keyword.decrement.zxx | |
- match: "((?://|<<|>>|[-+*/%&^|])?=)" | |
scope: keyword.operator.assignment.zxx | |
- match: "(//|<<|>>|[-+*/%&^|~])" | |
scope: keyword.operator.arithmetic.zxx | |
- match: ([.]{2,3}) | |
scope: keyword.operator.range.zxx | |
- match: (;) | |
scope: punctuation.operator.terminator.zxx | |
- match: (,) | |
scope: punctuation.separator.comma.zxx | |
- match: (\:) | |
scope: punctuation.definition.keyword.zxx | |
- match: (\[|{|\() | |
scope: punctuation.section.brackets.begin.zxx | |
- match: (\]|}|\)) | |
scope: punctuation.section.brackets.end.zxx | |
- match: ([-.])(?=[A-Za-z]) | |
scope: keyword.operator.zxx | |
- match: \b([A-Za-z]+(-[A-Za-z0-9]+)+)\b | |
scope: variable.zxx | |
- match: \b(fun)(?=\() | |
captures: | |
1: keyword.declaration.zxx | |
- match: \b(fun)[ \t]+([-.])? | |
captures: | |
1: keyword.declaration.zxx | |
2: keyword.operator.zxx | |
push: | |
- match: (?=\() | |
pop: true | |
- match: ((?:[A-Za-z]+(?:-[A-Za-z0-9]+)+)\.)?([A-Za-z](?:-?[A-Za-z0-9])*) | |
captures: | |
1: storage.type.zxx | |
2: meta.function entity.name.function.zxx | |
- include: builtin | |
- match: ([A-Za-z](?:-?[A-Za-z0-9])*\.)?([A-Za-z](?:-?[A-Za-z0-9])*) | |
captures: | |
1: storage.type.zxx | |
2: meta.function entity.name.function.zxx | |
- match: \b(def)[ \t]+([-.])?([A-Za-z](?:-?[A-Za-z0-9])*)\( | |
captures: | |
1: keyword.declaration.zxx | |
2: keyword.operator.zxx | |
3: entity.name.type.function.zxx | |
- match: \b(def)[ \t]+([-.])?(?=[A-Za-z](?:-?[A-Za-z0-9])*) | |
captures: | |
1: keyword.declaration.zxx | |
2: keyword.operator.zxx | |
- include: builtin | |
- include: keywords | |
- match: \b([A-Za-z](-?[A-Za-z0-9]+)*)\b | |
scope: variable.zxx | |
builtin: | |
- match: (?:([-.])|(\b))(any|b(ool|yte)|datetime|string|rune|float(32)?|u?int(8|16|32|64)?|void)\b | |
captures: | |
1: keyword.operator.zxx | |
3: support.type.zxx | |
keywords: | |
- match: \b(def|fun)\s | |
scope: keyword.declaration.zxx | |
- match: \b(echo|defer|if|of|for|else|break|continue|throw|catch|out|yield)\b | |
scope: keyword.control.zxx | |
- match: \b(NaN|true|iota|false|null|Infinity)\b | |
scope: keyword.constant.zxx | |
- match: \b(self)\b | |
scope: keyword.variable.zxx | |
- match: \b(error|copy|append)\b | |
scope: support.function.builtin.zxx | |
- match: \b(un|and|or)\b | |
scope: keyword.operator.logical.zxx | |
- match: \b(in|notin)\b | |
scope: keyword.operator.membership.zxx | |
- match: \b(isnt|is)\b | |
scope: keyword.operator.comparison.zxx | |
string_escaped_char: | |
- match: '\\(\\|[abfnrtv''"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|[0-7]{3})' | |
scope: constant.character.escape.zxx | |
- match: \\. | |
scope: invalid.illegal.unknown-escape.zxx | |
string_placeholder: | |
- match: |- | |
(?x)% | |
(\d+\$)? # field (argument #) | |
[#0\- +']* # flags | |
[,;:_]? # separator character (AltiVec) | |
((-?\d+)|\*(-?\d+\$)?)? # minimum field width | |
(\.((-?\d+)|\*(-?\d+\$)?)?)? # precision | |
[diouxXDOUeEfFgGaAcCsSqpnvtTbyYhHmMzZ%] # conversion type | |
scope: constant.other.placeholder.zxx | |
template_placeholder: | |
- match: |- | |
(?x)% | |
(\d+\$)? # field (argument #) | |
[#0\- +']* # flags | |
[,;:_]? # separator character (AltiVec) | |
((-?\d+)|\*(-?\d+\$)?)? # minimum field width | |
(\.((-?\d+)|\*(-?\d+\$)?)?)? # precision | |
[diouxXDOUeEfFgGaAcCsSqpnvtTbyYhHmMzZ%] # conversion type | |
scope: constant.other.placeholder.zxx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment