SPACE [[:space:]]
NONSPACE [^[:space:]]
-NEWLINE [\n]
HSPACE [ \t]
HASH #
IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]*
}
/* Single-line comments */
-"//"[^\n]* {
+"//"[^\r\n]* {
}
/* Multi-line comments */
-<DEFINE,HASH,INITIAL>"/*" { yy_push_state(COMMENT, yyscanner); }
-<COMMENT>[^*\n]*
-<COMMENT>[^*\n]*\n { yylineno++; yycolumn = 0; parser->commented_newlines++; }
-<COMMENT>"*"+[^*/\n]*
-<COMMENT>"*"+[^*/\n]*\n { yylineno++; yycolumn = 0; parser->commented_newlines++; }
+<DEFINE,HASH,INITIAL>"/*" { yy_push_state(COMMENT, yyscanner); }
+<COMMENT>[^*\r\n]*
+<COMMENT>[^*\r\n]*[\r\n] { yylineno++; yycolumn = 0; parser->commented_newlines++; }
+<COMMENT>"*"+[^*/\r\n]*
+<COMMENT>"*"+[^*/\r\n]*[\r\n] { yylineno++; yycolumn = 0; parser->commented_newlines++; }
<COMMENT>"*"+"/" {
yy_pop_state(yyscanner);
/* In the <HASH> start condition, we don't want any SPACE token. */
/* glcpp doesn't handle #extension, #version, or #pragma directives.
* Simply pass them through to the main compiler's lexer/parser. */
-<HASH>(extension|pragma)[^\n]* {
+<HASH>(extension|pragma)[^\r\n]* {
BEGIN INITIAL;
yylineno++;
yycolumn = 0;
/* We preserve all newlines, even between #if 0..#endif, so no
skipping.. */
-\n {
+[\r\n] {
if (parser->commented_newlines) {
BEGIN NEWLINE_CATCHUP;
}