diff options
author | Vincent Sanders <vince@kyllikki.org> | 2015-09-28 00:06:47 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2015-09-28 00:06:47 +0100 |
commit | 767e69459ca7b4c13fe93875177040ab3eec8b56 (patch) | |
tree | 349e255c7c370594edfda939dc19cf6fe7247270 /src/nsgenbind-ast.c | |
parent | 017eb2ef4da167466c05ad83eb0714129a2e46ff (diff) | |
download | nsgenbind-767e69459ca7b4c13fe93875177040ab3eec8b56.tar.gz nsgenbind-767e69459ca7b4c13fe93875177040ab3eec8b56.tar.bz2 |
Improve the parser error reporting
The parser now reports the correct file and line number for
errors. Additionally the @n location structure in rules now has a
filename member in addition to first_line. These members are useful
for adding location information in generated source.
Diffstat (limited to 'src/nsgenbind-ast.c')
-rw-r--r-- | src/nsgenbind-ast.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/nsgenbind-ast.c b/src/nsgenbind-ast.c index 2915010..749d3e8 100644 --- a/src/nsgenbind-ast.c +++ b/src/nsgenbind-ast.c @@ -29,7 +29,7 @@ static FILE *genbind_parsetracef; extern int nsgenbind_debug; extern int nsgenbind__flex_debug; extern void nsgenbind_restart(FILE*); -extern int nsgenbind_parse(struct genbind_node **genbind_ast); +extern int nsgenbind_parse(char *filename, struct genbind_node **genbind_ast); /* terminal nodes have a value only */ struct genbind_node { @@ -515,12 +515,6 @@ FILE *genbindopen(const char *filename) } prevfilepath = strndup(filename,fulllen); } -#if 0 - if (options->depfilehandle != NULL) { - fprintf(options->depfilehandle, " \\\n\t%s", - filename); - } -#endif return genfile; } @@ -529,7 +523,7 @@ FILE *genbindopen(const char *filename) fulllen = strlen(prevfilepath) + strlen(filename) + 2; fullname = malloc(fulllen); snprintf(fullname, fulllen, "%s/%s", prevfilepath, filename); - if (options->debug) { + if (options->verbose) { printf("Attempting to open Genbind file %s\n", fullname); } genfile = fopen(fullname, "r"); @@ -537,12 +531,6 @@ FILE *genbindopen(const char *filename) if (options->verbose) { printf("Opened Genbind file %s\n", fullname); } -#if 0 - if (options->depfilehandle != NULL) { - fprintf(options->depfilehandle, " \\\n\t%s", - fullname); - } -#endif free(fullname); return genfile; } @@ -599,7 +587,7 @@ int genbind_parsefile(char *infilename, struct genbind_node **ast) nsgenbind_restart(infile); /* process binding */ - ret = nsgenbind_parse(ast); + ret = nsgenbind_parse(infilename, ast); /* close tracefile if open */ if (genbind_parsetracef != NULL) { |