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.)
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]?
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
*/
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
*/