Debian Codegraph @

etc/coq-elpi.lang

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <language id="coq-elpi" _name="Coq + ELPI" version="2.0" _section="Scientific">
3 <metadata>
4 <property name="globs">*.v</property>
5 <property name="block-comment-start">\(\*</property>
6 <property name="block-comment-stop">\*\)</property>
7 </metadata>
8
9 <styles>
10 <style id="comment" _name="Comment" map-to="def:comment"/>
11 <style id="coqdoc" _name="Coqdoc text" map-to="def:note"/>
12 <style id="vernac-keyword" _name="Vernacular keyword" map-to="def:keyword"/>
13 <style id="gallina-keyword" _name="Gallina keyword" map-to="def:keyword"/>
14 <style id="identifier" _name="Identifier" map-to="def:identifier"/>
15 <style id="constr-keyword" _name="Cic keyword" map-to="def:keyword"/>
16 <style id="constr-sort" _name="Cic sort" map-to="def:builtin"/>
17 <style id="string" _name="String" map-to="def:string"/>
18 <style id="escape" _name="Escaped Character" map-to="def:special-char"/>
19 <style id="error" _name="Error" map-to="def:error"/>
20 <style id="safe" _name="Checked Part"/>
21 <style id="sentence" _name="Sentence terminator"/>
22 <style id="tactic" _name="Tactic"/>
23 <style id="endtactic" _name="Tactic terminator"/>
24 <style id="iterator" _name="Tactic iterator"/>
25 </styles>
26
27 <definitions>
28 <define-regex id="space">\s</define-regex>
29 <define-regex id="first_ident_char">[_\p{L}]</define-regex>
30 <define-regex id="ident_char">[_\p{L}'\pN]</define-regex>
31 <define-regex id="ident">\%{first_ident_char}\%{ident_char}*</define-regex>
32 <define-regex id="qualit">(\%{ident}*\.)*\%{ident}</define-regex>
33 <define-regex id="undotted_sep">[-+*{}]</define-regex>
34 <define-regex id="dot_sep">\.(\s|\z)</define-regex>
35 <define-regex id="single_decl">(Definition)|(Let)|(Example)|(SubClass)|(Fixpoint)|(CoFixpoint)|(Scheme)|(Function)|(Hypothesis)|(Axiom)|(Variable)|(Parameter)|(Conjecture)|(Inductive)|(CoInductive)|(Record)|(Structure)|(Ltac)|(Instance)|(Context)|(Class)|(Module(\%{space}+Type)?)|(Existing\%{space}+Instance)|(Canonical\%{space}+Structure)|(Canonical)|(Coercion)</define-regex>
36 <define-regex id="mult_decl">(Hypotheses)|(Axioms)|(Variables)|(Parameters)|(Implicit\%{space}+Type(s)?)</define-regex>
37 <define-regex id="locality">(((Local)|(Global))\%{space}+)?</define-regex>
38 <define-regex id="begin_proof">(Theorem)|(Lemma)|(Fact)|(Remark)|(Corollary)|(Proposition)|(Property)</define-regex>
39 <define-regex id="end_proof">(Qed)|(Defined)|(Admitted)|(Abort)</define-regex>
40 <define-regex id="decl_head">((?'gal'\%{locality}(Program\%{space}+)?(\%{single_decl}|\%{begin_proof}))\%{space}+(?'id'\%{ident}))|((?'gal4list'\%{mult_decl})(?'id_list'(\%{space}+\%{ident})*))</define-regex>
41 <define-regex id="lp-var">[A-Z_][A-Za-z-+_0-9?]*</define-regex>
42 <define-regex id="lp-name">[a-z][A-Za-z-+_>0-9?\.]*</define-regex>
43 <define-regex id="lp-symb">(:-|\\|,|=>|\]|\[)</define-regex>
44 <define-regex id="lp-comment">%.*\z</define-regex>
45
46 <context id="escape-seq" style-ref="escape">
47 <match>""</match>
48 </context>
49 <context id="string" style-ref="string">
50 <start>"</start>
51 <end>"</end>
52 <include>
53 <context ref="escape-seq"/>
54 </include>
55 </context>
56 <context id="ssr-iter" style-ref="iterator">
57 <keyword>do</keyword>
58 <keyword>last</keyword>
59 <keyword>first</keyword>
60 </context>
61 <context id="ssr-tac" style-ref="tactic">
62 <keyword>apply</keyword>
63 <keyword>auto</keyword>
64 <keyword>case</keyword>
65 <keyword>case</keyword>
66 <keyword>congr</keyword>
67 <keyword>elim</keyword>
68 <keyword>exists</keyword>
69 <keyword>have</keyword>
70 <keyword>gen have</keyword>
71 <keyword>generally have</keyword>
72 <keyword>move</keyword>
73 <keyword>pose</keyword>
74 <keyword>rewrite</keyword>
75 <keyword>set</keyword>
76 <keyword>split</keyword>
77 <keyword>suffices</keyword>
78 <keyword>suff</keyword>
79 <keyword>transitivity</keyword>
80 <keyword>without loss</keyword>
81 <keyword>wlog</keyword>
82 </context>
83 <context id="ssr-endtac" style-ref="endtactic">
84 <keyword>by</keyword>
85 <keyword>exact</keyword>
86 <keyword>reflexivity</keyword>
87 </context>
88 <context id="coq-elpi" class="no-spell-check">
89 <include>
90 <context ref="string"/>
91 <context id="coqdoc" style-ref="coqdoc" class-disabled="no-spell-check">
92 <start>\(\*\*(\s|\z)</start>
93 <end>\*\)</end>
94 <include>
95 <context ref="comment-in-comment"/>
96 <context ref="string"/>
97 <context ref="escape-seq"/>
98 </include>
99 </context>
100 <context id="comment" style-ref="comment" class="comment" class-disabled="no-spell-check">
101 <start>\(\*</start>
102 <end>\*\)</end>
103 <include>
104 <context id="comment-in-comment" style-ref="comment" class="comment" class-disabled="no-spell-check">
105 <start>\(\*</start>
106 <end>\*\)</end>
107 <include>
108 <context ref="comment-in-comment"/>
109 <context ref="string"/>
110 <context ref="escape-seq"/>
111 </include>
112 </context>
113 <context ref="string"/>
114 <context ref="escape-seq"/>
115 </include>
116 </context>
117 <context id="declaration">
118 <start>\%{decl_head}</start>
119 <end>\%{dot_sep}</end>
120 <include>
121 <context sub-pattern="id" where="start" style-ref="identifier"/>
122 <context sub-pattern="gal" where="start" style-ref="gallina-keyword"/>
123 <context sub-pattern="id_list" where="start" style-ref="identifier"/>
124 <context sub-pattern="gal4list" where="start" style-ref="gallina-keyword"/>
125 <context id="constr-keyword" style-ref="constr-keyword">
126 <keyword>forall</keyword>
127 <keyword>fun</keyword>
128 <keyword>match</keyword>
129 <keyword>fix</keyword>
130 <keyword>cofix</keyword>
131 <keyword>with</keyword>
132 <keyword>for</keyword>
133 <keyword>end</keyword>
134 <keyword>as</keyword>
135 <keyword>let</keyword>
136 <keyword>in</keyword>
137 <keyword>if</keyword>
138 <keyword>then</keyword>
139 <keyword>else</keyword>
140 <keyword>return</keyword>
141 <keyword>using</keyword>
142 </context>
143 <context id="constr-sort" style-ref="constr-keyword">
144 <keyword>Prop</keyword>
145 <keyword>Set</keyword>
146 <keyword>Type</keyword>
147 </context>
148 <context id="dot-nosep">
149 <match>\.\.</match>
150 </context>
151 <context ref="comment"/>
152 <context ref="string"/>
153 <context ref="coqdoc"/>
154 </include>
155 </context>
156 <context id="proof">
157 <start>Proof</start>
158 <end>\%{end_proof}\%{dot_sep}</end>
159 <include>
160 <context sub-pattern="0" where="start" style-ref="vernac-keyword"/>
161 <context sub-pattern="0" where="end" style-ref="vernac-keyword"/>
162 <context ref="command"/>
163 <context ref="scope-command"/>
164 <context ref="hint-command"/>
165 <context ref="command-for-qualit"/>
166 <context ref="declaration"/>
167 <context ref="comment"/>
168 <context ref="string"/>
169 <context ref="coqdoc"/>
170 <context ref="proof"/>
171 <context ref="undotted-sep"/>
172 <context id="tactic" extend-parent="false">
173 <start></start>
174 <end>\%{dot_sep}</end>
175 <include>
176 <context ref="ssr-tac"/>
177 <context ref="ssr-endtac"/>
178 <context ref="ssr-iter"/>
179 <context ref="dot-nosep"/>
180 <context ref="constr-keyword"/>
181 <context ref="constr-sort"/>
182 <context ref="comment"/>
183 <context ref="string"/>
184 </include>
185 </context>
186 </include>
187 </context>
188 <context id="undotted-sep" style-ref="vernac-keyword">
189 <match>\%{undotted_sep}</match>
190 </context>
191 <context id="elpi">
192 <start>(Elpi\%{space}+Accumulate\%{space}+lp:{{|Elpi\%{space}+Db\%{space}+\%{qualit}\%{space}+lp:{{|Elpi\%{space}+Query\%{space}+lp:{{|Elpi\%{space}+Query\%{space}+\%{qualit}\%{space}+lp:{{|Elpi\%{space}+Command\%{space}+\%{qualit}\%{space}+lp:{{|Elpi\%{space}+Tactic\%{space}+\%{qualit}\%{space}+lp:{{|Elpi\%{space}+Program\%{space}+\%{qualit}\%{space}+lp:{{)</start>
193 <end>}}\%{dot_sep}</end>
194 <include>
195 <context sub-pattern="0" where="start" style-ref="vernac-keyword"/>
196 <context sub-pattern="0" where="end" style-ref="vernac-keyword"/>
197 <context id="HOAS" style-ref="escape">
198 <keyword>fun</keyword>
199 <keyword>prod</keyword>
200 <keyword>sort</keyword>
201 <keyword>let</keyword>
202 <keyword>match</keyword>
203 <keyword>fix</keyword>
204 <keyword>indc</keyword>
205 <keyword>indt</keyword>
206 <keyword>const</keyword>
207 <keyword>prop</keyword>
208 <keyword>app</keyword>
209 <keyword>global</keyword>
210 </context>
211 <context id="typing-keyword" style-ref="vernac-keyword">
212 <keyword>type</keyword>
213 <keyword>kind</keyword>
214 <keyword>pi</keyword>
215 <keyword>sigma</keyword>
216 <keyword>rule</keyword>
217 <keyword>constraint</keyword>
218 <keyword>namespace</keyword>
219 </context>
220 <context id="lp-var" style-ref="constr-keyword">
221 <match>\%{lp-var}</match>
222 </context>
223 <context id="lp-name" style-ref="identifier">
224 <match>\%{lp-name}</match>
225 </context>
226 <context id="nested-string" style-ref="string">
227 <start>""</start>
228 <end>""</end>
229 </context>
230 <context id="symbols" style-ref="def:special-char">
231 <match>\%{lp-symb}</match>
232 </context>
233 <context id="lp-comment" style-ref="comment">
234 <match>\%{lp-comment}</match>
235 </context>
236 </include>
237 </context>
238 <context id="command" style-ref="vernac-keyword">
239 <keyword>Add</keyword>
240 <keyword>Check</keyword>
241 <keyword>Eval</keyword>
242 <keyword>Load</keyword>
243 <keyword>Undo</keyword>
244 <keyword>Restart</keyword>
245 <keyword>Goal</keyword>
246 <keyword>Print</keyword>
247 <keyword>Save</keyword>
248 <keyword>Comments</keyword>
249 <keyword>Solve\%{space}+Obligation</keyword>
250 <keyword>((Uns)|(S))et(\%{space}+\%{ident})+</keyword>
251 <keyword>(\%{locality}|((Reserved)|(Tactic))\%{space}+)?Notation</keyword>
252 <keyword>\%{locality}Infix</keyword>
253 <keyword>(Print)|(Reset)\%{space}+Extraction\%{space}+(Inline)|(Blacklist)</keyword>
254 <keyword>(Elpi\%{space}+Trace)|(Elpi\%{space}+Accumulate\%{space}+File)|(Elpi\%{space}+Accumulate\%{space}+Db)|(Elpi\%{space}+Accumulate)|(Elpi\%{space}+Query)|(Elpi\%{space}+Bound\%{space}+Steps)|(Elpi\%{space}+Program)|(Elpi\%{space}+\%{qualit})</keyword>
255 </context>
256 <context id="hint-command" style-ref="vernac-keyword">
257 <prefix>\%{locality}Hint\%{space}+</prefix>
258 <keyword>Resolve</keyword>
259 <keyword>Immediate</keyword>
260 <keyword>Constructors</keyword>
261 <keyword>unfold</keyword>
262 <keyword>Opaque</keyword>
263 <keyword>Transparent</keyword>
264 <keyword>Extern</keyword>
265 </context>
266 <context id="scope-command" style-ref="vernac-keyword">
267 <suffix>\%{space}+Scope</suffix>
268 <keyword>\%{locality}Open</keyword>
269 <keyword>\%{locality}Close</keyword>
270 <keyword>Bind</keyword>
271 <keyword>Delimit</keyword>
272 </context>
273 <context id="command-for-qualit">
274 <suffix>\%{space}+(?'qua'\%{qualit})</suffix>
275 <keyword>Chapter</keyword>
276 <keyword>Combined\%{space}+Scheme</keyword>
277 <keyword>End</keyword>
278 <keyword>Section</keyword>
279 <keyword>Arguments</keyword>
280 <keyword>Implicit\%{space}+Arguments</keyword>
281 <keyword>(Import)|(Include)</keyword>
282 <keyword>Require(\%{space}+((Import)|(Export)))?</keyword>
283 <keyword>(Recursive\%{space}+)?Extraction(\%{space}+(Language\%{space}+(Ocaml)|(Haskell)|(Scheme)|(Toplevel))|(Library)|((No)?Inline)|(Blacklist))?</keyword>
284 <keyword>Extract\%{space}+(Inlined\%{space}+)?(Constant)|(Inductive)</keyword>
285 <include>
286 <context sub-pattern="1" style-ref="vernac-keyword"/>
287 </include>
288 </context>
289 <context id="command-for-qualit-list" style-ref="vernac-keyword">
290 <suffix>(?'qua_list'(\%{space}+\%{qualit})+)</suffix>
291 <keyword>Typeclasses (Transparent)|(Opaque)</keyword>
292 <include>
293 <context sub-pattern="qua_list" style-ref="identifier"/>
294 </include>
295 </context>
296 </include>
297 </context>
298 </definitions>
299 </language>