diff options
author | Teddy <[email protected]> | 2014-03-25 06:57:44 +0800 |
---|---|---|
committer | Teddy <[email protected]> | 2014-03-25 06:57:44 +0800 |
commit | 79b8219a7b8a786740a6c57b2d819953bcf261de (patch) | |
tree | a0e81987d32f5748ff99de2c67dd543abd42417f /main.c | |
parent | 04ee9c8bef572f4351090b768413e5b6a3ac4a77 (diff) |
verbose error reporting
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1,5 +1,6 @@ #include <stdio.h> #include <getopt.h> +#include <stdlib.h> #include "cibic.tab.h" #include "ast.h" @@ -12,21 +13,20 @@ int yywrap() { } int yyerror(char *s) { + fprintf(stderr, "%s\n", s); } void print_ast() { - yyparse(); if (fname) - printf("AST for file: \"%s\"\n", fname); + fprintf(stderr, "AST for file: \"%s\"\n", fname); else - printf("AST for stdin\n"); - + fprintf(stderr, "AST for stdin\n"); + yyparse(); if (ast_root) { cnode_debug_print(ast_root, 1); } - else - fprintf(stdout, "Syntax Error\n"); + else exit(1); } void print_help() { |