3 pygments.lexers.theorem |
3 pygments.lexers.theorem |
4 ~~~~~~~~~~~~~~~~~~~~~~~ |
4 ~~~~~~~~~~~~~~~~~~~~~~~ |
5 |
5 |
6 Lexers for theorem-proving languages. |
6 Lexers for theorem-proving languages. |
7 |
7 |
8 :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. |
8 :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. |
9 :license: BSD, see LICENSE for details. |
9 :license: BSD, see LICENSE for details. |
10 """ |
10 """ |
11 |
11 |
12 import re |
12 import re |
13 |
13 |
27 |
27 |
28 name = 'Coq' |
28 name = 'Coq' |
29 aliases = ['coq'] |
29 aliases = ['coq'] |
30 filenames = ['*.v'] |
30 filenames = ['*.v'] |
31 mimetypes = ['text/x-coq'] |
31 mimetypes = ['text/x-coq'] |
|
32 |
|
33 flags = re.UNICODE |
32 |
34 |
33 keywords1 = ( |
35 keywords1 = ( |
34 # Vernacular commands |
36 # Vernacular commands |
35 'Section', 'Module', 'End', 'Require', 'Import', 'Export', 'Variable', |
37 'Section', 'Module', 'End', 'Require', 'Import', 'Export', 'Variable', |
36 'Variables', 'Parameter', 'Parameters', 'Axiom', 'Hypothesis', |
38 'Variables', 'Parameter', 'Parameters', 'Axiom', 'Hypothesis', |
121 (r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex), |
123 (r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex), |
122 (r'0[oO][0-7][0-7_]*', Number.Oct), |
124 (r'0[oO][0-7][0-7_]*', Number.Oct), |
123 (r'0[bB][01][01_]*', Number.Bin), |
125 (r'0[bB][01][01_]*', Number.Bin), |
124 (r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)', Number.Float), |
126 (r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)', Number.Float), |
125 |
127 |
126 (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'", |
128 (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'", String.Char), |
127 String.Char), |
129 |
128 (r"'.'", String.Char), |
130 (r"'.'", String.Char), |
129 (r"'", Keyword), # a stray quote is another syntax element |
131 (r"'", Keyword), # a stray quote is another syntax element |
130 |
132 |
131 (r'"', String.Double, 'string'), |
133 (r'"', String.Double, 'string'), |
132 |
134 |
133 (r'[~?][a-z][\w\']*:', Name), |
135 (r'[~?][a-z][\w\']*:', Name), |
|
136 (r'\S', Name.Builtin.Pseudo), |
134 ], |
137 ], |
135 'comment': [ |
138 'comment': [ |
136 (r'[^(*)]+', Comment), |
139 (r'[^(*)]+', Comment), |
137 (r'\(\*', Comment, '#push'), |
140 (r'\(\*', Comment, '#push'), |
138 (r'\*\)', Comment, '#pop'), |
141 (r'\*\)', Comment, '#pop'), |
408 'lemma', 'theorem', 'def', 'definition', 'example', |
411 'lemma', 'theorem', 'def', 'definition', 'example', |
409 'axiom', 'axioms', 'constant', 'constants', |
412 'axiom', 'axioms', 'constant', 'constants', |
410 'universe', 'universes', |
413 'universe', 'universes', |
411 'inductive', 'coinductive', 'structure', 'extends', |
414 'inductive', 'coinductive', 'structure', 'extends', |
412 'class', 'instance', |
415 'class', 'instance', |
|
416 'abbreviation', |
413 |
417 |
414 'noncomputable theory', |
418 'noncomputable theory', |
415 |
419 |
416 'noncomputable', 'mutual', 'meta', |
420 'noncomputable', 'mutual', 'meta', |
417 |
421 |
432 (words(( |
436 (words(( |
433 'forall', 'fun', 'Pi', 'from', 'have', 'show', 'assume', 'suffices', |
437 'forall', 'fun', 'Pi', 'from', 'have', 'show', 'assume', 'suffices', |
434 'let', 'if', 'else', 'then', 'in', 'with', 'calc', 'match', |
438 'let', 'if', 'else', 'then', 'in', 'with', 'calc', 'match', |
435 'do' |
439 'do' |
436 ), prefix=r'\b', suffix=r'\b'), Keyword), |
440 ), prefix=r'\b', suffix=r'\b'), Keyword), |
|
441 (words(('sorry', 'admit'), prefix=r'\b', suffix=r'\b'), Generic.Error), |
437 (words(('Sort', 'Prop', 'Type'), prefix=r'\b', suffix=r'\b'), Keyword.Type), |
442 (words(('Sort', 'Prop', 'Type'), prefix=r'\b', suffix=r'\b'), Keyword.Type), |
438 (words(( |
443 (words(( |
439 '#eval', '#check', '#reduce', '#exit', |
444 '#eval', '#check', '#reduce', '#exit', |
440 '#print', '#help', |
445 '#print', '#help', |
441 ), suffix=r'\b'), Keyword), |
446 ), suffix=r'\b'), Keyword), |