@InternalApi public interface Token
The available implementations of Token are primarily guided by the implementation of the tokenization
and the needs of the parser and included visitors. It does not distinguish all types of tokens. For example there is
QuotedIdentifierToken because the tokenization needs handling for
quoted identifiers, while a normal identifier is a GenericToken, because that is handled by the fallback
tokenization after checking for all other types. On the other hand, open and close curly braces, square brackets and
parentheses each have their own type, as the parser may need this to find nested contexts.
| Modifier and Type | Method and Description |
|---|---|
default void |
appendTo(java.lang.StringBuilder sb)
Appends the current token to the supplied String builder.
|
default boolean |
equalsIgnoreCase(java.lang.String tokenText)
Case-insensitive equality of this tokens text using an equivalent of
String.equalsIgnoreCase(String). |
default boolean |
isValidIdentifier()
Detects if the token is valid as an identifier (ignoring length constraints).
|
default boolean |
isWhitespaceOrComment() |
int |
length()
Token text length.
|
int |
position()
Token position.
|
java.lang.String |
text()
Token text.
|
default java.lang.CharSequence |
textAsCharSequence()
Token text as
CharSequence. |
java.lang.String text()
textAsCharSequence()default java.lang.CharSequence textAsCharSequence()
CharSequence.
Default implementation returns text(). As an optimization, implementations may return their contained
CharSequence to avoid unnecessary conversion to string.
text()default void appendTo(java.lang.StringBuilder sb)
sb - String builder to append toint position()
int length()
default boolean isWhitespaceOrComment()
true if this token is whitespace or a comment, false for all other tokensdefault boolean equalsIgnoreCase(java.lang.String tokenText)
String.equalsIgnoreCase(String).tokenText - Token text to comparetrue if tokenText is equal - ignoring case - to the text of this token,
false otherwisedefault boolean isValidIdentifier()
This will always return false for ReservedToken or other
specialised tokens (e.g. OperatorToken with IS or LIKE)
that can't occur as an identifier.
true if the token is valid as an identifier, false otherwiseCopyright © 2001-2024 Jaybird (Firebird JDBC) team. All rights reserved.