Enum Token.Type
- All Implemented Interfaces:
Serializable,Comparable<Token.Type>,java.lang.constant.Constable
- Enclosing class:
Token
The general idea is that every token that requires special handling (extra line breaks,
indentation, forcing or forbidding whitespace) from JavadocWriter gets its own type.
But I haven't been super careful about it, so I'd imagine that we could merge or remove some of
these if we wanted. (For example, PARAGRAPH_CLOSE_TAG and LIST_ITEM_CLOSE_TAG could share a
common IGNORABLE token type. But their corresponding OPEN tags exist, so I've kept the CLOSE
tags.)
Note, though, that tokens of the same type may still have been handled differently by JavadocLexer when it created them. For example, LITERAL is used for both plain text and inline
tags, even though the two affect the lexer's state differently.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription∕✱✱✱∕The@foothat begins a block Javadoc tag like@throws.A newline in a<pre>or<table>section.Anything else:foo,<b>,{@code foo}etc.<!-- MOE:begin_intracomment_strip --><!-- MOE:end_intracomment_strip -->Token that permits but does not force a line break.Whitespace that is not in a<pre>or<table>section. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Token.TypeReturns the enum constant of this type with the specified name.static Token.Type[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
BEGIN_JAVADOC
∕✱✱ -
END_JAVADOC
✱∕ -
FOOTER_JAVADOC_TAG_START
The@foothat begins a block Javadoc tag like@throws. -
LIST_OPEN_TAG
-
LIST_CLOSE_TAG
-
LIST_ITEM_OPEN_TAG
-
LIST_ITEM_CLOSE_TAG
-
HEADER_OPEN_TAG
-
HEADER_CLOSE_TAG
-
PARAGRAPH_OPEN_TAG
-
PARAGRAPH_CLOSE_TAG
-
BLOCKQUOTE_OPEN_TAG
-
BLOCKQUOTE_CLOSE_TAG
-
PRE_OPEN_TAG
-
PRE_CLOSE_TAG
-
CODE_OPEN_TAG
-
CODE_CLOSE_TAG
-
TABLE_OPEN_TAG
-
TABLE_CLOSE_TAG
-
MOE_BEGIN_STRIP_COMMENT
<!-- MOE:begin_intracomment_strip --> -
MOE_END_STRIP_COMMENT
<!-- MOE:end_intracomment_strip --> -
HTML_COMMENT
-
BR_TAG
-
WHITESPACE
Whitespace that is not in a<pre>or<table>section. Whitespace includes leading newlines, asterisks, and tabs and spaces. In the output, it is translated to newlines (with leading spaces and asterisks) or spaces. -
FORCED_NEWLINE
A newline in a<pre>or<table>section. We preserve user formatting in these sections, including newlines. -
OPTIONAL_LINE_BREAK
Token that permits but does not force a line break. The way that we accomplish this is somewhat indirect: As far asJavadocWriteris concerned, this token is meaningless. But its mere existence preventsJavadocLexerfrom joining twoLITERALtokens that would otherwise be adjacent. Since this token is not real whitespace, the writer may end up writing the literals together with no space between, just as if they'd been joined. However, if they don't fit together on the line, the writer will write the first one, start a new line, and write the second. Hence, the token acts as an optional line break. -
LITERAL
Anything else:foo,<b>,{@code foo}etc.JavadocLexersometimes creates adjacent literal tokens, which it then merges into a single, larger literal token before returning its output.This also includes whitespace in a
<pre>or<table>section. We preserve user formatting in these sections, including arbitrary numbers of spaces. By treating such whitespace as a literal, we can merge it with adjacent literals, preventing us from autowrapping inside these sections -- and doing so naively, to boot. The wrapped line would have no indentation after "* " or, possibly worse, it might begin with an arbitrary amount of whitespace that didn't fit on the previous line. Of course, by doing this, we're potentially creating lines of more than 100 characters. But it seems fair to call in the humans to resolve such problems.
-
-
Constructor Details
-
Type
private Type()
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-