Debian Codegraph @

tests/languages/javadoc/code_feature.test

raw
1 /**
2 * {@code this.foo} is never {@code null}.
3 *
4 * <code>Foo.bar(null)</code>
5 * <tt>Foo</tt>
6 *
7 * <pre><code>
8 * for (int i = 0; i < array.length; i++) {
9 * array[i] += 1;
10 * }
11 * return array;
12 * </code></pre>
13 *
14 * <pre>{@code
15 * String message = String.join("-", "Java", "is", "cool");
16 * // message returned is: "Java-is-cool"
17 * }</pre>
18 *
19 * <pre>
20 * dstBegin + (srcEnd-srcBegin) - 1
21 * </pre>
22 *
23 * <pre>
24 * <b><i>c</i></b> == (char)(((hibyte &amp; 0xff) &lt;&lt; 8)
25 * | (<b><i>b</i></b> &amp; 0xff))
26 * </pre>
27 *
28 * <pre> {@code
29 * interface ArchiveSearcher { String search(String target); }
30 * class App {
31 * void showSearch(final String target)
32 * throws InterruptedException {
33 * Future<String> future
34 * = executor.submit(new Callable<String>() {
35 * public String call() {
36 * return searcher.search(target);
37 * }});
38 * displayOtherThings(); // do other things while searching
39 * try {
40 * displayText(future.get()); // use future
41 * } catch (ExecutionException ex) { cleanup(); return; }
42 * }
43 * }}</pre>
44 */
45
46 ----------------------------------------------------
47
48 [
49 "/**\r\n * ",
50 ["punctuation", "{"],
51 ["keyword", "@code"],
52 ["code-section", [
53 ["code", [
54 ["keyword", "this"],
55 ["punctuation", "."],
56 "foo"
57 ]]
58 ]],
59 ["punctuation", "}"],
60 " is never ",
61 ["punctuation", "{"],
62 ["keyword", "@code"],
63 ["code-section", [
64 ["code", [
65 ["keyword", "null"]
66 ]]
67 ]],
68 ["punctuation", "}"],
69 ".\r\n *\r\n * ",
70 ["tag", [
71 ["tag", [
72 ["punctuation", "<"],
73 "code"
74 ]],
75 ["punctuation", ">"]
76 ]],
77 ["code-section", [
78 ["line", [
79 ["code", [
80 ["class-name", ["Foo"]],
81 ["punctuation", "."],
82 ["function", "bar"],
83 ["punctuation", "("],
84 ["keyword", "null"],
85 ["punctuation", ")"]
86 ]]
87 ]]
88 ]],
89 ["tag", [
90 ["tag", [
91 ["punctuation", "</"],
92 "code"
93 ]],
94 ["punctuation", ">"]
95 ]],
96
97 "\r\n * ",
98 ["tag", [
99 ["tag", [
100 ["punctuation", "<"],
101 "tt"
102 ]],
103 ["punctuation", ">"]
104 ]],
105 ["code-section", [
106 ["line", [
107 ["code", [
108 ["class-name", ["Foo"]]
109 ]]
110 ]]
111 ]],
112 ["tag", [
113 ["tag", [
114 ["punctuation", "</"],
115 "tt"
116 ]],
117 ["punctuation", ">"]
118 ]],
119
120 "\r\n *\r\n * ",
121 ["tag", [
122 ["tag", [
123 ["punctuation", "<"],
124 "pre"
125 ]],
126 ["punctuation", ">"]
127 ]],
128 ["tag", [
129 ["tag", [
130 ["punctuation", "<"],
131 "code"
132 ]],
133 ["punctuation", ">"]
134 ]],
135
136 ["code-section", [
137 "* ",
138 ["line", [
139 ["code", [
140 ["keyword", "for"],
141 ["punctuation", "("],
142 ["keyword", "int"],
143 " i ",
144 ["operator", "="],
145 ["number", "0"],
146 ["punctuation", ";"],
147 " i ",
148 ["operator", "<"],
149 " array",
150 ["punctuation", "."],
151 "length",
152 ["punctuation", ";"],
153 " i",
154 ["operator", "++"],
155 ["punctuation", ")"],
156 ["punctuation", "{"]
157 ]]
158 ]],
159
160 "\r\n * ",
161 ["line", [
162 ["code", [
163 "array",
164 ["punctuation", "["],
165 "i",
166 ["punctuation", "]"],
167 ["operator", "+="],
168 ["number", "1"],
169 ["punctuation", ";"]
170 ]]
171 ]],
172
173 "\r\n * ",
174 ["line", [
175 ["code", [
176 ["punctuation", "}"]
177 ]]
178 ]],
179
180 "\r\n * ",
181 ["line", [
182 ["code", [
183 ["keyword", "return"],
184 " array",
185 ["punctuation", ";"]
186 ]]
187 ]],
188
189 "\r\n *"
190 ]],
191 ["tag", [
192 ["tag", [
193 ["punctuation", "</"],
194 "code"
195 ]],
196 ["punctuation", ">"]
197 ]],
198 ["tag", [
199 ["tag", [
200 ["punctuation", "</"],
201 "pre"
202 ]],
203 ["punctuation", ">"]
204 ]],
205
206 "\r\n *\r\n * ",
207 ["tag", [
208 ["tag", [
209 ["punctuation", "<"],
210 "pre"
211 ]],
212 ["punctuation", ">"]
213 ]],
214 ["punctuation", "{"],
215 ["keyword", "@code"],
216
217 ["code-section", [
218 "* ",
219 ["code", [
220 ["class-name", ["String"]],
221 " message ",
222 ["operator", "="],
223 ["class-name", ["String"]],
224 ["punctuation", "."],
225 ["function", "join"],
226 ["punctuation", "("],
227 ["string", "\"-\""],
228 ["punctuation", ","],
229 ["string", "\"Java\""],
230 ["punctuation", ","],
231 ["string", "\"is\""],
232 ["punctuation", ","],
233 ["string", "\"cool\""],
234 ["punctuation", ")"],
235 ["punctuation", ";"]
236 ]],
237
238 "\r\n * ",
239 ["code", [
240 ["comment", "// message returned is: \"Java-is-cool\""]
241 ]],
242
243 "\r\n *"
244 ]],
245 ["punctuation", "}"],
246 ["tag", [
247 ["tag", [
248 ["punctuation", "</"],
249 "pre"
250 ]],
251 ["punctuation", ">"]
252 ]],
253
254 "\r\n *\r\n * ",
255 ["tag", [
256 ["tag", [
257 ["punctuation", "<"],
258 "pre"
259 ]],
260 ["punctuation", ">"]
261 ]],
262
263 ["code-section", [
264 "* ",
265 ["line", [
266 ["code", [
267 "dstBegin ",
268 ["operator", "+"],
269 ["punctuation", "("],
270 "srcEnd",
271 ["operator", "-"],
272 "srcBegin",
273 ["punctuation", ")"],
274 ["operator", "-"],
275 ["number", "1"]
276 ]]
277 ]],
278
279 "\r\n *"
280 ]],
281 ["tag", [
282 ["tag", [
283 ["punctuation", "</"],
284 "pre"
285 ]],
286 ["punctuation", ">"]
287 ]],
288
289 "\r\n *\r\n * ",
290 ["tag", [
291 ["tag", [
292 ["punctuation", "<"],
293 "pre"
294 ]],
295 ["punctuation", ">"]
296 ]],
297
298 ["code-section", [
299 "* ",
300 ["line", [
301 ["tag", [
302 ["tag", [
303 ["punctuation", "<"],
304 "b"
305 ]],
306 ["punctuation", ">"]
307 ]],
308 ["tag", [
309 ["tag", [
310 ["punctuation", "<"],
311 "i"
312 ]],
313 ["punctuation", ">"]
314 ]],
315 ["code", ["c"]],
316 ["tag", [
317 ["tag", [
318 ["punctuation", "</"],
319 "i"
320 ]],
321 ["punctuation", ">"]
322 ]],
323 ["tag", [
324 ["tag", [
325 ["punctuation", "</"],
326 "b"
327 ]],
328 ["punctuation", ">"]
329 ]],
330 ["code", [
331 ["operator", "=="],
332 ["punctuation", "("],
333 ["keyword", "char"],
334 ["punctuation", ")"],
335 ["punctuation", "("],
336 ["punctuation", "("],
337 ["punctuation", "("],
338 "hibyte "
339 ]],
340 ["entity", "&amp;"],
341 ["code", [
342 ["number", "0xff"],
343 ["punctuation", ")"]
344 ]],
345 ["entity", "&lt;"],
346 ["entity", "&lt;"],
347 ["code", [
348 ["number", "8"],
349 ["punctuation", ")"]
350 ]]
351 ]],
352
353 "\r\n * ",
354 ["line", [
355 ["code", [
356 ["operator", "|"],
357 ["punctuation", "("]
358 ]],
359 ["tag", [
360 ["tag", [
361 ["punctuation", "<"],
362 "b"
363 ]],
364 ["punctuation", ">"]
365 ]],
366 ["tag", [
367 ["tag", [
368 ["punctuation", "<"],
369 "i"
370 ]],
371 ["punctuation", ">"]
372 ]],
373 ["code", ["b"]],
374 ["tag", [
375 ["tag", [
376 ["punctuation", "</"],
377 "i"
378 ]],
379 ["punctuation", ">"]
380 ]],
381 ["tag", [
382 ["tag", [
383 ["punctuation", "</"],
384 "b"
385 ]],
386 ["punctuation", ">"]
387 ]],
388 ["code", [
389 ]],
390 ["entity", "&amp;"],
391 ["code", [
392 ["number", "0xff"],
393 ["punctuation", ")"],
394 ["punctuation", ")"]
395 ]]
396 ]],
397
398 "\r\n *"
399 ]],
400 ["tag", [
401 ["tag", [
402 ["punctuation", "</"],
403 "pre"
404 ]],
405 ["punctuation", ">"]
406 ]],
407
408 "\r\n *\r\n * ",
409 ["tag", [
410 ["tag", [
411 ["punctuation", "<"],
412 "pre"
413 ]],
414 ["punctuation", ">"]
415 ]],
416 ["punctuation", "{"],
417 ["keyword", "@code"],
418
419 ["code-section", [
420 "* ",
421 ["code", [
422 ["keyword", "interface"],
423 ["class-name", ["ArchiveSearcher"]],
424 ["punctuation", "{"],
425 ["class-name", ["String"]],
426 ["function", "search"],
427 ["punctuation", "("],
428 ["class-name", ["String"]],
429 " target",
430 ["punctuation", ")"],
431 ["punctuation", ";"],
432 ["punctuation", "}"]
433 ]],
434
435 "\r\n * ",
436 ["code", [
437 ["keyword", "class"],
438 ["class-name", ["App"]],
439 ["punctuation", "{"]
440 ]],
441
442 "\r\n * ",
443 ["code", [
444 ["keyword", "void"],
445 ["function", "showSearch"],
446 ["punctuation", "("],
447 ["keyword", "final"],
448 ["class-name", ["String"]],
449 " target",
450 ["punctuation", ")"]
451 ]],
452
453 "\r\n * ",
454 ["code", [
455 ["keyword", "throws"],
456 ["class-name", ["InterruptedException"]],
457 ["punctuation", "{"]
458 ]],
459
460 "\r\n * ",
461 ["code", [
462 ["class-name", ["Future"]],
463 ["generics", [
464 ["punctuation", "<"],
465 ["class-name", ["String"]],
466 ["punctuation", ">"]
467 ]],
468 " future"
469 ]],
470
471 "\r\n * ",
472 ["code", [
473 ["operator", "="],
474 " executor",
475 ["punctuation", "."],
476 ["function", "submit"],
477 ["punctuation", "("],
478 ["keyword", "new"],
479 ["class-name", ["Callable"]],
480 ["generics", [
481 ["punctuation", "<"],
482 ["class-name", ["String"]],
483 ["punctuation", ">"]
484 ]],
485 ["punctuation", "("],
486 ["punctuation", ")"],
487 ["punctuation", "{"]
488 ]],
489
490 "\r\n * ",
491 ["code", [
492 ["keyword", "public"],
493 ["class-name", ["String"]],
494 ["function", "call"],
495 ["punctuation", "("],
496 ["punctuation", ")"],
497 ["punctuation", "{"]
498 ]],
499
500 "\r\n * ",
501 ["code", [
502 ["keyword", "return"],
503 " searcher",
504 ["punctuation", "."],
505 ["function", "search"],
506 ["punctuation", "("],
507 "target",
508 ["punctuation", ")"],
509 ["punctuation", ";"]
510 ]],
511
512 "\r\n * ",
513 ["code", [
514 ["punctuation", "}"],
515 ["punctuation", "}"],
516 ["punctuation", ")"],
517 ["punctuation", ";"]
518 ]],
519
520 "\r\n * ",
521 ["code", [
522 ["function", "displayOtherThings"],
523 ["punctuation", "("],
524 ["punctuation", ")"],
525 ["punctuation", ";"],
526 ["comment", "// do other things while searching"]
527 ]],
528
529 "\r\n * ",
530 ["code", [
531 ["keyword", "try"],
532 ["punctuation", "{"]
533 ]],
534
535 "\r\n * ",
536 ["code", [
537 ["function", "displayText"],
538 ["punctuation", "("],
539 "future",
540 ["punctuation", "."],
541 ["function", "get"],
542 ["punctuation", "("],
543 ["punctuation", ")"],
544 ["punctuation", ")"],
545 ["punctuation", ";"],
546 ["comment", "// use future"]
547 ]],
548
549 "\r\n * ",
550 ["code", [
551 ["punctuation", "}"],
552 ["keyword", "catch"],
553 ["punctuation", "("],
554 ["class-name", ["ExecutionException"]],
555 " ex",
556 ["punctuation", ")"],
557 ["punctuation", "{"],
558 ["function", "cleanup"],
559 ["punctuation", "("],
560 ["punctuation", ")"],
561 ["punctuation", ";"],
562 ["keyword", "return"],
563 ["punctuation", ";"],
564 ["punctuation", "}"]
565 ]],
566
567 "\r\n * ",
568 ["code", [
569 ["punctuation", "}"]
570 ]],
571
572 "\r\n * ",
573 ["code", [
574 ["punctuation", "}"]
575 ]]
576 ]],
577 ["punctuation", "}"],
578 ["tag", [
579 ["tag", [
580 ["punctuation", "</"],
581 "pre"
582 ]],
583 ["punctuation", ">"]
584 ]],
585
586 "\r\n */"
587 ]
588
589 ----------------------------------------------------
590
591 Checks for code.