-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
source.agda.js
65 lines (63 loc) · 2.41 KB
/
source.agda.js
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
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/agda/agda-github-syntax-highlighting>
// and licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.agda'],
names: ['agda'],
patterns: [
{begin: '--', end: '$', name: 'comment.line.double-dash.agda'},
{begin: '{-[^#]', end: '-}', name: 'comment.block.agda'},
{begin: '{-#', end: '#-}', name: 'support.other.agda'},
{begin: '"', end: '"', name: 'string.quoted.double.agda'},
{match: "'([^\\\\']|\\\\['\\\\\"[:alnum:]]+)'", name: 'constant.char.agda'},
{
match:
'(?<=^|[[:space:]\\(\\){}])(-?\\d+|0x[0-9A-F]+|-?\\d+\\.\\d+((e|E)(\\+|-)?\\d+)?|-?\\d+(e|E)(\\+|-)?\\d+)(?=[[:space:]\\(\\){}])',
name: 'constant.numeric.agda'
},
{
captures: {
1: {name: 'keyword.other.agda'},
2: {name: 'entity.name.type.agda'}
},
match:
'\\b(data|record|module|constructor|open *import|open|import)[[:space:]]+([^;\\(\\){}@"[:space:]]+)'
},
{
match:
'((?<=^|[.;\\(\\){}@"[:space:]])\\?(?=[.;\\(\\){}@"[:space:]])|{!.*!})',
name: 'entity.name.tag.agda'
},
{
match:
'\\b(Set|Prop)[0123456789₀₁₂₃₄₅₆₇₈₉]*(?=$|[[:space:]\\(\\)\\{\\}])',
name: 'constant.language.agda'
},
{
match:
'(?<=^|[[:space:]\\(\\)\\{\\}])(λ|→|->|∀|=|←|:)(?=[[:space:]\\(\\)\\{\\}])',
name: 'keyword.other.agda'
},
{
captures: {
1: {name: 'keyword.other.agda'},
4: {name: 'entity.name.agda'}
},
match:
'^[[:space:]]*(((abstract|instance|macro|pattern|postulate|primitive|private|syntax|variable|where|let)[[:space:]]+)*)((([^;\\(\\){}@"[:space:]]+)[[:space:]]+)+)(?=:)'
},
{
match:
'(?<=^|[[:space:]\\(\\){}])(abstract|constructor|data|do|eta-equality|field|forall|hiding|import|in|inductive|infix|infixl|infixr|instance|interleaved|let|macro|module|mutual|no-eta-equality|open|overlap|pattern|postulate|primitive|private|public|quote|quoteContext|quoteGoal|quoteTerm|record|renaming|rewrite|syntax|tactic|unquote|unquoteDecl|unquoteDef|using|variable|where|with)(?=$|[[:space:]\\(\\){}])',
name: 'keyword.other.agda'
}
],
scopeName: 'source.agda'
}
export default grammar