OSDN Git Service

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 6bf7950..188e454 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 696cb3a..1f2320e 100644 (file)
@@ -1 +1 @@
-this is  four  tokens
+   this is  four       tokens  with spaces
index 6cfac25..36f98aa 100644 (file)
@@ -2,7 +2,7 @@
 
 
 switch (1) {
- case 1 + 2:
- break;
  case 1 + 2:
     break;
 }