mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
修复单行、多行注释未正常结尾的bug。
原代码Lexer.java的nextToken处理注释的for循环在注释未正常结尾的时候没有及时退出。 如select a.id,--single comment a.name,单行注释结尾符应该是\r\n或\n。同理,多行注释结尾应该是*/。
This commit is contained in:
@@ -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++;
|
||||
|
||||
Reference in New Issue
Block a user