glsl/glcpp: Allow single-line comments immediately after #define
authorCarl Worth <cworth@cworth.org>
Wed, 2 Jul 2014 00:47:29 +0000 (17:47 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 7 Aug 2014 23:08:29 +0000 (16:08 -0700)
We were already correctly supporting single-line comments in case like:

#define FOO bar // comment here...

The new support added here is simply for the none-too-useful:

#define // comment instead of macro name

With this commit, this line will now give the expected "#define without
macro name" error message instead of the lexer just going off into the
weeds.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/glcpp/glcpp-lex.l

index 6e197d12a1a1d3142d780582f9a6d9dbd8988e72..2cfe203dacfa367d3ccbd60be4f7874b1b30ea8e 100644 (file)
@@ -250,7 +250,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
        }
 
        /* Single-line comments */
-"//"[^\r\n]* {
+<INITIAL,DEFINE>"//"[^\r\n]* {
 }
 
        /* Multi-line comments */