fixed lexer to properly read fortran-notation double constants
This commit is contained in:
26
lex.ll
26
lex.ll
@@ -345,7 +345,9 @@ INT_NUMBER (([0-9]+)|(0x[0-9a-fA-F]+)|(0b[01]+))[uUlL]*[kMG]?[uUlL]*
|
||||
INT_NUMBER_DOTDOTDOT (([0-9]+)|(0x[0-9a-fA-F]+)|(0b[01]+))[uUlL]*[kMG]?[uUlL]*\.\.\.
|
||||
FLOAT_NUMBER (([0-9]+|(([0-9]+\.[0-9]*[fF]?)|(\.[0-9]+)))([eE][-+]?[0-9]+)?[fF]?)
|
||||
HEX_FLOAT_NUMBER (0x[01](\.[0-9a-fA-F]*)?p[-+]?[0-9]+[fF]?)
|
||||
FORTRAN_DOUBLE_NUMBER (([0-9]+\.[0-9]*[dD])|([0-9]+\.[0-9]*[dD][-+]?[0-9])|([0-9]+[dD][-+]?[0-9]))
|
||||
FORTRAN_DOUBLE_NUMBER (([0-9]+\.[0-9]*[dD])|([0-9]+\.[0-9]*[dD][-+]?[0-9]+)|([0-9]+[dD][-+]?[0-9]+))
|
||||
|
||||
|
||||
|
||||
IDENT [a-zA-Z_][a-zA-Z_0-9]*
|
||||
ZO_SWIZZLE ([01]+[w-z]+)+|([01]+[rgba]+)+|([01]+[uv]+)+
|
||||
@@ -440,6 +442,16 @@ L?\"(\\.|[^\\"])*\" { lStringConst(&yylval, &yylloc); return TOKEN_STRING_LITERA
|
||||
return lParseInteger(true);
|
||||
}
|
||||
|
||||
{FORTRAN_DOUBLE_NUMBER} {
|
||||
RT;
|
||||
{
|
||||
int i = 0;
|
||||
while (yytext[i] != 'd') i++;
|
||||
yytext[i] = 'E';
|
||||
}
|
||||
yylval.doubleVal = atof(yytext);
|
||||
return TOKEN_DOUBLE_CONSTANT;
|
||||
}
|
||||
|
||||
|
||||
{FLOAT_NUMBER} {
|
||||
@@ -454,18 +466,6 @@ L?\"(\\.|[^\\"])*\" { lStringConst(&yylval, &yylloc); return TOKEN_STRING_LITERA
|
||||
return TOKEN_FLOAT_CONSTANT;
|
||||
}
|
||||
|
||||
{FORTRAN_DOUBLE_NUMBER} {
|
||||
RT;
|
||||
{
|
||||
int i = 0;
|
||||
while (yytext[i] != 'd') i++;
|
||||
if ((yytext[i+1] >= '0' && yytext[i+1] <= '9')
|
||||
|| yytext[i+1] == '+' || yytext[i+1] == '-')
|
||||
yytext[i] = 'E';
|
||||
}
|
||||
yylval.doubleVal = atof(yytext);
|
||||
return TOKEN_DOUBLE_CONSTANT;
|
||||
}
|
||||
|
||||
|
||||
"++" { RT; return TOKEN_INC_OP; }
|
||||
|
||||
@@ -2564,7 +2564,7 @@ static inline float acos(float v) {
|
||||
|
||||
__declspec(safe)
|
||||
static inline double acos(const double v) {
|
||||
return 1.57079637050628662109375 - asin(v);
|
||||
return 1.57079637050628662109375d0 - asin(v);
|
||||
}
|
||||
|
||||
|
||||
@@ -2575,7 +2575,7 @@ static inline uniform float acos(uniform float v) {
|
||||
|
||||
__declspec(safe)
|
||||
static inline uniform double acos(const uniform double v) {
|
||||
return 1.57079637050628662109375 - asin(v);
|
||||
return 1.57079637050628662109375d0 - asin(v);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user