mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
增强测试
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@984 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -76,10 +76,39 @@ public class Lexer {
|
||||
|
||||
protected boolean skipComment = true;
|
||||
|
||||
private SavePoint savePoint = null;
|
||||
|
||||
public Lexer(String input){
|
||||
this(input, true);
|
||||
}
|
||||
|
||||
private static class SavePoint {
|
||||
|
||||
int bp;
|
||||
int sp;
|
||||
int np;
|
||||
char ch;
|
||||
Token token;
|
||||
}
|
||||
|
||||
public void mark() {
|
||||
SavePoint savePoint = new SavePoint();
|
||||
savePoint.bp = bp;
|
||||
savePoint.sp = sp;
|
||||
savePoint.np = np;
|
||||
savePoint.ch = ch;
|
||||
savePoint.token = token;
|
||||
this.savePoint = savePoint;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.bp = savePoint.bp;
|
||||
this.sp = savePoint.sp;
|
||||
this.np = savePoint.np;
|
||||
this.ch = savePoint.ch;
|
||||
this.token = savePoint.token;
|
||||
}
|
||||
|
||||
public Lexer(String input, boolean skipComment){
|
||||
this(input.toCharArray(), input.length(), skipComment);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user