修复单行、多行注释未正常结尾的bug。

原代码Lexer.java的nextToken处理注释的for循环在注释未正常结尾的时候没有及时退出。

如select a.id,--single comment a.name,单行注释结尾符应该是\r\n或\n。同理,多行注释结尾应该是*/。
This commit is contained in:
huangtiande
2014-12-25 18:10:54 +08:00
parent 6c02ffec9d
commit 883d1fde6d
2 changed files with 90 additions and 1 deletions
@@ -770,7 +770,11 @@ public class Lexer {
scanChar();
break;
}
// multiline comment结束符错误
if (ch == EOI) {
throw new ParserException("unterminated /* comment.");
}
scanChar();
bufPos++;
}
@@ -800,6 +804,11 @@ public class Lexer {
scanChar();
break;
}
// single line comment结束符错误
if (ch == EOI) {
throw new ParserException("syntax error at end of input.");
}
scanChar();
bufPos++;