Make the skip count correct (even if not used currently)

This commit is contained in:
Jean Pierre Cimalando 2020-04-20 22:59:00 +02:00
parent 605e552a25
commit 353cea949e

View file

@ -389,20 +389,21 @@ size_t Parser::skipComment()
switch (commentType) { switch (commentType) {
case CommentType::Line: case CommentType::Line:
{ while (!terminated) {
int c; int c = reader.getChar();
while ((c = reader.getChar()) != Reader::kEof && c != '\r' && c != '\n') count += (c != Reader::kEof);
++count; terminated = c == Reader::kEof || c == '\r' || c == '\n';
terminated = true;
} }
break; break;
case CommentType::Block: case CommentType::Block:
{ {
int c1 = 0; int c1 = 0;
int c2 = reader.getChar(); int c2 = reader.getChar();
count += (c2 != Reader::kEof);
while (!terminated && c2 != Reader::kEof) { while (!terminated && c2 != Reader::kEof) {
c1 = c2; c1 = c2;
c2 = reader.getChar(); c2 = reader.getChar();
count += (c2 != Reader::kEof);
terminated = c1 == '*' && c2 == '/'; terminated = c1 == '*' && c2 == '/';
} }
} }