Clarified the syntax for real number literals. 1.0 is the same precision as AcReal, 1.0f is an explicit float and 1.0d is an explicit double.

This commit is contained in:
jpekkila
2019-10-07 18:24:32 +03:00
parent aa6c2b23d9
commit ff12332f06
4 changed files with 184 additions and 171 deletions

View File

@@ -14,7 +14,7 @@ int yyget_lineno();
%}
%token CONSTANT IN OUT UNIFORM
%token IDENTIFIER NUMBER REAL_NUMBER
%token IDENTIFIER NUMBER REAL_NUMBER DOUBLE_NUMBER
%token RETURN
%token SCALAR VECTOR MATRIX SCALARFIELD SCALARARRAY
%token VOID INT INT3 COMPLEX
@@ -222,6 +222,7 @@ identifier: IDENTIFIER
;
number: REAL_NUMBER { $$ = astnode_create(NODE_REAL_NUMBER, NULL, NULL); astnode_set_buffer(yytext, $$); }
| DOUBLE_NUMBER { $$ = astnode_create(NODE_UNKNOWN, NULL, NULL); astnode_set_buffer(yytext, $$); $$->buffer[strlen($$->buffer) - 1] = '\0'; }
| NUMBER { $$ = astnode_create(NODE_UNKNOWN, NULL, NULL); astnode_set_buffer(yytext, $$); }
;