-
Notifications
You must be signed in to change notification settings - Fork 0
/
KuaiJi.sublime-syntax
101 lines (92 loc) · 3.58 KB
/
KuaiJi.sublime-syntax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
%YAML 1.2
---
file_extensions:
- kj
scope: string source.kuaiji
variables:
platname: 'XML|HTML|YAML|Xml|Html|Yaml|xml|html|yaml|C|c|Python|python|JSON|Json|json|JAVA|Java|java|JavaScript|javascript|js|JS|Js|GIT|git|Git|index|Index|Head|HEAD'
wordprefix: '(?<![A-z0-9_])'
wordsufix: '(?![A-z0-9_])'
identifier: '{{wordprefix}}[A-z_][A-z0-9_]*{{wordsufix}}'
argsufix: '[''"A-z0-9\[\]<> ,{}*=_-]*\)'
term: 'bits?|byte|words?|flag|pair|[iI]d|ID'
commonvar: 'int|char|str|bool|double|float|long|short|signed|unsigned|void|var'
mudule: 'numbers|string|re|os(\.path)?|sys|math|cmath'
class: 'Edit|Region|Selection|View|Window|Sublime(?! [Tt]ext)|Sublime_plugin|Settings|(?<=numbers\.)Real|(?<=numbers\.)Integral'
instance: 'edit|point|region|selection|view|window|sublime(?! [tT]ext)|sublime_plugin|settings|vector'
property: '(?<=sys\.)byteorder'
constname: 'self|false|true|FALSE|TRUE|False|True|None|none|NONE|NULL|null|Null|'
platvar: 'buffer|complex|list|dict|tuple|memoryview|bytes|bytearray'
platfunction: 'classmethod|staticmethod'
keyctrl: 'import|if|for|while|else|elif|continue|break|return'
keyopr: 'not|and|or|is|in'
contexts:
main:
- match: '^!: '
scope: invalid.illegal
- match: '^\.+[^.].*:$'
scope: invalid.illegal
- match: '^-.*:$'
scope: markup.bold comment
push: list
- match: '^ .*:$'
scope: markup.italic comment
- match: '`[^`]*`'
scope: comment markup.italic
- match: '([0-9][0-9.]*[0-9])|[0-9]'
scope: constant.numeric
- match: 'r?[bu]?(?=[''"])'
scope: storage.type.string
- match: '{{wordprefix}}({{term}}){{wordsufix}}'
scope: constant.numeric variable.function source.yaml string.unquoted.plain.out.yaml markup.italic
- match: '{{wordprefix}}({{mudule}}){{wordsufix}}'
scope: constant.numeric variable.function source.yaml string.unquoted.plain.out.yaml
- match: '[-+=/*%]|{{wordprefix}}({{keyopr}}){{wordsufix}}'
scope: keyword.operator
- match: '{{wordprefix}}({{platname}}){{wordsufix}}'
scope: constant.numeric variable.function source.yaml string.unquoted.plain.out.yaml
- match: '{{wordprefix}}({{keyctrl}}){{wordsufix}}'
scope: keyword.control
- match: '{{wordprefix}}({{platvar}}){{wordsufix}}'
scope: support.type
- match: '{{wordprefix}}({{platfunction}}){{wordsufix}}'
scope: support.function
- match: '{{wordprefix}}({{property}}){{wordsufix}}'
scope: entity.name.class markup.italic
- match: '{{wordprefix}}({{instance}}){{wordsufix}}'
scope: entity.name.class markup.italic
- match: '{{wordprefix}}({{class}}){{wordsufix}}'
scope: entity.name.class
- match: '{{wordprefix}}({{commonvar}}){{wordsufix}}'
scope: storage.type
- match: '{{wordprefix}}({{constname}}){{wordsufix}}'
scope: constant.language
- match: '({{identifier}})\s*(\()(?={{argsufix}})'
captures:
1: entity.name.function
2: variable.function
push: args
args:
- match: '{{identifier}}'
scope: variable.parameter
- match: '([''])(.*)([''])'
captures:
1: punctuation.definition.string.begin
2: string.quoted.single
3: punctuation.definition.string.end
- match: '(")(.*)(")'
captures:
1: punctuation.definition.string.begin
2: string.quoted.double
3: punctuation.definition.string.end
- match: '='
scope: keyword.operator
- match: '\)'
scope: variable.function
pop: true
list:
- include: main
- match: '^ .*?:'
scope: markup.italic comment
- match: '^$'
pop: true