-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pigeon.sublime-syntax
110 lines (95 loc) · 3.05 KB
/
Pigeon.sublime-syntax
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
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
file_extensions:
- pigeon
scope: source.pigeon
contexts:
main:
- match: '{'
scope: source.pigeon
push: go-code
- match: "(//)(?!{)"
captures:
1: punctuation.definition.comment.begin.pigeon
push: pop-line-comment
- match: /\*
captures:
0: punctuation.definition.comment.begin.pigeon
push:
- meta_scope: comment.block.pigeon
- match: \*/
scope: punctuation.definition.comment.end.pigeon
pop: true
- match: '"'
captures:
0: punctuation.definition.string.begin.pigeon
push:
- meta_scope: string.quoted.double.pigeon
- match: '"'
captures:
0: punctuation.definition.string.end.pigeon
pop: true
- include: string_placeholder
- include: string_escaped_char
- match: "'"
captures:
0: punctuation.definition.string.begin.pigeon
push:
- meta_scope: string.quoted.single.pigeon
- match: "'"
captures:
0: punctuation.definition.string.end.pigeon
pop: true
- include: string_placeholder
- include: string_escaped_char
- match: '`'
captures:
0: punctuation.definition.string.begin.pigeon
push:
- meta_scope: string.quoted.raw.pigeon
- match: '`'
captures:
0: punctuation.definition.string.end.pigeon
pop: true
- include: string_placeholder
- match: ^\s*(\w+)
captures:
1: entity.name.rule-id
- match: <-|=|←|⟵|/|\?|\*|\.
captures:
0: keyword.operator.pigeon
- match: '\w+:'
captures:
0: entity.name.label
pop-line-comment:
- meta_scope: comment.line.pigeon
# Including the newline allows the scope to visually stretch to the right,
# and ensures that functionality that relies on comment scoping, such as
# contextual hotkeys, works properly at EOL while typing a comment. This
# should also match \r\n due to Sublime's internal normalization.
- match: $\n?
pop: true
string_escaped_char:
- match: '\\(\\|[abfnrtv''"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|[0-7]{3})'
scope: constant.character.escape.pigeon
- match: \\.
scope: invalid.illegal.unknown-escape.pigeon
string_placeholder:
- match: |-
(?x)%
(\d+\$)? # field (argument #)
[#0\- +']* # flags
[,;:_]? # separator character (AltiVec)
((-?\d+)|\*(-?\d+\$)?)? # minimum field width
(\.((-?\d+)|\*(-?\d+\$)?)?)? # precision
[diouxXDOUeEfFgGaAcCsSqpnvtTbyYhHmMzZ%] # conversion type
scope: constant.other.placeholder.pigeon
go-code:
- clear_scopes: true
- match: '{'
scope: source.go
push: go-code
- match: '}'
pop: true
- include: scope:source.go