changed lexer/parser to be able to read float constants, if they have "f"-suffix
This commit is contained in:
11
parse.yy
11
parse.yy
@@ -149,7 +149,8 @@ struct ForeachDimension {
|
||||
|
||||
%union {
|
||||
uint64_t intVal;
|
||||
double floatVal;
|
||||
float floatVal;
|
||||
double doubleVal;
|
||||
std::string *stringVal;
|
||||
const char *constCharPtr;
|
||||
|
||||
@@ -185,7 +186,7 @@ struct ForeachDimension {
|
||||
%token TOKEN_INT64_CONSTANT TOKEN_UINT64_CONSTANT
|
||||
%token TOKEN_INT32DOTDOTDOT_CONSTANT TOKEN_UINT32DOTDOTDOT_CONSTANT
|
||||
%token TOKEN_INT64DOTDOTDOT_CONSTANT TOKEN_UINT64DOTDOTDOT_CONSTANT
|
||||
%token TOKEN_FLOAT_CONSTANT TOKEN_STRING_C_LITERAL
|
||||
%token TOKEN_FLOAT_CONSTANT TOKEN_DOUBLE_CONSTANT TOKEN_STRING_C_LITERAL
|
||||
%token TOKEN_IDENTIFIER TOKEN_STRING_LITERAL TOKEN_TYPE_NAME TOKEN_NULL
|
||||
%token TOKEN_PTR_OP TOKEN_INC_OP TOKEN_DEC_OP TOKEN_LEFT_OP TOKEN_RIGHT_OP
|
||||
%token TOKEN_LE_OP TOKEN_GE_OP TOKEN_EQ_OP TOKEN_NE_OP
|
||||
@@ -326,9 +327,13 @@ primary_expression
|
||||
(uint64_t)yylval.intVal, @1);
|
||||
}
|
||||
| TOKEN_FLOAT_CONSTANT {
|
||||
$$ = new ConstExpr(AtomicType::UniformDouble->GetAsConstType(),
|
||||
$$ = new ConstExpr(AtomicType::UniformFloat->GetAsConstType(),
|
||||
yylval.floatVal, @1);
|
||||
}
|
||||
| TOKEN_DOUBLE_CONSTANT {
|
||||
$$ = new ConstExpr(AtomicType::UniformDouble->GetAsConstType(),
|
||||
yylval.doubleVal, @1);
|
||||
}
|
||||
| TOKEN_TRUE {
|
||||
$$ = new ConstExpr(AtomicType::UniformBool->GetAsConstType(), true, @1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user