projects
/
m6w6
/
ext-psi
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
enums
[m6w6/ext-psi]
/
src
/
parser.re
diff --git
a/src/parser.re
b/src/parser.re
index 70ab698ab88bf1b69f0a209c4eb333f4033181d2..50d15aadd86d0b9ae7dfb35a1b445277afdbf554 100644
(file)
--- a/
src/parser.re
+++ b/
src/parser.re
@@
-1,5
+1,8
@@
+#include <stddef.h>
#include <stdio.h>
#include <assert.h>
#include <stdio.h>
#include <assert.h>
+#include <errno.h>
+#include <string.h>
#include "parser.h"
#include "parser_proc.h"
#include "parser.h"
#include "parser_proc.h"
@@
-13,15
+16,11
@@
PSI_Parser *PSI_ParserInit(PSI_Parser *P, const char *filename, psi_error_cb err
{
FILE *fp;
{
FILE *fp;
- if (!P) {
- P = malloc(sizeof(*P));
- }
- memset(P, 0, sizeof(*P));
-
fp = fopen(filename, "r");
if (!fp) {
fp = fopen(filename, "r");
if (!fp) {
- perror(filename);
+ error(NULL, PSI_WARNING, "Could not open '%s' for reading: %s",
+ filename, strerror(errno));
return NULL;
}
return NULL;
}
@@
-285,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);}
'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);}
'CONST' {RETURN(PSI_T_CONST);}
'LIB' {RETURN(PSI_T_LIB);}
'LET' {RETURN(PSI_T_LET);}