forked from sublimehq/Packages
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaDoc.sublime-syntax
More file actions
195 lines (177 loc) · 6.47 KB
/
JavaDoc.sublime-syntax
File metadata and controls
195 lines (177 loc) · 6.47 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Javadoc
file_extensions: []
scope: text.html.javadoc
hidden: true
variables:
id: '(?:[\p{L}_$][\p{L}\p{N}_$]*)'
javadoc_block_tag_terminator: (?=^\s*\*?\s*@)
contexts:
prototype:
# https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#leadingasterisks
- match: ^\s*(\*)\s*(?!\s*@)
captures:
1: punctuation.definition.comment.javadoc
main:
- meta_include_prototype: false
- match: /\*\*
scope: comment.block.documentation.javadoc punctuation.definition.comment.begin.javadoc
embed: contents
embed_scope: comment.block.documentation.javadoc text.html.javadoc
escape: \*/
escape_captures:
0: comment.block.documentation.javadoc punctuation.definition.comment.end.javadoc
contents:
- meta_include_prototype: false
# Block tag in the first line (immediately after '/**').
- match: \s*(?=@)
embed: javadoc-block-tags
escape: '{{javadoc_block_tag_terminator}}'
# We rely on 'escape' to pop the inner context out.
# 'set' unfortunately will mess up the meta scopes.
- match: ''
push:
- match: ^\s*(\*)?\s*(?=@)
captures:
1: punctuation.definition.comment.javadoc
embed: javadoc-block-tags
escape: '{{javadoc_block_tag_terminator}}'
- include: inline-formatting
inline-formatting:
- include: javadoc-inline-tags
- include: scope:text.html.basic
javadoc-block-tag-base:
- meta_scope: meta.block-tag.javadoc
- include: inline-formatting
javadoc-block-tags:
# https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#param
- match: (@)param\b
scope: keyword.other.documentation.param.javadoc
captures:
1: punctuation.definition.keyword.javadoc
push: [javadoc-block-tag-base, param-tag-parameter]
# https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#see
- match: (@)see\b
scope: keyword.other.documentation.see.javadoc
captures:
1: punctuation.definition.keyword.javadoc
push: [javadoc-block-tag-base, see-tag-content]
# https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#throws
- match: (@)(throws|exception)\b
scope: keyword.other.documentation.throws.javadoc
captures:
1: punctuation.definition.keyword.javadoc
push: [javadoc-block-tag-base, reference]
- match: (@)(uses|provides)\b
scope: keyword.other.documentation.uses-or-provides.javadoc
captures:
1: punctuation.definition.keyword.javadoc
push: [javadoc-block-tag-base, reference]
- match: (@)(return|deprecated|author|version|since|apiNote|impl(?:Note|Spec)|moduleGraph|serial(?:Field|Data)?)\b
scope: keyword.other.documentation.javadoc
captures:
1: punctuation.definition.keyword.javadoc
push: javadoc-block-tag-base
- match: '@'
pop: true
param-tag-parameter:
- match: \S+
scope: variable.parameter.javadoc
pop: true
see-tag-content:
- match: (?=['<])
pop: true
- match: (?=\S)
set: reference
reference:
- match: (?:{{id}}\.)*{{id}}(?:#{{id}})?|#{{id}}
scope: markup.underline.link.javadoc
set:
- match: \(
scope: markup.underline.link.javadoc
set:
- match: \)
scope: markup.underline.link.javadoc
pop: true
- match: .
scope: markup.underline.link.javadoc
- match: ''
pop: true
javadoc-inline-tag-terminator:
- match: \}
scope: punctuation.section.inline-tag.end.javadoc
pop: true
javadoc-inline-tag-base:
- meta_scope: meta.inline-tag.javadoc
- include: javadoc-inline-tag-terminator
# Multi-line tags mustn't highlight leading asterisk.
javadoc-inline-tags:
# https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#code
# https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#literal
- match: ({)((@)(?:code|literal))(?:\s+|(?=\}))
captures:
1: punctuation.section.inline-tag.begin.javadoc
2: keyword.other.documentation.code-or-literal.javadoc
3: punctuation.definition.keyword.javadoc
push:
- meta_scope: meta.inline-tag.javadoc
- include: javadoc-inline-tag-terminator
- include: code-tag-bracket-balancing
- match: ^\s+
- match: .
scope: markup.raw.javadoc
# https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#link
- match: ({)((@)link(?:plain)?)\b
captures:
1: punctuation.section.inline-tag.begin.javadoc
2: keyword.other.documentation.link.javadoc
3: punctuation.definition.keyword.javadoc
push: [javadoc-inline-tag-base, link-tag-label, reference-in-inline-tag]
# https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#value
- match: ({)((@)value)\b
captures:
1: punctuation.section.inline-tag.begin.javadoc
2: keyword.other.documentation.value.javadoc
3: punctuation.definition.keyword.javadoc
push: [javadoc-inline-tag-base, reference-in-inline-tag]
# http://openjdk.java.net/jeps/225
# https://bugs.openjdk.java.net/browse/JDK-8178725
- match: ({)((@)(?:index|extLink))\b
captures:
1: punctuation.section.inline-tag.begin.javadoc
2: keyword.other.documentation.javadoc
3: punctuation.definition.keyword.javadoc
push: javadoc-inline-tag-base
# https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#inheritDoc
- match: ({)((@)inheritDoc)(})
scope: meta.inline-tag.javadoc
captures:
1: punctuation.section.inline-tag.begin.javadoc
2: keyword.other.documentation.javadoc
3: punctuation.definition.keyword.javadoc
4: punctuation.section.inline-tag.end.javadoc
code-tag-bracket-balancing:
- match: \{
scope: markup.raw.javadoc
push:
- match: \}
scope: markup.raw.javadoc
pop: true
- include: code-tag-bracket-balancing
- match: .
scope: markup.raw.javadoc
link-tag-label:
- match: \s*
set:
- meta_content_scope: meta.label.javadoc
- include: scope:text.html.basic
- match: (?=\})
pop: true
reference-in-inline-tag:
- match: ''
set: reference
with_prototype:
- match: (?=\})
pop: true