--- a/c2iec.y +++ b/c2iec.y @@ -332,7 +332,7 @@ } strcpy($<str>$, ""); if (isFuncDecl) - printf("END_FUNCTION\n\n"); + printf("\nEND_FUNCTION\n\n"); } ; @@ -514,48 +514,40 @@ declarator : pointer direct_declarator { - sprintf($<str>$, "%s: POINTER TO %%s;\n",$<str>2); - // don't push function declarations to decl_all -// if (fifo_empty(decl_func)) - { - fifo_push(decl_all, $<str>$); - } + sprintf($<str>$, "%s: POINTER TO %%s;\n",$<str>2); + fifo_push(decl_all, $<str>$); } | direct_declarator { - if (strlen($<str>1) > 0) - { - sprintf($<str>$, "%s: %%s;\n",$<str>1); - // don't push function declarations to decl_all -// if (fifo_empty(decl_func)) - { - fifo_push(decl_all, $<str>$); - } - } + if (strlen($<str>1) > 0) + { + sprintf($<str>$, "%s: %%s;\n",$<str>1); + fifo_push(decl_all, $<str>$); + } } ; declarator_funcdef : pointer direct_declarator { - sprintf($<str>$, "%s: POINTER TO %%s;\n",$<str>2); + sprintf($<str>$, "%s: POINTER TO %%s;\n",$<str>2); + // don't push function declarations to decl_all + if (fifo_empty(decl_func)) + { + fifo_push(decl_all, $<str>$); + } + } + | direct_declarator + { + if (strlen($<str>1) > 0) + { + sprintf($<str>$, "%s: %%s;\n",$<str>1); // don't push function declarations to decl_all if (fifo_empty(decl_func)) { fifo_push(decl_all, $<str>$); } - } - | direct_declarator - { - if (strlen($<str>1) > 0) - { - sprintf($<str>$, "%s: %%s;\n",$<str>1); - // don't push function declarations to decl_all - if (fifo_empty(decl_func)) - { - fifo_push(decl_all, $<str>$); - } - } + } } ; @@ -804,7 +796,7 @@ function_definition : declaration_specifiers declarator_funcdef declaration_list compound_statement { - printf("%s %s %s %s", $<str>1, $<str>2, $<str>3, $<str>4); + printf ("not supported function_definition\n"); exit(-1); } | declaration_specifiers declarator_funcdef compound_statement { @@ -822,7 +814,7 @@ printf(p, $<str>1); } printf("%s", $<str>3); - printf("END_FUNCTION\n"); + printf("\nEND_FUNCTION\n"); strcpy($<str>$, ""); } ;