public class DdlTokenizer extends Object implements TokenStream.Tokenizer
TokenStream.Tokenizer that is specialized for tokenizing DDL streams.| Modifier and Type | Class and Description |
|---|---|
static interface |
DdlTokenizer.TokenTypeFunction |
| Modifier and Type | Field and Description |
|---|---|
static int |
COMMENT
The
token type for tokens that consist of all the characters
between "/*" and "*/", between "//" and the next line terminator (e.g., '\n', '\r' or "\r\n"), between "#" and
the next line terminator (e.g., '\n', '\r' or "\r\n"), or between "--" and
the next line terminator (e.g., '\n', '\r' or "\r\n"). |
static int |
DECIMAL
The
token type for tokens that consist of an individual '.'
character. |
static int |
DOUBLE_QUOTED_STRING
The
token type for tokens that consist of all the characters
within double-quotes. |
static int |
KEYWORD
The
token type for tokens that represent key words or
reserved words for a given DDL dialect. |
private boolean |
removeQuotes |
private DdlTokenizer.TokenTypeFunction |
retypingFunction |
static int |
SINGLE_QUOTED_STRING
The
token type for tokens that consist of all the characters
within single-quotes. |
static int |
STATEMENT_KEY
The
token type for tokens that represent the start of a DDL
statement. |
static int |
STATEMENT_TERMINATOR
The
token type for tokens that represent the end of a DDL statement. |
static int |
SYMBOL
The
token type for tokens that consist of an individual
"symbol" character. |
private boolean |
useComments |
static int |
WORD
The
token type for tokens that represent an unquoted string
containing a character sequence made up of non-whitespace and non-symbol characters. |
| Constructor and Description |
|---|
DdlTokenizer(boolean useComments) |
DdlTokenizer(boolean useComments,
DdlTokenizer.TokenTypeFunction retypingFunction) |
| Modifier and Type | Method and Description |
|---|---|
protected TokenStream.Tokens |
adapt(TokenStream.CharacterStream input,
TokenStream.Tokens output) |
boolean |
includeComments() |
void |
tokenize(TokenStream.CharacterStream input,
TokenStream.Tokens tokens)
Process the supplied characters and construct the appropriate
TokenStream.Token objects. |
public static final int WORD
token type for tokens that represent an unquoted string
containing a character sequence made up of non-whitespace and non-symbol characters.public static final int SYMBOL
token type for tokens that consist of an individual
"symbol" character. The set of characters includes: -(){}*,;+%?$[]!<>|=:public static final int DECIMAL
token type for tokens that consist of an individual '.'
character.public static final int SINGLE_QUOTED_STRING
token type for tokens that consist of all the characters
within single-quotes. Single quote characters are included if they are preceded (escaped) by a '\' character.public static final int DOUBLE_QUOTED_STRING
token type for tokens that consist of all the characters
within double-quotes. Double quote characters are included if they are preceded (escaped) by a '\' character.public static final int COMMENT
token type for tokens that consist of all the characters
between "/*" and "*/", between "//" and the next line terminator (e.g., '\n', '\r' or "\r\n"), between "#" and
the next line terminator (e.g., '\n', '\r' or "\r\n"), or between "--" and
the next line terminator (e.g., '\n', '\r' or "\r\n").public static final int KEYWORD
token type for tokens that represent key words or
reserved words for a given DDL dialect.
Examples would be: "CREATE", "TABLE", "ALTER", "SCHEMA", "DROP", etc...
public static final int STATEMENT_KEY
token type for tokens that represent the start of a DDL
statement.
Examples would be: {"CREATE", "TABLE"} {"CREATE", "OR", "REPLACE", "VIEW"}
public static final int STATEMENT_TERMINATOR
token type for tokens that represent the end of a DDL statement.private final boolean removeQuotes
private final boolean useComments
private final DdlTokenizer.TokenTypeFunction retypingFunction
public DdlTokenizer(boolean useComments)
public DdlTokenizer(boolean useComments,
DdlTokenizer.TokenTypeFunction retypingFunction)
public boolean includeComments()
protected TokenStream.Tokens adapt(TokenStream.CharacterStream input, TokenStream.Tokens output)
public void tokenize(TokenStream.CharacterStream input, TokenStream.Tokens tokens) throws ParsingException
TokenStream.TokenizerTokenStream.Token objects.tokenize in interface TokenStream.Tokenizerinput - the character input stream; never nulltokens - the factory for TokenStream.Token objects, which records the order in which the tokens are createdParsingException - if there is an error while processing the character stream (e.g., a quote is not closed, etc.)Copyright © 2019 JBoss by Red Hat. All rights reserved.