-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathberyl.lang
115 lines (99 loc) · 3.37 KB
/
beryl.lang
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
<language id="beryl" name="Beryl" version="2.0" _section="Script">
<metadata>
<property name="globs">*.beryl</property>
</metadata>
<styles>
<style id="keyword" name="Keyword" map-to="def:keyword"/>
<style id="comment" name="Comment" map-to="def:comment"/>
<style id="function" name="Function" map-to="def:function"/>
<style id="constant" name="Constant" map-to="def:constant"/>
<style id="operator" name="Operator" map-to="def:operator"/>
<style id="string" name="String" map-to="def:string"/>
<style id="number" name="Number" map-to="def:number"/>
<style id="identifier" name="Identifier" map-to="def:identifier"/>
<style id="var-modifier" name="Variable Modifier" map-to="def:type"/>
</styles>
<keyword-char-class>[^()\,\s#]</keyword-char-class>
<definitions>
<define-regex id="symbol-char">[^()\,\s#]</define-regex>
<define-regex id="operator-char">[+\-*\/\\:.%?!\^=<>]</define-regex>
<define-regex id="symbol-start">(?<=[()\,\s#])</define-regex>
<define-regex id="symbol-end">(?=[()\,\s#])</define-regex>
<context id="operator" style-ref="operator">
<!-- See gtksourceview-4/commonlisp.lang for examples on how to handle word boundaries of words consisting of non alphanumeric characters !-->
<match>(\%{symbol-start}|^)\%{symbol-char}*\%{operator-char}\%{symbol-end}</match>
</context>
<context id="keywords" style-ref="keyword">
<keyword>do</keyword>
<keyword>end</keyword>
<keyword>function</keyword>
<keyword>with</keyword>
<keyword>\.\.\.</keyword>
</context>
<context id="functions" style-ref="function">
<keyword>if</keyword>
<keyword>for</keyword>
<keyword>loop</keyword>
<keyword>forevery</keyword>
<keyword>not</keyword>
<keyword>assert</keyword>
<keyword>error</keyword>
<keyword>try</keyword>
<keyword>sizeof</keyword>
<keyword>invoke</keyword>
<keyword>return</keyword>
</context>
<context id="comment" style-ref="comment" end-at-line-end="true">
<start>#</start>
<end>#</end>
</context>
<context id="clue-word" style-ref="identifier">
<match>,\s*(\%{symbol-char})+</match>
</context>
<context id="string-symbol" style-ref="string">
<match>:(\%{symbol-char})+</match>
</context>
<context id="string" style-ref="string">
<start>"</start>
<end>"</end>
</context>
<context id="constants" style-ref="constant">
<keyword>null</keyword>
<keyword>true</keyword>
<keyword>false</keyword>
</context>
<context id="number" style-ref="number">
<match>(\%{symbol-start}|^)-?[0-9][0-9']*\.?[0-9']*</match>
</context>
<!-- See gtksourceview-4/python.lang !-->
<context id="variable-declaration">
<match extended="true">
(let)
\s+
(global\s+)?
(\%{symbol-char}+)
\s+
=
</match>
<include>
<context sub-pattern="1" style-ref="keyword"/>
<context sub-pattern="2" style-ref="var-modifier"/>
<context sub-pattern="3" style-ref="identifier"/>
</include>
</context>
<context id="beryl" class="no-spell-check">
<include>
<context ref="keywords"/>
<context ref="functions"/>
<context ref="constants"/>
<context ref="operator"/>
<context ref="comment"/>
<context ref="clue-word"/>
<context ref="string"/>
<context ref="string-symbol"/>
<context ref="number"/>
<context ref="variable-declaration"/>
</include>
</context>
</definitions>
</language>