changed ast implementation for cast
This commit is contained in:
parent
e57682d717
commit
8d7c6a4a2b
|
@ -62,7 +62,7 @@ set(YACC_GENERATED_SOURCE_FILE ${PROJECT_SOURCE_DIR}/src/yacc/parser.tab.c)
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${YACC_GENERATED_SOURCE_FILE}
|
add_custom_command(OUTPUT ${YACC_GENERATED_SOURCE_FILE}
|
||||||
|
|
||||||
COMMAND bison
|
COMMAND yacc
|
||||||
ARGS -Wno-yacc -Wcounterexamples -d -o ${YACC_GENERATED_SOURCE_FILE} ${YACC_SOURCE_FILE}
|
ARGS -Wno-yacc -Wcounterexamples -d -o ${YACC_GENERATED_SOURCE_FILE} ${YACC_SOURCE_FILE}
|
||||||
|
|
||||||
COMMENT "generate C source file for parser"
|
COMMENT "generate C source file for parser"
|
||||||
|
|
|
@ -283,10 +283,16 @@ boxcall: boxaccess argumentlist {AST_NODE_PTR boxcall = AST_new_node(AST_Call, N
|
||||||
$$ = boxcall;};
|
$$ = boxcall;};
|
||||||
|
|
||||||
|
|
||||||
typecast: expr KeyAs type %prec KeyAs {$$ = AST_new_node(AST_Typecast, $1);
|
typecast: expr KeyAs type %prec KeyAs {AST_NODE_PTR cast = AST_new_node(AST_Typecast, NULL);
|
||||||
|
AST_push_node(cast, $1);
|
||||||
|
AST_push_node(cast, $3);
|
||||||
|
$$ = cast;
|
||||||
DEBUG("Type-Cast"); };
|
DEBUG("Type-Cast"); };
|
||||||
|
|
||||||
reinterpretcast: '(' type ')' expr {$$ = AST_new_node(AST_Transmute, $4);
|
reinterpretcast: '(' type ')' expr { AST_NODE_PTR cast = AST_new_node(AST_Transmute, NULL);
|
||||||
|
AST_push_node(cast, $4);
|
||||||
|
AST_push_node(cast, $2);
|
||||||
|
$$ = cast;
|
||||||
DEBUG("Reinterpret-Cast"); };
|
DEBUG("Reinterpret-Cast"); };
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue