add wall support

This commit is contained in:
温少
2012-03-15 13:11:53 +08:00
parent 123385f74a
commit 5f80737ead
3 changed files with 42 additions and 5 deletions
@@ -53,7 +53,7 @@ public class Lexer {
protected int tokenPos;
/** A character buffer for literals. */
protected final static ThreadLocal<char[]> sbufRef = new ThreadLocal<char[]>();
protected final static ThreadLocal<char[]> sbufRef = new ThreadLocal<char[]>();
protected char[] sbuf;
/** string point as size */
@@ -62,25 +62,38 @@ public class Lexer {
/** string point as offset */
protected int np;
protected SymbolTable symbolTable = new SymbolTable();
protected SymbolTable symbolTable = new SymbolTable();
/**
* The token, set by nextToken().
*/
protected Token token;
protected Keywords keywods = Keywords.DEFAULT_KEYWORDS;
protected Keywords keywods = Keywords.DEFAULT_KEYWORDS;
protected String stringVal;
protected boolean skipComment = true;
protected boolean skipComment = true;
private SavePoint savePoint = null;
private SavePoint savePoint = null;
/*
* anti sql injection
*/
private boolean allowComment = true;
public Lexer(String input){
this(input, true);
}
public boolean isAllowComment() {
return allowComment;
}
public void setAllowComment(boolean allowComment) {
this.allowComment = allowComment;
}
private static class SavePoint {
int bp;
@@ -575,6 +588,10 @@ public class Lexer {
}
public void scanComment() {
if (!allowComment) {
throw new NotAllowCommentException();
}
if (ch != '/') {
throw new IllegalStateException();
}