diff options
Diffstat (limited to 'src/backend/targets/print/print.c')
-rw-r--r-- | src/backend/targets/print/print.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/backend/targets/print/print.c b/src/backend/targets/print/print.c index 7649b91..3c33438 100644 --- a/src/backend/targets/print/print.c +++ b/src/backend/targets/print/print.c @@ -81,6 +81,12 @@ void print_keyword_enum(enum Keyword code) case KW_NOT: printf("KW_NOT"); break; + case KW_IF: + printf("KW_IF"); + break; + case KW_ELSE: + printf("KW_ELSE"); + break; default: printf("LEXERROR"); } @@ -158,6 +164,9 @@ void print_ast_enum(enum AST_Type type) case AST_TYPE_UNFINISHED_STATE: printf("AST_TYPE_UNFINISHED_STATE"); break; + case AST_TYPE_IF: + printf("AST_TYPE_IF"); + break; default: printf("AST_NOP"); } @@ -210,6 +219,9 @@ void print_ast(struct AST *tree) case AST_TYPE_UNFINISHED_STATE: print_ast_unchecked_state((struct AST_Unchecked_State*)tree); break; + case AST_TYPE_IF: + print_ast_if_statement((struct AST_If_Statement*)tree); + break; default: printf("noast"); } @@ -262,16 +274,16 @@ void print_ast_transition(struct AST_Transition* tree) assert(tree); printf("TRANSITION [\nFROM"); - print_ast(tree->from); + print_ast_state(tree->from); printf(" TO "); print_ast_state(tree->to); printf(" COMMAND {"); - if(tree->pipeline==NULL) + if(tree->statement==NULL) { printf("NULL"); }else { - print_ast_pipeline(tree->pipeline); + print_ast(tree->statement); } } @@ -381,4 +393,13 @@ void print_ast_unchecked_state(struct AST_Unchecked_State *tree) { print_token(tree->name); } +void print_ast_if_statement(struct AST_If_Statement *tree) +{ + printf("if <"); + print_ast(tree->condition); + printf(">\n"); + print_ast(tree->body); + if(tree->else_statement) + print_ast(tree->else_statement); +} #endif |