| java.lang.Object com.versant.core.jdo.tools.ant.SQLScriptParser
SQLScriptParser | public class SQLScriptParser (Code) | | Use this class like this:
SQLScriptParser shredder = new SQLScriptParser();
ArrayList list = shredder.parse(sql,true);
for (Iterator iter = list.iterator(); iter.hasNext();) {
SQLScriptPart scriptPart = (SQLScriptPart) iter.next();
System.out.println("start = "+ scriptPart.getStart());
System.out.println("end = "+ scriptPart.getEnd());
System.out.println( scriptPart.getSql());
}
|
Inner Class :public static class SQLScriptPart | |
Inner Class :public static class Token | |
Field Summary | |
final public static int | COMMENT | final public static int | YYEOF | final public static int | YYINITIAL |
Method Summary | |
public Token | getNextToken(boolean returnComments, boolean returnWhiteSpace) next Token method that allows you to control if whitespace and comments are
returned as tokens. | public Token | getNextToken() Resumes scanning until the next regular expression is matched,
the end of input is encountered or an I/O-Error occurs. | public static void | main(String[] args) Prints out tokens from a file or System.in. | public ArrayList | parse(String sql, boolean eraseNewLine) | public void | reset(java.io.Reader reader, int yyline, int yychar, int yycolumn) Closes the current input stream, and resets the scanner to read from a new input stream. | public void | setReader(java.io.Reader in) | final public void | yybegin(int newState) | final public char | yycharat(int pos) Returns the character at position pos from the
matched text.
It is equivalent to yytext().charAt(pos), but faster
Parameters: pos - the position of the character to fetch.A value from 0 to yylength()-1. | final public void | yyclose() Closes the input stream. | final public int | yylength() Returns the length of the matched text region. | final public void | yyreset(java.io.Reader reader) Closes the current stream, and resets the
scanner to read from a new input stream. | final public int | yystate() Returns the current lexical state. | final public String | yytext() Returns the text matched by the current regular expression. |
COMMENT | final public static int COMMENT(Code) | | |
YYEOF | final public static int YYEOF(Code) | | This character denotes the end of file
|
YYINITIAL | final public static int YYINITIAL(Code) | | lexical states
|
SQLScriptParser | public SQLScriptParser()(Code) | | |
SQLScriptParser | public SQLScriptParser(java.io.Reader in)(Code) | | Creates a new scanner
There is also a java.io.InputStream version of this constructor.
Parameters: in - the java.io.Reader to read input from. |
SQLScriptParser | public SQLScriptParser(java.io.InputStream in)(Code) | | Creates a new scanner.
There is also java.io.Reader version of this constructor.
Parameters: in - the java.io.Inputstream to read input from. |
getNextToken | public Token getNextToken(boolean returnComments, boolean returnWhiteSpace) throws IOException(Code) | | next Token method that allows you to control if whitespace and comments are
returned as tokens.
|
getNextToken | public Token getNextToken() throws java.io.IOException(Code) | | Resumes scanning until the next regular expression is matched,
the end of input is encountered or an I/O-Error occurs.
the next token exception: IOException - if any I/O-Error occurs |
main | public static void main(String[] args)(Code) | | Prints out tokens from a file or System.in.
If no arguments are given, System.in will be used for input.
If more arguments are given, the first argument will be used as
the name of the file to use as input
Parameters: args - program arguments, of which the first is a filename |
reset | public void reset(java.io.Reader reader, int yyline, int yychar, int yycolumn) throws IOException(Code) | | Closes the current input stream, and resets the scanner to read from a new input stream.
All internal variables are reset, the old input stream cannot be reused
(content of the internal buffer is discarded and lost).
The lexical state is set to the initial state.
Subsequent tokens read from the lexer will start with the line, char, and column
values given here.
Parameters: reader - The new input. Parameters: yyline - The line number of the first token. Parameters: yychar - The position (relative to the start of the stream) of the first token. Parameters: yycolumn - The position (relative to the line) of the first token. throws: IOException - if an IOExecption occurs while switching readers. |
yybegin | final public void yybegin(int newState)(Code) | | Enters a new lexical state
Parameters: newState - the new lexical state |
yycharat | final public char yycharat(int pos)(Code) | | Returns the character at position pos from the
matched text.
It is equivalent to yytext().charAt(pos), but faster
Parameters: pos - the position of the character to fetch.A value from 0 to yylength()-1. the character at position pos |
yylength | final public int yylength()(Code) | | Returns the length of the matched text region.
|
yyreset | final public void yyreset(java.io.Reader reader) throws java.io.IOException(Code) | | Closes the current stream, and resets the
scanner to read from a new input stream.
All internal variables are reset, the old input stream
cannot be reused (internal buffer is discarded and lost).
Lexical state is set to YY_INITIAL.
Parameters: reader - the new input stream |
yystate | final public int yystate()(Code) | | Returns the current lexical state.
|
yytext | final public String yytext()(Code) | | Returns the text matched by the current regular expression.
|
|
|