-
Notifications
You must be signed in to change notification settings - Fork 2
/
_redirects.yaml-tmLanguage
77 lines (67 loc) · 1.44 KB
/
_redirects.yaml-tmLanguage
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
name: Redirect Rules
scopeName: source.redirects
fileTypes:
- _redirects
patterns:
- include: '#main'
repository:
main:
patterns:
- include: '#comment'
- include: '#uri'
- include: '#query'
- include: '#number'
- include: '#code'
- include: '#punct'
- include: '#text'
# Comment line
comment:
name: comment.line.hash.redirects
begin: '#'
end: '$'
beginCaptures:
'0':
name: punctuation.definition.comment.redirects
# URI
uri:
name: string.unquoted.uri.redirects
begin: '(?:[a-z]+:)?\/'
end: '[\s$]'
patterns:
- include: '#wildcard'
- include: '#splat'
# Wildcard
wildcard:
name: constant.character.wildcard.redirects
match: '\*'
# Splat
splat:
name: variable.other.splat.redirects
match: ':\w+'
# Query
query:
name: keyword.other.query-selector.redirects
match: '[^\s]+(?==)'
# Redirect code
number:
match: '(\d+)(!)?'
captures:
'1':
name: constant.numeric.integer.redirects
'2':
name: constant.character.force.redirects
# Geo/lang code
code:
name: string.unquoted.code.redirects
match: '(?<==)[a-z]{2}(?:-[A-Z]{2})?(?=\s|$)'
# Text
text:
name: string.unquoted.text.redirects
match: '(?<==)[^\s]+'
# Punctuation
punct:
patterns:
- name: punctuation.accessor.redirects
match: ':|='
- name: punctuation.separator.redirects
match: ',(?!\s)'