aboutsummaryrefslogtreecommitdiffstats
path: root/src/backend/targets/print/print.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/targets/print/print.c')
-rw-r--r--src/backend/targets/print/print.c97
1 files changed, 93 insertions, 4 deletions
diff --git a/src/backend/targets/print/print.c b/src/backend/targets/print/print.c
index 8eae3dd..7649b91 100644
--- a/src/backend/targets/print/print.c
+++ b/src/backend/targets/print/print.c
@@ -36,6 +36,12 @@ void print_keyword_enum(enum Keyword code)
case KW_CLOSE_SQUARE:
printf("KW_CLOSE_SQUARE");
break;
+ case KW_OPEN_NORMAL:
+ printf("KW_OPEN_NORMAL");
+ break;
+ case KW_CLOSE_NORMAL:
+ printf("KW_CLOSE_NORMAL");
+ break;
case KW_PIPE:
printf("KW_PIPE");
break;
@@ -54,15 +60,27 @@ void print_keyword_enum(enum Keyword code)
case KW_EVENT:
printf("KW_EVENT");
break;
- case KW_TRANSITIONS:
- printf("KW__TRANSITIONS");
- break;
case KW_EXECUTE:
printf("KW_EXECUTE");
break;
+ case KW_TRANSITIONS:
+ printf("KW_TRANSITIONS");
+ break;
case KW_COMMA:
printf("KW_COMMA");
break;
+ case KW_DOT:
+ printf("KW_DOT");
+ break;
+ case KW_AND:
+ printf("KW_AND");
+ break;
+ case KW_OR:
+ printf("KW_OR");
+ break;
+ case KW_NOT:
+ printf("KW_NOT");
+ break;
default:
printf("LEXERROR");
}
@@ -95,6 +113,9 @@ void print_ast_enum(enum AST_Type type)
{
switch(type)
{
+ case AST_TYPE_TRANSLATION_UNIT:
+ printf("AST_TYPE_TRANSLATION_UNIT");
+ break;
case AST_TYPE_MACHINE:
printf("AST_TYPE_MACHINE");
break;
@@ -122,6 +143,21 @@ void print_ast_enum(enum AST_Type type)
case AST_TYPE_PIPELINE:
printf("AST_TYPE_PIPELINE");
break;
+ case AST_TYPE_OP_AND:
+ printf("AST_TYPE_OP_AND");
+ break;
+ case AST_TYPE_OP_OR:
+ printf("AST_TYPE_OP_OR");
+ break;
+ case AST_TYPE_OP_NOT:
+ printf("AST_TYPE_OP_NOT");
+ break;
+ case AST_TYPE_OP_SELECTOR:
+ printf("AST_TYPE_OP_SELECTOR");
+ break;
+ case AST_TYPE_UNFINISHED_STATE:
+ printf("AST_TYPE_UNFINISHED_STATE");
+ break;
default:
printf("AST_NOP");
}
@@ -160,6 +196,20 @@ void print_ast(struct AST *tree)
case AST_TYPE_PIPELINE:
print_ast_pipeline((struct AST_Pipeline*)tree);
break;
+ case AST_TYPE_TRANSLATION_UNIT:
+ print_ast_translation_unit((struct AST_Translation_Unit*)tree);
+ break;
+ case AST_TYPE_OP_AND:
+ case AST_TYPE_OP_OR:
+ case AST_TYPE_OP_SELECTOR:
+ print_ast_binary_expression((struct AST_Binary_Expression*)tree);
+ break;
+ case AST_TYPE_OP_NOT:
+ print_ast_unary_expression((struct AST_Unary_Expression*)tree);
+ break;
+ case AST_TYPE_UNFINISHED_STATE:
+ print_ast_unchecked_state((struct AST_Unchecked_State*)tree);
+ break;
default:
printf("noast");
}
@@ -212,7 +262,7 @@ void print_ast_transition(struct AST_Transition* tree)
assert(tree);
printf("TRANSITION [\nFROM");
- print_ast_state(tree->from);
+ print_ast(tree->from);
printf(" TO ");
print_ast_state(tree->to);
printf(" COMMAND {");
@@ -292,4 +342,43 @@ void print_errors(struct Translation_Data *translation_data)
print_error(it->data);
}
}
+void print_ast_translation_unit(struct AST_Translation_Unit *tree)
+{
+ size_t i;
+ printf("TRANSLATION UNIT\n[\n");
+ for(i=0;i<tree->number_of_machines;++i)
+ print_ast_machine(tree->machines[i]);
+ printf("\n] TRANSLATION UNIT END \n");
+}
+void print_ast_binary_expression(struct AST_Binary_Expression *tree)
+{
+ printf(" (");
+ print_ast(tree->left);
+ switch(tree->type)
+ {
+ case AST_TYPE_OP_AND:
+ printf("&&");
+ break;
+ case AST_TYPE_OP_OR:
+ printf("||");
+ break;
+ case AST_TYPE_OP_SELECTOR:
+ printf(".");
+ break;
+ default:
+ printf("?!!?!?!?");
+ }
+ print_ast(tree->right);
+ printf(")");
+}
+void print_ast_unary_expression(struct AST_Unary_Expression *tree)
+{
+ printf("(!");
+ print_ast(tree->operand);
+ printf(")");
+}
+void print_ast_unchecked_state(struct AST_Unchecked_State *tree)
+{
+ print_token(tree->name);
+}
#endif