OSDN Git Service

glcpp: Support #if(expression) with no intervening space.
authorCarl Worth <cworth@cworth.org>
Tue, 20 Jul 2010 20:16:17 +0000 (13:16 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 21 Jul 2010 00:01:11 +0000 (17:01 -0700)
And add a test case to ensure that this works.

src/glsl/glcpp/glcpp-lex.l
src/glsl/glcpp/tests/066-if-nospace-expression.c [new file with mode: 0644]
src/glsl/glcpp/tests/066-if-nospace-expression.c.expected [new file with mode: 0644]

index 53e8555..a81c8f9 100644 (file)
@@ -99,7 +99,7 @@ HEXADECIMAL_INTEGER   0[xX][0-9a-fA-F]+[uU]?
        return HASH_IFNDEF;
 }
 
-{HASH}if{HSPACE}/.*\n {
+{HASH}if{HSPACE}*/[^_a-zA-Z0-9].*\n {
        yyextra->lexing_if = 1;
        yyextra->space_tokens = 0;
        return HASH_IF;
diff --git a/src/glsl/glcpp/tests/066-if-nospace-expression.c b/src/glsl/glcpp/tests/066-if-nospace-expression.c
new file mode 100644 (file)
index 0000000..3b0b473
--- /dev/null
@@ -0,0 +1,3 @@
+#if(1)
+success
+#endif
diff --git a/src/glsl/glcpp/tests/066-if-nospace-expression.c.expected b/src/glsl/glcpp/tests/066-if-nospace-expression.c.expected
new file mode 100644 (file)
index 0000000..0e84a7c
--- /dev/null
@@ -0,0 +1,4 @@
+
+success
+
+