mojoshader_lexer.re
changeset 1142 7b554e065321
parent 1123 3d842e7dd6ad
child 1147 ff14a55da268
--- a/mojoshader_lexer.re	Mon Jun 23 14:56:00 2014 -0400
+++ b/mojoshader_lexer.re	Thu Oct 02 15:54:31 2014 -0400
@@ -172,6 +172,18 @@
                             RET(TOKEN_MULTI_COMMENT);
                         else if (s->report_whitespace)
                             RET(' ');
+
+                        // Microsoft's preprocessor allows multiline comments
+                        //  before a preprocessor directive, even though C/C++
+                        //  doesn't. See if we've hit this case.
+                        #if MATCH_MICROSOFT_PREPROCESSOR
+                        if (s->tokenval == ((Token) '\n'))  // was start of line?
+                        {
+                            update_state(s, eoi, cursor, token, (Token) '\n');
+                            goto ppdirective;  // may jump back to scanner_loop.
+                        }
+                        #endif
+
                         goto scanner_loop;
                     }
     NEWLINE         {