Skip to content
Permalink
Browse files
Handle lexing of comment ends better.
  • Loading branch information
icculus committed Feb 13, 2009
1 parent 340a522 commit 7112782cb7cc842bdc63a4ad279ef3552fe332c6
Showing with 5 additions and 2 deletions.
  1. +5 −2 mojoshader_lexer.re
@@ -42,6 +42,7 @@ Token preprocessor_internal_lexer(IncludeState *s)
{
const uchar *cursor = (const uchar *) s->source;
const uchar *token;
const uchar *matchptr;
const uchar *limit = cursor + s->bytes_left;
int saw_newline = 0;

@@ -150,6 +151,7 @@ scanner_loop:
multilinecomment:
if (YYLIMIT == YYCURSOR)
RET(TOKEN_PP_INCOMPLETE_COMMENT);
matchptr = cursor;
// The "*\/" is just to avoid screwing up text editor syntax highlighting.
/*!re2c
"*\/" {
@@ -159,7 +161,7 @@ multilinecomment:
}
NEWLINE {
s->line++;
token = cursor-1;
token = matchptr;
saw_newline = 1;
goto multilinecomment;
}
@@ -169,8 +171,9 @@ multilinecomment:
singlelinecomment:
if (YYLIMIT == YYCURSOR)
RET(TOKEN_EOI);
matchptr = cursor;
/*!re2c
NEWLINE { s->line++; token = cursor-1; RET('\n'); }
NEWLINE { s->line++; token = matchptr; RET('\n'); }
any { goto singlelinecomment; }
*/

0 comments on commit 7112782

Please sign in to comment.