forked from AntonNguyen/JavaScriptNext.tmLanguage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Regular Expressions (JavaScriptNext).YAML-tmLanguage
105 lines (95 loc) · 3.24 KB
/
Regular Expressions (JavaScriptNext).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
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
# [PackageDev] target_format: plist, ext: tmLanguage
name: Regular Expressions (Javascript Next)
scopeName: source.regexp.js
fileTypes: [re]
uuid: 6D74161E-E1A2-4AF3-922D-759E88DEFF63
foldingStartMarker: (/\*|\{|\()
foldingStopMarker: (\*/|\}|\))
patterns:
- include: '#anchor'
- include: '#backref'
- include: '#quantifier'
- include: '#operator'
- include: '#group-assertion'
- include: '#group-definition'
- include: '#character-class'
- include: '#character-class-definition'
repository:
anchor:
patterns:
- name: keyword.control.anchor.regexp
match: \\[bB]|\^|\$
backref:
patterns:
- name: keyword.other.back-reference.regexp
match: \\[1-9][0-9]*
quantifier:
patterns:
- name: keyword.operator.quantifier.regexp
match: '(\?|\*\??|\+\??)|\{(\d+,\d+|\d+,|\d+)\}'
operator:
patterns:
- name: keyword.operator.or.regexp
match: \|
group-assertion:
patterns:
- name: meta.group.assertion.regexp
begin: (\()((\?=)|(\?!))
beginCaptures:
'1': {name: punctuation.definition.group.regexp}
'2': {name: punctuation.definition.group.assertion.regexp}
'3': {name: meta.assertion.look-ahead.regexp}
'4': {name: meta.assertion.negative-look-ahead.regexp}
end: (\))
endCaptures:
'1': {name: punctuation.definition.group.regexp}
patterns:
- include: $self
group-definition:
patterns:
- name: meta.group.regexp
begin: (\()((\?:))?
beginCaptures:
'1': {name: punctuation.definition.group.regexp}
'3': {name: punctuation.definition.group.capture.regexp}
'5': {name: punctuation.definition.group.capture.regexp}
'6': {name: punctuation.definition.group.no-capture.regexp}
end: (\))
endCaptures:
'1': {name: punctuation.definition.group.regexp}
patterns:
- include: $self
character-class:
patterns:
- name: constant.other.character-class.escape.backslash.regexp
match: \\[wWsSdD]|\.
- name: constant.character.escape.backslash.regexp
match: \\([trnvf0]|c[A-Z]|x[\da-fA-F]{2}|u[\da-fA-F]{4}|.)
character-class-definition:
patterns:
- name: constant.other.character-class.set.regexp
begin: (\[)(\^)?
beginCaptures:
'1': {name: punctuation.definition.character-class.regexp}
'2': {name: keyword.operator.negation.regexp}
end: (\])
endCaptures:
'1': {name: punctuation.definition.character-class.regexp}
patterns:
- include: '#character-class'
- name: constant.other.character-class.range.regexp
match: >-
(?x)
(
(\\[wWsSdD]|\.)|
(\\([trnvf0]|c[A-Z]|x[\da-fA-F]{2}|u[\da-fA-F]{4}|.))
)\-
(
(\\[wWsSdD]|\.)|
(\\([trnvf0]|c[A-Z]|x[\da-fA-F]{2}|u[\da-fA-F]{4}|.))
)
captures:
'2': {name: constant.other.character-class.escape.backslash.regexp}
'3': {name: constant.character.escape.backslash.regexp}
'5': {name: constant.other.character-class.escape.backslash.regexp}
'6': {name: constant.character.escape.backslash.regexp}