mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
egg: Fix egg lexer hanging on unterminated quote or C-style comment
This commit is contained in:
parent
748dd61615
commit
5d5efb75e8
@ -1195,12 +1195,12 @@ scan_quoted_string() {
|
||||
|
||||
int c;
|
||||
c = read_char(line, col);
|
||||
while (c != '"' && c != EOF) {
|
||||
while (c != '"' && c != 0 && c != EOF) {
|
||||
result += c;
|
||||
c = read_char(line, col);
|
||||
}
|
||||
|
||||
if (c == EOF) {
|
||||
if (c == 0 || c == EOF) {
|
||||
eggyyerror("This quotation mark is unterminated.");
|
||||
}
|
||||
|
||||
@ -1224,7 +1224,7 @@ eat_c_comment() {
|
||||
|
||||
last_c = '\0';
|
||||
c = read_char(line, col);
|
||||
while (c != EOF && !(last_c == '*' && c == '/')) {
|
||||
while (c != 0 && c != EOF && !(last_c == '*' && c == '/')) {
|
||||
if (last_c == '/' && c == '*') {
|
||||
std::ostringstream errmsg;
|
||||
errmsg << "This comment contains a nested /* symbol at line "
|
||||
@ -1236,7 +1236,7 @@ eat_c_comment() {
|
||||
c = read_char(line, col);
|
||||
}
|
||||
|
||||
if (c == EOF) {
|
||||
if (c == 0 || c == EOF) {
|
||||
eggyyerror("This comment marker is unclosed.");
|
||||
}
|
||||
|
||||
|
@ -250,12 +250,12 @@ scan_quoted_string() {
|
||||
|
||||
int c;
|
||||
c = read_char(line, col);
|
||||
while (c != '"' && c != EOF) {
|
||||
while (c != '"' && c != 0 && c != EOF) {
|
||||
result += c;
|
||||
c = read_char(line, col);
|
||||
}
|
||||
|
||||
if (c == EOF) {
|
||||
if (c == 0 || c == EOF) {
|
||||
eggyyerror("This quotation mark is unterminated.");
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ eat_c_comment() {
|
||||
|
||||
last_c = '\0';
|
||||
c = read_char(line, col);
|
||||
while (c != EOF && !(last_c == '*' && c == '/')) {
|
||||
while (c != 0 && c != EOF && !(last_c == '*' && c == '/')) {
|
||||
if (last_c == '/' && c == '*') {
|
||||
std::ostringstream errmsg;
|
||||
errmsg << "This comment contains a nested /* symbol at line "
|
||||
@ -291,7 +291,7 @@ eat_c_comment() {
|
||||
c = read_char(line, col);
|
||||
}
|
||||
|
||||
if (c == EOF) {
|
||||
if (c == 0 || c == EOF) {
|
||||
eggyyerror("This comment marker is unclosed.");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user