diff options
author | Galin Simeonov <gts@volconst.com> | 2021-06-04 22:49:33 +0300 |
---|---|---|
committer | Galin Simeonov <gts@volconst.com> | 2021-07-15 18:07:29 +0300 |
commit | c875f8795586056a676e8a643a44211041ce44d2 (patch) | |
tree | 88bfd4b4923ed30de31b130672dda65e4b18a607 /src/backend/backend.c | |
parent | a26684a417729699e95b335a3d00798237ffba9b (diff) | |
download | MEGATRON-c875f8795586056a676e8a643a44211041ce44d2.tar.gz |
various stuffs
Diffstat (limited to 'src/backend/backend.c')
-rw-r--r-- | src/backend/backend.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/backend/backend.c b/src/backend/backend.c index ff9d0bf..b6b78bd 100644 --- a/src/backend/backend.c +++ b/src/backend/backend.c @@ -99,11 +99,12 @@ void anotate_machine(struct AST_Machine *machine,struct AST_Translation_Unit *un for(i=0;i<machine->transitions->size;++i) { machine->transitions->transitions[i]->statement=anotate_statement(machine->transitions->transitions[i]->statement,unit,machine,translation_data); + if(machine->transitions->transitions[i]->granted) + machine->transitions->transitions[i]->granted=anotate_expression(machine->transitions->transitions[i]->granted,unit,machine,translation_data); } if(has_new_errors(translation_data)) { push_error_with_token("in machine",machine->id,translation_data); - delete_ast_machine(machine); } } struct AST* anotate_statement(struct AST *statement,struct AST_Translation_Unit *unit,struct AST_Machine *current_machine,struct Translation_Data *translation_data) @@ -134,7 +135,10 @@ struct AST* anotate_expression(struct AST *expression,struct AST_Translation_Uni if(hold_machine==NULL) { push_error_with_token("machine id is undefined",((struct AST_Unchecked_State*)hold_left)->name,translation_data); - delete_ast(expression); + return NULL; + }else if(hold_machine==current_machine) + { + push_error_with_token("using a state from the current machine is disallowed",((struct AST_Unchecked_State*)hold_left)->name,translation_data); return NULL; }else { @@ -142,12 +146,10 @@ struct AST* anotate_expression(struct AST *expression,struct AST_Translation_Uni if(hold_left) { ((struct AST_State*)hold_left)->parent=hold_machine; - delete_ast(hold_right); return hold_left; }else { push_error_with_token("state id from foreign machine is undefined",((struct AST_Unchecked_State*)hold_right)->name,translation_data); - delete_ast(hold_right); return NULL; } } |