X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fparser.re;h=50d15aadd86d0b9ae7dfb35a1b445277afdbf554;hp=0922ba1b0f23f6ceb3debb4b9ffbe8c058aa77ae;hb=6a459a08a40a2c243b0211ceb0cb263d29302627;hpb=7e4b0ccdd2123647b6fff8065c0abc61be3fb44d diff --git a/src/parser.re b/src/parser.re index 0922ba1..50d15aa 100644 --- a/src/parser.re +++ b/src/parser.re @@ -1,6 +1,8 @@ #include #include #include +#include +#include #include "parser.h" #include "parser_proc.h" @@ -14,15 +16,11 @@ PSI_Parser *PSI_ParserInit(PSI_Parser *P, const char *filename, psi_error_cb err { FILE *fp; - if (!P) { - P = malloc(sizeof(*P)); - } - memset(P, 0, sizeof(*P)); - fp = fopen(filename, "r"); if (!fp) { - perror(filename); + error(NULL, PSI_WARNING, "Could not open '%s' for reading: %s", + filename, strerror(errno)); return NULL; } @@ -286,6 +284,7 @@ token_t PSI_ParserScan(PSI_Parser *P) 'FUNCTION' {RETURN(PSI_T_FUNCTION);} 'TYPEDEF' {RETURN(PSI_T_TYPEDEF);} 'STRUCT' {RETURN(PSI_T_STRUCT);} + 'ENUM' {RETURN(PSI_T_ENUM);} 'CONST' {RETURN(PSI_T_CONST);} 'LIB' {RETURN(PSI_T_LIB);} 'LET' {RETURN(PSI_T_LET);}