mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add wall support
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user