-
Notifications
You must be signed in to change notification settings - Fork 592
/
Copy pathRd (R Documentation).sublime-syntax
145 lines (137 loc) · 4.45 KB
/
Rd (R Documentation).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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Rd (R Documentation)
file_extensions:
- rd
scope: text.tex.latex.rd
contexts:
prototype:
- include: scope:text.tex.latex#comments
main:
- include: rd-stucture
- include: r-code
- include: latex-equations
- include: scope:text.tex.latex#plain-tex
- include: scope:text.tex.latex#begin-end-commands
- include: scope:text.tex.latex#general-commands
- include: global-braces
global-braces:
- match: '\{'
scope: punctuation.definition.group.brace.begin.latex
push:
- meta_scope: meta.group.brace.latex
- match: '\}'
scope: punctuation.definition.group.brace.end.latex
pop: true
- include: main
latex-equations:
- include: deqn
- include: eqn
deqn:
- match: '((\\)(?:deqn))(\{)'
captures:
1: support.function.deqn.rd
2: punctuation.definition.backslash.rd
3: punctuation.definition.group.brace.begin.rd
push:
- meta_scope: meta.function.deqn.rd
- meta_content_scope: meta.environment.math
- include: scope:text.tex.latex#math-content
- match: '\}'
scope: punctuation.definition.group.brace.end.rd
pop: true
eqn:
- match: '((\\)(?:eqn))(\{)'
captures:
1: support.function.eqn.rd
2: punctuation.definition.backslash.rd
3: punctuation.definition.group.brace.begin.rd
push:
- meta_scope: meta.function.eqn.rd
- meta_content_scope: meta.environment.math
- include: scope:text.tex.latex#math-content
- match: '\}'
scope: punctuation.definition.group.brace.end.rd
pop: true
r-code:
- match: '((\\)(?:code))(\{)'
captures:
1: support.function.code.rd
2: punctuation.definition.backslash.rd
3: punctuation.definition.group.brace.begin.rd
push:
- meta_scope: meta.function.code.rd
- meta_content_scope: source.r.embedded
- match: '\}'
scope: punctuation.definition.group.brace.end.rd
pop: true
- match: \\%
- include: scope:source.r
- match: '((\\)(?:Sexpr))(?:(\[)(?:[^\]]*)(\]))?(\{)'
captures:
1: support.function.sexpr.rd
2: punctuation.definition.backslash.rd
3: punctuation.definition.group.bracket.begin.rd
4: punctuation.definition.group.bracket.end.rd
5: punctuation.definition.group.brace.begin.rd
push:
- meta_scope: meta.function.sexpr.rd
- meta_content_scope: source.r.embedded
- match: '\}'
scope: punctuation.definition.group.brace.end.rd
pop: true
- match: \\%
- include: scope:source.r
- match: '((\\)(?:usage))(\{)(?:\n)?'
captures:
1: support.function.usage.rd
2: punctuation.definition.backslash.rd
3: punctuation.definition.group.brace.begin.rd
push:
- meta_scope: meta.function.usage.rd
- meta_content_scope: source.r.embedded
- match: '\}'
scope: punctuation.definition.group.brace.end.rd
pop: true
- match: \\%
- include: scope:source.r
- match: '((\\)(?:examples))(\{)(?:\n)?'
captures:
1: support.function.examples.rd
2: punctuation.definition.backslash.rd
3: punctuation.definition.group.brace.begin.rd
push:
- meta_scope: meta.function.examples.rd
- meta_content_scope: source.r.embedded
- match: '\}'
scope: punctuation.definition.group.brace.end.rd
pop: true
- match: \\%
- include: scope:source.r
rd-stucture:
- match: '((\\)name)(\{)'
captures:
1: keyword.other.section.rd
2: punctuation.definition.function.rd
3: punctuation.definition.group.brace.begin.rd
push:
- meta_scope: meta.section.rd
- meta_content_scope: entity.name.function.rd
- match: '(\})'
captures:
1: punctuation.definition.group.brace.end.rd
pop: true
- include: main
- match: '((\\)(?:alias|docType|keyword|title))(\{)'
captures:
1: keyword.other.section.rd
2: punctuation.definition.function.rd
3: punctuation.definition.group.brace.begin.rd
push:
- meta_scope: meta.section.rd
- match: '(\})'
captures:
1: punctuation.definition.group.brace.end.rd
pop: true
- include: main