[Mesa-dev] [PATCH] glcpp: Do not remove spaces to preserve locations.
Sir Anthony
anthony at adsorbtion.org
Wed Feb 5 06:15:56 PST 2014
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.
---
src/glsl/glcpp/glcpp-lex.l | 2 +-
src/glsl/glcpp/tests/000-content-with-spaces.c | 2 +-
src/glsl/glcpp/tests/000-content-with-spaces.c.expected | 2 +-
src/glsl/glcpp/tests/100-macro-with-colon.c.expected | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index ea3b862..c0709a2 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -337,7 +337,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
return OTHER;
}
-{HSPACE}+ {
+{HSPACE} {
if (yyextra->space_tokens) {
return SPACE;
}
diff --git a/src/glsl/glcpp/tests/000-content-with-spaces.c b/src/glsl/glcpp/tests/000-content-with-spaces.c
index 696cb3a..1f2320e 100644
--- a/src/glsl/glcpp/tests/000-content-with-spaces.c
+++ b/src/glsl/glcpp/tests/000-content-with-spaces.c
@@ -1 +1 @@
-this is four tokens
+ this is four tokens with spaces
diff --git a/src/glsl/glcpp/tests/000-content-with-spaces.c.expected b/src/glsl/glcpp/tests/000-content-with-spaces.c.expected
index 83f7834..5e17ec9 100644
--- a/src/glsl/glcpp/tests/000-content-with-spaces.c.expected
+++ b/src/glsl/glcpp/tests/000-content-with-spaces.c.expected
@@ -1,2 +1,2 @@
-this is four tokens
+ this is four tokens with spaces
diff --git a/src/glsl/glcpp/tests/100-macro-with-colon.c.expected b/src/glsl/glcpp/tests/100-macro-with-colon.c.expected
index 6cfac25..36f98aa 100644
--- a/src/glsl/glcpp/tests/100-macro-with-colon.c.expected
+++ b/src/glsl/glcpp/tests/100-macro-with-colon.c.expected
@@ -2,7 +2,7 @@
switch (1) {
- case 1 + 2:
- break;
+ case 1 + 2:
+ break;
}
--
1.8.3.2
More information about the mesa-dev
mailing list