-
Notifications
You must be signed in to change notification settings - Fork 2
/
Wenyan.sublime-syntax
127 lines (92 loc) · 3.07 KB
/
Wenyan.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
name: Wenyan
file_extensions:
- wy
- wenyan
scope: source.wenyan
variables:
ident: "[^「」。]+"
digits: (?:零|一|二|三|四|五|六|七|八|九|十|百|千|萬|億|兆|京|垓|秭|穣|溝|澗|正|載|極|恆河沙|阿僧祇|那由他|不可思議|無量大數|分|釐|毫|絲|忽|微|纖|沙|塵|埃|渺|漠|模糊|逡巡|須臾|瞬息|彈指|剎那|六德|虛|空|清|淨)+
contexts:
main:
- include: declaration
- include: control
- include: operators
- include: function-call
- include: comments
- include: variable
- include: constants
- match: "。"
scope: punctuation.separator.wenyan
declaration:
- match: 吾有|今有|有
scope: keyword.declaration.wenyan
- match: 數|列|言|術|爻|物
scope: storage.type.wenyan
- match: 名之曰|曰|噫|昔之|今|是矣|不復存矣
scope: keyword.declaration.wenyan
control:
- match: 恆為是
scope: keyword.control.loop.wenyan
- match: 若非|若|者|夫
scope: keyword.control.conditional.wenyan
- match: 乃得|乃歸空無|是謂|之術也|必先得|是術曰|乃行是術曰|欲行是術|也|云云|凡|中之|恆為是|為是|遍|乃止|其物如是
scope: keyword.control.wenyan
- match: 書之
scope: variable.function.wenyan
- match: 長
scope: variable.function.wenyan
operators:
- match: 充
scope: keyword.operator.assignment.wenyan
- match: 以
scope: keyword.operator.accessor.wenyan
- match: 之
scope: punctuation.accessor.wenyan
- match: 等於|不等於|不大於|不小於|弗大於|弗小於|大於|小於
scope: keyword.operator.comparison.wenyan
- match: 加|減|乘|除|中有陽乎|中無陰乎|變|所餘幾何|銜|其餘
scope: keyword.operator.arithmetic.wenyan
comments:
- match: (注曰|疏曰|批曰).*$
captures:
1: comment.line.begin.wenyan
scope: comment.line.wenyan
variable:
- match: "(「){{ident}}(」)"
captures:
1: variable.other.begin.wenyan
2: variable.other.end.wenyan
scope: variable.other.wenyan entity.name.wenyan
- match: 其
scope: variable.language.wenyan
constants:
- match: "{{digits}}"
scope: constant.numeric.wenyan
- match: 陰|陽
scope: constant.language.wenyan
- include: match-string
- match: \d+
scope: constant.numeric.wenyan
match-string:
- match: 「「
scope: punctuation.definition.string.begin.wenyan
push:
- meta_scope: string.quoted.other.wenyan
- match: 」」
scope: punctuation.definition.string.end.wenyan
pop: true
function-call:
- match: "(施)「({{ident}})」"
captures:
1: keyword.control.wenyan
2: entity.name.function.wenyan
- match: 於
scope: punctuation.accessor.wenyan
push: function-parameter
function-parameter:
- match: "{{ident}}|{{digits}}。?"
scope: variable.parameter.wenyan
pop: true