improved sql formatter

This commit is contained in:
shaojin.wensj
2015-07-27 14:03:00 +08:00
parent afdf17b154
commit 29d0889d86
9 changed files with 153 additions and 7 deletions
@@ -77,6 +77,8 @@ public class Lexer {
protected boolean endOfComment = false;
protected boolean keepComments = false;
protected int line = 0;
public Lexer(String input){
this(input, null);
@@ -293,6 +295,10 @@ public class Lexer {
for (;;) {
if (isWhitespace(ch)) {
if (ch == '\n') {
line++;
}
scanChar();
continue;
}
@@ -827,6 +833,7 @@ public class Lexer {
for (;;) {
if (ch == '\r') {
if (charAt(pos + 1) == '\n') {
line++;
scanChar();
break;
}
@@ -835,6 +842,7 @@ public class Lexer {
}
if (ch == '\n') {
line++;
scanChar();
break;
}
@@ -1181,4 +1189,8 @@ public class Lexer {
}
comments.add(stringVal);
}
public int getLine() {
return line;
}
}