mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Lexer add new API
This commit is contained in:
@@ -1151,6 +1151,49 @@ public class Lexer {
|
||||
nextToken();
|
||||
}
|
||||
|
||||
public final boolean skipToNextLine(int startPosition) {
|
||||
for (int i = 0; ; ++i) {
|
||||
int pos = startPosition + i;
|
||||
char ch = charAt(pos);
|
||||
if (ch == '\n') {
|
||||
this.pos = pos;
|
||||
this.ch = charAt(this.pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ch == EOI) {
|
||||
this.pos = pos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public final boolean skipToNextLineOrParameter(int startPosition) {
|
||||
for (int i = 0; ; ++i) {
|
||||
int pos = startPosition + i;
|
||||
char ch = charAt(pos);
|
||||
if (ch == '\n') {
|
||||
this.pos = pos;
|
||||
this.ch = charAt(this.pos);
|
||||
return true;
|
||||
}
|
||||
if (ch == '$' && charAt(pos + 1) == '{') {
|
||||
this.pos = pos;
|
||||
this.ch = charAt(this.pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ch == EOI) {
|
||||
this.pos = pos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public final void nextToken() {
|
||||
startPos = pos;
|
||||
bufPos = 0;
|
||||
|
||||
Reference in New Issue
Block a user