glcpp: Do not remove spaces to preserve locations.
authorSir Anthony <anthony@adsorbtion.org>
Wed, 5 Feb 2014 14:15:56 +0000 (20:15 +0600)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 8 Mar 2014 09:38:32 +0000 (01:38 -0800)
After preprocessing by glcpp all adjacent spaces were replaced by
single one and glsl parser received column-shifted shader source.
It negatively affected ast location set up and produced wrong error
messages for heavily-spaced shaders.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/glcpp/glcpp-lex.l
src/glsl/glcpp/tests/000-content-with-spaces.c
src/glsl/glcpp/tests/000-content-with-spaces.c.expected
src/glsl/glcpp/tests/100-macro-with-colon.c.expected

index 6bf7950412f7ddf7a85f1aa106c4b6eed46ffe9d..188e454664ae1e6f6c4a3dc1421614ae2b389da2 100644 (file)
@@ -338,7 +338,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
        return OTHER;
 }
 
-{HSPACE}+ {
+{HSPACE} {
        if (yyextra->space_tokens) {
                return SPACE;
        }
index 696cb3a74fc2003863adb1157c5715e269fb3c3b..1f2320e6fc1bb4628b18e12cef0c5c8662af037f 100644 (file)
@@ -1 +1 @@
-this is  four  tokens
+   this is  four       tokens  with spaces
index 83f7834d547031febd71e302e3453fbb3d821ab1..5e17ec910fab28ad638e8bc2a86593d690adb589 100644 (file)
@@ -1,2 +1,2 @@
-this is four tokens
+   this is  four  tokens  with spaces
 
index 6cfac257b950654bd435304f25748111e6bda869..36f98aa3efcd008a7041e4cc7da563dbe651ebce 100644 (file)
@@ -2,7 +2,7 @@
 
 
 switch (1) {
- case 1 + 2:
- break;
  case 1 + 2:
     break;
 }