Merge remote-tracking branch 'origin/main' into 91-allow-to-parse-multiple-files

# Conflicts:
#	src/yacc/parser.y
This commit is contained in:
Sven Vogel 2024-05-30 21:53:30 +02:00
commit b9d8b23601
2 changed files with 7 additions and 4 deletions

View File

@ -52,6 +52,7 @@
"float" {DEBUG("\"%s\" tokenized with \'KeyFloat\'", yytext); return(KeyFloat);}; "float" {DEBUG("\"%s\" tokenized with \'KeyFloat\'", yytext); return(KeyFloat);};
"self" {DEBUG("\"%s\" tokenized with \'KeySelf\'", yytext); return(KeySelf);}; "self" {DEBUG("\"%s\" tokenized with \'KeySelf\'", yytext); return(KeySelf);};
"as" {DEBUG("\"%s\" tokenized with \'KeyAs'", yytext); return (KeyAs);}; "as" {DEBUG("\"%s\" tokenized with \'KeyAs'", yytext); return (KeyAs);};
"to" {DEBUG("\"%s\" tokenized with \'KeyTo'", yytext); return (KeyTo);};
"short" {DEBUG("\"%s\" tokenized with \'KeyShort\'", yytext); return(KeyShort);}; "short" {DEBUG("\"%s\" tokenized with \'KeyShort\'", yytext); return(KeyShort);};
"long" {DEBUG("\"%s\" tokenized with \'KeyLong\'", yytext); return(KeyLong);}; "long" {DEBUG("\"%s\" tokenized with \'KeyLong\'", yytext); return(KeyLong);};
"half" {DEBUG("\"%s\" tokenized with \'KeyHalf\'", yytext); return(KeyHalf);}; "half" {DEBUG("\"%s\" tokenized with \'KeyHalf\'", yytext); return(KeyHalf);};

View File

@ -74,6 +74,7 @@
%token KeyFloat %token KeyFloat
%token KeySelf %token KeySelf
%token KeyAs %token KeyAs
%token KeyTo
%token <string> ValInt %token <string> ValInt
%token <string> Ident %token <string> Ident
%token <string> ValFloat %token <string> ValFloat
@ -130,7 +131,7 @@
%left '+' '-' %left '+' '-'
%left '*' '/' %left '*' '/'
%left OpNot OpBitnot %left OpNot OpBitnot
%left KeyAs %left KeyAs KeyTo
%left '(' ')' %left '(' ')'
%% %%
@ -156,6 +157,7 @@ expr: ValFloat {$$ = AST_new_node(new_loc(), AST_Float, $1);}
| boxselfaccess{$$ = $1;} | boxselfaccess{$$ = $1;}
| typecast{$$ = $1;} | typecast{$$ = $1;}
| reinterpretcast{$$ = $1;} | reinterpretcast{$$ = $1;}
| '(' expr ')' {$$=$2;}
exprlist: expr ',' exprlist {AST_push_node($3, $1); exprlist: expr ',' exprlist {AST_push_node($3, $1);
$$ = $3;} $$ = $3;}
@ -291,9 +293,9 @@ typecast: expr KeyAs type %prec KeyAs {AST_NODE_PTR cast = AST_new_node(new_loc
$$ = cast; $$ = cast;
DEBUG("Type-Cast"); }; DEBUG("Type-Cast"); };
reinterpretcast: '(' type ')' expr { AST_NODE_PTR cast = AST_new_node(new_loc(), AST_Transmute, NULL); reinterpretcast: expr KeyTo type %prec KeyTo { AST_NODE_PTR cast = AST_new_node(new_loc(), AST_Transmute, NULL);
AST_push_node(cast, $4); AST_push_node(cast, $1);
AST_push_node(cast, $2); AST_push_node(cast, $3);
$$ = cast; $$ = cast;
DEBUG("Reinterpret-Cast"); }; DEBUG("Reinterpret-Cast"); };