-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprometeus.lang
171 lines (148 loc) · 5.96 KB
/
prometeus.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?xml version="1.0" encoding="UTF-8"?>
<!--
Author: Roman M. Yagodin; <roman.yagodin@gmail.com>
Copyright (C) 2011-2014 Roman M. Yagodin; <roman.yagodin@gmail.com>
-->
<language id="prometeus" _name="Prometeus" version="2.0" _section="Markup">
<metadata>
<property name="mimetypes">text/x-prometeus-test</property>
<property name="globs">*.test;</property>
<property name="line-comment-start">//</property>
</metadata>
<styles>
<style id="comment" _name="Comment" map-to="def:comment"/>
<style id="string" _name="String" map-to="def:string"/>
<style id="test" _name="Test" map-to="def:statement"/>
<style id="section" _name="Section" map-to="def:type"/>
<style id="question" _name="Question" map-to="def:string"/>
<style id="right-answer" _name="Right answer" map-to="def:statement"/>
<style id="parameter" _name="Parameter" map-to="def:preprocessor"/>
<style id="number" _name="Number" map-to="def:decimal"/>
<style id="boolean" _name="Boolean" map-to="def:special-constant"/>
<style id="decimal" _name="Decimal number" map-to="def:special-constant"/>
<style id="hexadecimal" _name="Hexadecimal number" map-to="def:special-constant"/>
<style id="real" _name="Real number" map-to="def:special-constant"/>
<style id="debugs" _name="Debug Code" map-to="def:comment"/>
<style id="html-entity" _name="HTML Entity" map-to="def:preprocessor"/>
<style id="html-tag" _name="HTML Tag" map-to="xml:tag"/>
<style id="unquoted" _name="unquoted" map-to="def:error"/>
</styles>
<default-regex-options case-sensitive="false"/>
<definitions>
<context id="prometeus">
<include>
<!-- single line comments // -->
<context id="comment" style-ref="comment" end-at-line-end="true">
<start>(?<![^\s])(//)</start>
<include>
<context ref="def:in-line-comment"/>
</include>
</context>
<!-- text inside elements -->
<context id="text">
<include>
<context ref="decimal" />
<context ref="hexadecimal" />
<context ref="real" />
<context ref="boolean" />
<context ref="html-entity" />
<context ref="unquoted" />
</include>
</context>
<!-- test # -->
<context id="test" style-ref="test" end-at-line-end="true" once-only="true">
<start>(?<![^\s])(\#)</start>
<include>
<context ref="text" />
</include>
</context>
<!-- sections @ -->
<context id="section" style-ref="section" end-at-line-end="true">
<start>(?<![^\s])(\@)</start>
<include>
<context ref="text" />
</include>
</context>
<!-- questions ? -->
<context id="question" style-ref="question" end-at-line-end="true">
<start>(?<![^\s])(\?)</start>
<include>
<context ref="text" />
</include>
</context>
<!-- right answers * -->
<context id="right-answer" style-ref="right-answer" end-at-line-end="true">
<!-- <start>(?<![^\s])(\*)(?![^\s])</start> -->
<start>(?<![^\s])(\*)</start>
<include>
<context ref="text" />
</include>
</context>
<!-- parameters -->
<context id="parameter" style-ref="parameter">
<start>(?<![^\s])(\:\s*)(описание|описание теста|экзамен|время|время тестирования|балл|проходной балл|перемешивать|перемешивать секции|курс|вопросы|вопросов|представлять вопросов|перемешивать|тип|тип вопроса|вес|порог|комментарий|ссылка|рисунок|вариант|тег)(?![^\s])</start>
<end>=</end>
</context>
<!-- booleans like true/false or да / нет -->
<context id="boolean" style-ref="boolean">
<keyword>да</keyword>
<keyword>нет</keyword>
<keyword>true</keyword>
<keyword>false</keyword>
</context>
<!-- decimal numbers -->
<context id="decimal" style-ref="decimal">
<match extended="true">
(?<![\w\.])
[0-9]+[uUlL]*
(?![\w\.])
</match>
</context>
<!-- hexadecimal numbers -->
<context id="hexadecimal" style-ref="hexadecimal">
<match extended="true">
(?<![\w\.])
0[xX][a-fA-F0-9]+[uUlL]*
(?![\w\.])
</match>
</context>
<!-- real numbers -->
<context id="real" style-ref="real">
<match extended="true">
(?<![\w\.])
((\.[0-9]+|[0-9]+\.[0-9]*)([Ee][+-]?[0-9]*)?[FfDdMm]?|
([0-9]+[Ee][+-]?[0-9]*)[FfDdMm]? |
([0-9]+)[FfDdMm])
(?![\w\.])
</match>
</context>
<!-- html / xml entities like " &   etc. -->
<define-regex id="entity-name">[a-zA-Z#_][a-zA-Z0-9_]*</define-regex>
<context id="html-entity" style-ref="html-entity">
<match>&\%{entity-name};</match>
</context>
<!-- html / xml tags -->
<define-regex id="name">[a-zA-Z_][a-zA-Z0-9.:_-]*</define-regex>
<context id="attribute-name" style-ref="attribute-name">
<match>\b\%{name}\s*=</match>
</context>
<context id="html-start-tag" style-ref="html-tag">
<start><(?!/)</start>
<end>/?></end>
<include>
<context ref="attribute-name" />
</include>
</context>
<context id="html-end-tag" style-ref="html-tag">
<start></</start>
<end>></end>
</context>
<!-- some characters like ", &, >, < must be placed very carefully, so we consider them as "errors" -->
<!-- this must me last context, in case other including those characters in right contructs -->
<context id="unquoted" style-ref="unquoted">
<match extended="true">'|"|&|</?\%{name}|<|/>|></match>
</context>
</include>
</context>
</definitions>
</language>