View Javadoc
1   ///////////////////////////////////////////////////////////////////////////////////////////////
2   // checkstyle: Checks Java source code and other text files for adherence to a set of rules.
3   // Copyright (C) 2001-2025 the original author or authors.
4   //
5   // This library is free software; you can redistribute it and/or
6   // modify it under the terms of the GNU Lesser General Public
7   // License as published by the Free Software Foundation; either
8   // version 2.1 of the License, or (at your option) any later version.
9   //
10  // This library is distributed in the hope that it will be useful,
11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  // Lesser General Public License for more details.
14  //
15  // You should have received a copy of the GNU Lesser General Public
16  // License along with this library; if not, write to the Free Software
17  // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  ///////////////////////////////////////////////////////////////////////////////////////////////
19  
20  package com.puppycrawl.tools.checkstyle.api;
21  
22  import com.puppycrawl.tools.checkstyle.grammar.javadoc.JavadocCommentsLexer;
23  
24  /**
25   * Contains the constants for all the tokens contained in the Abstract
26   * Syntax Tree for the javadoc grammar.
27   *
28   * @see <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javadoc.html">
29   *     javadoc - The Java API Documentation Generator</a>
30   */
31  public final class JavadocCommentsTokenTypes {
32  
33      /**
34       * Root node of any Javadoc comment.
35       *
36       * <p><b>Tree for example:</b></p>
37       * <pre>{@code
38       * JAVADOC_CONTENT -> JAVADOC_CONTENT
39       * |--LEADING_ASTERISK -> *
40       * |--NEWLINE -> \n
41       * |--LEADING_ASTERISK -> *
42       * |--NEWLINE -> \n
43       * |--LEADING_ASTERISK -> *
44       * `--NEWLINE -> \n
45       * }</pre>
46       */
47      public static final int JAVADOC_CONTENT = JavadocCommentsLexer.JAVADOC;
48  
49      /**
50       * Leading asterisk used to format Javadoc lines.
51       */
52      public static final int LEADING_ASTERISK = JavadocCommentsLexer.LEADING_ASTERISK;
53  
54      /**
55       * Newline character in a Javadoc comment.
56       */
57      public static final int NEWLINE = JavadocCommentsLexer.NEWLINE;
58  
59      /**
60       * Plain text content within a Javadoc comment.
61       */
62      public static final int TEXT = JavadocCommentsLexer.TEXT;
63  
64      // Block tags
65  
66      /**
67       * General block tag (e.g. {@code @param}, {@code @return}).
68       */
69      public static final int JAVADOC_BLOCK_TAG = JavadocCommentsLexer.JAVADOC_BLOCK_TAG;
70  
71      /**
72       * At-sign {@code @} that starts a block tag.
73       */
74      public static final int AT_SIGN = JavadocCommentsLexer.AT_SIGN;
75  
76      /**
77       * {@code @author} block tag.
78       */
79      public static final int AUTHOR_BLOCK_TAG = JavadocCommentsLexer.AUTHOR_BLOCK_TAG;
80  
81      /**
82       * {@code @deprecated} block tag.
83       */
84      public static final int DEPRECATED_BLOCK_TAG = JavadocCommentsLexer.DEPRECATED_BLOCK_TAG;
85  
86      /**
87       * {@code @param} Javadoc block tag.
88       *
89       * <p>Such Javadoc tag can have two children:</p>
90       * <ol>
91       *  <li>{@link #PARAMETER_NAME}</li>
92       *  <li>{@link #DESCRIPTION}</li>
93       * </ol>
94       *
95       * <p><b>Example:</b></p>
96       * <pre>{@code * @param value The parameter of method.}</pre>
97       * <b>Tree:</b>
98       * <pre>{@code
99       * JAVADOC_BLOCK_TAG -> JAVADOC_BLOCK_TAG
100      * `--PARAM_BLOCK_TAG -> PARAM_BLOCK_TAG
101      *    |--AT_SIGN -> @
102      *    |--TAG_NAME -> param
103      *    |--TEXT ->
104      *    |--PARAMETER_NAME -> value
105      *    `--DESCRIPTION -> DESCRIPTION
106      *        `--TEXT ->  The parameter of method.
107      * }</pre>
108      *
109      * @see #JAVADOC_BLOCK_TAG
110      */
111     public static final int PARAM_BLOCK_TAG = JavadocCommentsLexer.PARAM_BLOCK_TAG;
112 
113     /**
114      * {@code @return} Javadoc block tag.
115      *
116      * <p>Such Javadoc tag can have one child:</p>
117      * <ol>
118      *  <li>{@link #DESCRIPTION}</li>
119      * </ol>
120      *
121      * <p><b>Example:</b></p>
122      * <pre>{@code * @return The return of method.}</pre>
123      * <b>Tree:</b>
124      * <pre>{@code
125      * JAVADOC_BLOCK_TAG -> JAVADOC_BLOCK_TAG
126      * `--RETURN_BLOCK_TAG -> RETURN_BLOCK_TAG
127      *    |--AT_SIGN -> @
128      *    |--TAG_NAME -> return
129      *    `--DESCRIPTION -> DESCRIPTION
130      *        `--TEXT ->  The return of method.
131      * }</pre>
132      *
133      * @see #JAVADOC_BLOCK_TAG
134      */
135     public static final int RETURN_BLOCK_TAG = JavadocCommentsLexer.RETURN_BLOCK_TAG;
136 
137     /**
138      * {@code @throws} Javadoc block tag.
139      *
140      * <p>Such Javadoc tag can have two children:</p>
141      * <ol>
142      *  <li>{@link #IDENTIFIER} - the exception class</li>
143      *  <li>{@link #DESCRIPTION} - description</li>
144      * </ol>
145      *
146      * <p><b>Example:</b></p>
147      * <pre>{@code * @throws IOException if an I/O error occurs}</pre>
148      * <b>Tree:</b>
149      * <pre>{@code
150      * JAVADOC_BLOCK_TAG -> JAVADOC_BLOCK_TAG
151      * `--THROWS_BLOCK_TAG -> THROWS_BLOCK_TAG
152      *     |--AT_SIGN -> @
153      *     |--TAG_NAME -> throws
154      *     |--TEXT ->
155      *     |--IDENTIFIER -> IOException
156      *     `--DESCRIPTION -> DESCRIPTION
157      *         `--TEXT ->  if an I/O error occurs
158      * }</pre>
159      *
160      * @see #JAVADOC_BLOCK_TAG
161      */
162     public static final int THROWS_BLOCK_TAG = JavadocCommentsLexer.THROWS_BLOCK_TAG;
163 
164     /**
165      * {@code @exception} Javadoc block tag.
166      *
167      * <p>Such Javadoc tag can have two children:</p>
168      * <ol>
169      *  <li>{@link #IDENTIFIER}</li>
170      *  <li>{@link #DESCRIPTION}</li>
171      * </ol>
172      *
173      * <p><b>Example:</b></p>
174      * <pre>{@code * @exception FileNotFoundException when file is not found.}</pre>
175      * <b>Tree:</b>
176      * <pre>{@code
177      * JAVADOC_BLOCK_TAG -> JAVADOC_BLOCK_TAG
178      * `--EXCEPTION_BLOCK_TAG -> EXCEPTION_BLOCK_TAG
179      *    |--AT_SIGN -> @
180      *    |--TAG_NAME -> exception
181      *    |--TEXT ->
182      *    |--IDENTIFIER -> FileNotFoundException
183      *    `--DESCRIPTION -> DESCRIPTION
184      *        `--TEXT -> when file is not found.
185      * }</pre>
186      *
187      * @see #JAVADOC_BLOCK_TAG
188      */
189     public static final int EXCEPTION_BLOCK_TAG = JavadocCommentsLexer.EXCEPTION_BLOCK_TAG;
190 
191     /**
192      * {@code @since} block tag.
193      */
194     public static final int SINCE_BLOCK_TAG = JavadocCommentsLexer.SINCE_BLOCK_TAG;
195 
196     /**
197      * {@code @version} block tag.
198      */
199     public static final int VERSION_BLOCK_TAG = JavadocCommentsLexer.VERSION_BLOCK_TAG;
200 
201     /**
202      * {@code @see} block tag.
203      */
204     public static final int SEE_BLOCK_TAG = JavadocCommentsLexer.SEE_BLOCK_TAG;
205 
206     /**
207      * {@code @hidden} Javadoc block tag.
208      *
209      * <p>Such Javadoc tag can have one child:</p>
210      * <ol>
211      *   <li>{@link #DESCRIPTION} – optional description text</li>
212      * </ol>
213      *
214      * <p><b>Example:</b></p>
215      * <pre>{@code * @hidden value}</pre>
216      *
217      * <b>Tree:</b>
218      * <pre>{@code
219      * JAVADOC_BLOCK_TAG -> JAVADOC_BLOCK_TAG
220      * `--HIDDEN_BLOCK_TAG -> HIDDEN_BLOCK_TAG
221      *     |--AT_SIGN -> @
222      *     |--TAG_NAME -> hidden
223      *     `--DESCRIPTION -> DESCRIPTION
224      *         `--TEXT ->  value
225      * }</pre>
226      *
227      * @see #JAVADOC_BLOCK_TAG
228      */
229     public static final int HIDDEN_BLOCK_TAG = JavadocCommentsLexer.HIDDEN_BLOCK_TAG;
230 
231     /**
232      * {@code @uses} block tag.
233      */
234     public static final int USES_BLOCK_TAG = JavadocCommentsLexer.USES_BLOCK_TAG;
235 
236     /**
237      * {@code @provides} block tag.
238      */
239     public static final int PROVIDES_BLOCK_TAG = JavadocCommentsLexer.PROVIDES_BLOCK_TAG;
240 
241     /**
242      * {@code @serial} block tag.
243      */
244     public static final int SERIAL_BLOCK_TAG = JavadocCommentsLexer.SERIAL_BLOCK_TAG;
245 
246     /**
247      * {@code @serialData} block tag.
248      */
249     public static final int SERIAL_DATA_BLOCK_TAG = JavadocCommentsLexer.SERIAL_DATA_BLOCK_TAG;
250 
251     /**
252      * {@code @serialField} block tag.
253      */
254     public static final int SERIAL_FIELD_BLOCK_TAG = JavadocCommentsLexer.SERIAL_FIELD_BLOCK_TAG;
255 
256     /**
257      * Custom or unrecognized block tag.
258      */
259     public static final int CUSTOM_BLOCK_TAG = JavadocCommentsLexer.CUSTOM_BLOCK_TAG;
260 
261     // Inline tags
262 
263     /**
264      * General inline tag (e.g. {@code @link}).
265      */
266     public static final int JAVADOC_INLINE_TAG = JavadocCommentsLexer.JAVADOC_INLINE_TAG;
267 
268     /**
269      * Start of an inline tag  <code>{</code>.
270      */
271     public static final int JAVADOC_INLINE_TAG_START =
272             JavadocCommentsLexer.JAVADOC_INLINE_TAG_START;
273 
274     /**
275      * End of an inline tag <code>}</code>.
276      */
277     public static final int JAVADOC_INLINE_TAG_END = JavadocCommentsLexer.JAVADOC_INLINE_TAG_END;
278 
279     /**
280      * {@code {@code}} inline tag.
281      */
282     public static final int CODE_INLINE_TAG = JavadocCommentsLexer.CODE_INLINE_TAG;
283 
284     /**
285      * {@code {@link}} inline tag.
286      */
287     public static final int LINK_INLINE_TAG = JavadocCommentsLexer.LINK_INLINE_TAG;
288 
289     /**
290      * {@code {@linkplain}} inline tag.
291      */
292     public static final int LINKPLAIN_INLINE_TAG = JavadocCommentsLexer.LINKPLAIN_INLINE_TAG;
293 
294     /**
295      * {@code {@value}} inline tag.
296      */
297     public static final int VALUE_INLINE_TAG = JavadocCommentsLexer.VALUE_INLINE_TAG;
298 
299     /**
300      * {@code {@summary}} inline tag.
301      */
302     public static final int SUMMARY_INLINE_TAG = JavadocCommentsLexer.SUMMARY_INLINE_TAG;
303 
304     /**
305      * {@code {@inheritDoc}} inline tag.
306      */
307     public static final int INHERIT_DOC_INLINE_TAG = JavadocCommentsLexer.INHERIT_DOC_INLINE_TAG;
308 
309     /**
310      * {@code {@systemProperty}} inline tag.
311      */
312     public static final int SYSTEM_PROPERTY_INLINE_TAG =
313             JavadocCommentsLexer.SYSTEM_PROPERTY_INLINE_TAG;
314 
315     /**
316      * {@code {@literal}} inline tag.
317      */
318     public static final int LITERAL_INLINE_TAG = JavadocCommentsLexer.LITERAL_INLINE_TAG;
319 
320     /**
321      * {@code {@return}} inline tag.
322      */
323     public static final int RETURN_INLINE_TAG = JavadocCommentsLexer.RETURN_INLINE_TAG;
324 
325     /**
326      * {@code {@index}} inline tag.
327      */
328     public static final int INDEX_INLINE_TAG = JavadocCommentsLexer.INDEX_INLINE_TAG;
329 
330     /**
331      * {@code @snippet} inline tag.
332      */
333     public static final int SNIPPET_INLINE_TAG = JavadocCommentsLexer.SNIPPET_INLINE_TAG;
334 
335     /**
336      * Custom or unrecognized inline tag.
337      */
338     public static final int CUSTOM_INLINE_TAG = JavadocCommentsLexer.CUSTOM_INLINE_TAG;
339 
340     // Components
341 
342     /**
343      * Identifier token.
344      */
345     public static final int IDENTIFIER = JavadocCommentsLexer.IDENTIFIER;
346 
347     /**
348      * Hash symbol {@code #} used in references.
349      */
350     public static final int HASH = JavadocCommentsLexer.HASH;
351 
352     /**
353      * Left parenthesis {@code ( }.
354      */
355     public static final int LPAREN = JavadocCommentsLexer.LPAREN;
356 
357     /**
358      * Right parenthesis {@code ) }.
359      */
360     public static final int RPAREN = JavadocCommentsLexer.RPAREN;
361 
362     /**
363      * Comma symbol {@code , }.
364      */
365     public static final int COMMA = JavadocCommentsLexer.COMMA;
366 
367     /**
368      * Slash symbol {@code / }.
369      */
370     public static final int SLASH = JavadocCommentsLexer.SLASH;
371 
372     /**
373      * Question mark symbol {@code ? }.
374      */
375     public static final int QUESTION = JavadocCommentsLexer.QUESTION;
376 
377     /**
378      * Less-than symbol {@code < }.
379      */
380     public static final int LT = JavadocCommentsLexer.LT;
381 
382     /**
383      * Greater-than symbol {@code > }.
384      */
385     public static final int GT = JavadocCommentsLexer.GT;
386 
387     /**
388      * Keyword {@code extends} in type parameters.
389      */
390     public static final int EXTENDS = JavadocCommentsLexer.EXTENDS;
391 
392     /**
393      * Keyword {@code super} in type parameters.
394      */
395     public static final int SUPER = JavadocCommentsLexer.SUPER;
396 
397     /**
398      * Parameter type reference.
399      */
400     public static final int PARAMETER_TYPE = JavadocCommentsLexer.PARAMETER_TYPE;
401 
402     /**
403      * General reference within Javadoc.
404      */
405     public static final int REFERENCE = JavadocCommentsLexer.REFERENCE;
406 
407     /**
408      * Type name reference.
409      */
410     public static final int TYPE_NAME = JavadocCommentsLexer.TYPE_NAME;
411 
412     /**
413      * Member reference (e.g. method or field).
414      */
415     public static final int MEMBER_REFERENCE = JavadocCommentsLexer.MEMBER_REFERENCE;
416 
417     /**
418      * List of parameter types in a reference.
419      */
420     public static final int PARAMETER_TYPE_LIST = JavadocCommentsLexer.PARAMETER_TYPE_LIST;
421 
422     /**
423      * Type arguments in generics.
424      */
425     public static final int TYPE_ARGUMENTS = JavadocCommentsLexer.TYPE_ARGUMENTS;
426 
427     /**
428      * Single type argument in generics.
429      */
430     public static final int TYPE_ARGUMENT = JavadocCommentsLexer.TYPE_ARGUMENT;
431 
432     /**
433      * Description part of a Javadoc tag.
434      */
435     public static final int DESCRIPTION = JavadocCommentsLexer.DESCRIPTION;
436 
437     /**
438      * Format specifier inside Javadoc content.
439      */
440     public static final int FORMAT_SPECIFIER = JavadocCommentsLexer.FORMAT_SPECIFIER;
441 
442     /**
443      * Attribute name in a {@code @snippet}.
444      */
445     public static final int SNIPPET_ATTR_NAME = JavadocCommentsLexer.SNIPPET_ATTR_NAME;
446 
447     /**
448      * Equals sign {@code = }.
449      */
450     public static final int EQUALS = JavadocCommentsLexer.EQUALS;
451 
452     /**
453      * Value assigned to an attribute.
454      */
455     public static final int ATTRIBUTE_VALUE = JavadocCommentsLexer.ATTRIBUTE_VALUE;
456 
457     /**
458      * Colon symbol {@code : }.
459      */
460     public static final int COLON = JavadocCommentsLexer.COLON;
461 
462     /**
463      * Term used in {@code {@index}} tag.
464      */
465     public static final int INDEX_TERM = JavadocCommentsLexer.INDEX_TERM;
466 
467     /**
468      * Single snippet attribute.
469      */
470     public static final int SNIPPET_ATTRIBUTE = JavadocCommentsLexer.SNIPPET_ATTRIBUTE;
471 
472     /**
473      * Collection of snippet attributes.
474      */
475     public static final int SNIPPET_ATTRIBUTES = JavadocCommentsLexer.SNIPPET_ATTRIBUTES;
476 
477     /**
478      * Body content of a {@code @snippet}.
479      */
480     public static final int SNIPPET_BODY = JavadocCommentsLexer.SNIPPET_BODY;
481 
482     /**
483      * Field type reference.
484      */
485     public static final int FIELD_TYPE = JavadocCommentsLexer.FIELD_TYPE;
486 
487     /**
488      * Parameter name reference.
489      */
490     public static final int PARAMETER_NAME = JavadocCommentsLexer.PARAMETER_NAME;
491 
492     /**
493      * String literal inside Javadoc.
494      */
495     public static final int STRING_LITERAL = JavadocCommentsLexer.STRING_LITERAL;
496 
497     // HTML
498 
499     /**
500      * General HTML element.
501      */
502     public static final int HTML_ELEMENT = JavadocCommentsLexer.HTML_ELEMENT;
503 
504     /**
505      * Void HTML element (self-closing).
506      */
507     public static final int VOID_ELEMENT = JavadocCommentsLexer.VOID_ELEMENT;
508 
509     /**
510      * Content inside an HTML element.
511      */
512     public static final int HTML_CONTENT = JavadocCommentsLexer.HTML_CONTENT;
513 
514     /**
515      * Single HTML attribute.
516      */
517     public static final int HTML_ATTRIBUTE = JavadocCommentsLexer.HTML_ATTRIBUTE;
518 
519     /**
520      * List of HTML attributes.
521      */
522     public static final int HTML_ATTRIBUTES = JavadocCommentsLexer.HTML_ATTRIBUTES;
523 
524     /**
525      * Start of an HTML tag.
526      */
527     public static final int HTML_TAG_START = JavadocCommentsLexer.HTML_TAG_START;
528 
529     /**
530      * End of an HTML tag.
531      */
532     public static final int HTML_TAG_END = JavadocCommentsLexer.HTML_TAG_END;
533 
534     /**
535      * Opening tag delimiter {@code < }.
536      */
537     public static final int TAG_OPEN = JavadocCommentsLexer.TAG_OPEN;
538 
539     /**
540      * HTML tag name.
541      */
542     public static final int TAG_NAME = JavadocCommentsLexer.TAG_NAME;
543 
544     /**
545      * Closing tag delimiter {@code > }.
546      */
547     public static final int TAG_CLOSE = JavadocCommentsLexer.TAG_CLOSE;
548 
549     /**
550      * Self-closing tag delimiter {@code /> }.
551      */
552     public static final int TAG_SLASH_CLOSE = JavadocCommentsLexer.TAG_SLASH_CLOSE;
553 
554     /**
555      * Slash symbol inside a closing tag.
556      */
557     public static final int TAG_SLASH = JavadocCommentsLexer.TAG_SLASH;
558 
559     /**
560      * Attribute name inside an HTML tag.
561      */
562     public static final int TAG_ATTR_NAME = JavadocCommentsLexer.TAG_ATTR_NAME;
563 
564     /**
565      * Full HTML comment.
566      */
567     public static final int HTML_COMMENT = JavadocCommentsLexer.HTML_COMMENT;
568 
569     /**
570      * Opening part of an HTML comment.
571      */
572     public static final int HTML_COMMENT_START = JavadocCommentsLexer.HTML_COMMENT_START;
573 
574     /**
575      * Closing part of an HTML comment.
576      */
577     public static final int HTML_COMMENT_END = JavadocCommentsLexer.HTML_COMMENT_END;
578 
579     /**
580      * Content inside an HTML comment.
581      */
582     public static final int HTML_COMMENT_CONTENT = JavadocCommentsLexer.HTML_COMMENT_CONTENT;
583 
584     /** Empty private constructor of the current class. */
585     private JavadocCommentsTokenTypes() {
586     }
587 }