Lexer now handles '\\' continuation at the end of a line.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 15 Feb 2009 02:51:39 -0500
changeset 631 5045dcc9fdaf
parent 630 e6bd53dd1f91
child 632 a5f63a10ed91
child 634 b7fd8aa02bf4
Lexer now handles '\\' continuation at the end of a line.
mojoshader_lexer.re
mojoshader_preprocessor.c
--- a/mojoshader_lexer.re	Sun Feb 15 02:49:40 2009 -0500
+++ b/mojoshader_lexer.re	Sun Feb 15 02:51:39 2009 -0500
@@ -69,6 +69,8 @@
 */
 
 /*!re2c
+    "\\" [ \t\v\f]* NEWLINE  { s->line++; goto scanner_loop; }
+
     "/*"            { goto multilinecomment; }
     "//"            { goto singlelinecomment; }
 
@@ -83,7 +85,7 @@
     
     (["] (ESC|ANY\[\r\n\\"])* ["])
                     { RET(TOKEN_STRING_LITERAL); }
-    
+
     ">>="           { RET(TOKEN_RSHIFTASSIGN); }
     "<<="           { RET(TOKEN_LSHIFTASSIGN); }
     "+="            { RET(TOKEN_ADDASSIGN); }
@@ -129,7 +131,6 @@
     "}"             { RET('}'); }
     "="             { RET('='); }
     "?"             { RET('?'); }
-    "\\"            { RET('\\'); }
 
     PP "include"    { RET(TOKEN_PP_INCLUDE); }
     PP "line"       { RET(TOKEN_PP_LINE); }
--- a/mojoshader_preprocessor.c	Sun Feb 15 02:49:40 2009 -0500
+++ b/mojoshader_preprocessor.c	Sun Feb 15 02:51:39 2009 -0500
@@ -568,10 +568,6 @@
 } // preprocessor_outofmemory
 
 
-// !!! FIXME: (almost?) all preprocessor directives can end a line with a
-// !!! FIXME:  '\\' to continue to the next line.
-
-
 static int require_newline(IncludeState *state)
 {
     const char *source = state->source;