summaryrefslogtreecommitdiffstats
path: root/src/glsl/glcpp
diff options
context:
space:
mode:
authorCarl Worth <[email protected]>2010-08-23 09:31:42 -0700
committerCarl Worth <[email protected]>2010-08-23 10:48:10 -0700
commitc2280e63817238bb969b20605c7d8dab4ddf1721 (patch)
tree3bbe17a4792a834c63cbb75a6bdd11e10ce16cf8 /src/glsl/glcpp
parentff10d239af3b48f4ba13a0ef947e97d3302ea818 (diff)
glcpp: Fix handling of "#line 0"
The existing DECIMAL_INTEGER pattern is the correct thing to use when looking for a C decimal integer, (that is, a digit-sequence not starting with 0 which would instead be an octal integer). But for #line, we really want to accept any digit sequence, (including "0"), and always interpret it as a decimal constant. So we add a new DIGITS pattern for this case. This should fix the compilation failure noted in bug #28138 https://bugs.freedesktop.org/show_bug.cgi?id=28138 (Though the generated file will not be updated until the next commit.)
Diffstat (limited to 'src/glsl/glcpp')
-rw-r--r--src/glsl/glcpp/glcpp-lex.l5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index a90430f255b..8eb84ed138a 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -68,6 +68,7 @@ IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]*
PUNCTUATION [][(){}.&*~!/%<>^|;,=+-]
OTHER [^][(){}.&*~!/%<>^|;,=#[:space:]+-]+
+DIGITS [0-9][0-9]*
DECIMAL_INTEGER [1-9][0-9]*[uU]?
OCTAL_INTEGER 0[0-7]*[uU]?
HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
@@ -105,7 +106,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
return OTHER;
}
-{HASH}line{HSPACE}+{DECIMAL_INTEGER}{HSPACE}+{DECIMAL_INTEGER}{HSPACE}*$ {
+{HASH}line{HSPACE}+{DIGITS}{HSPACE}+{DIGITS}{HSPACE}*$ {
/* Eat characters until the first digit is
* encountered
*/
@@ -121,7 +122,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
yylloc->source = strtol(ptr, NULL, 0);
}
-{HASH}line{HSPACE}+{DECIMAL_INTEGER}{HSPACE}*$ {
+{HASH}line{HSPACE}+{DIGITS}{HSPACE}*$ {
/* Eat characters until the first digit is
* encountered
*/