Commit 023d162f authored by Michaël Cadilhac's avatar Michaël Cadilhac
Browse files

2005-06-09 Michael Cadilhac <michael.cadilhac@lrde.epita.fr>

	* parser.y: Do not output "#line" directives when reading rules.
parent bbc776e7
2005-06-09 Michael Cadilhac <michael.cadilhac@lrde.epita.fr>
* parser.y: Do not output "#line" directives when reading rules.
2005-06-09 Michael Cadilhac <michael.cadilhac@lrde.epita.fr> 2005-06-09 Michael Cadilhac <michael.cadilhac@lrde.epita.fr>
* parser.y: Search through `include_dirs' paths for file to include. * parser.y: Search through `include_dirs' paths for file to include.
......
...@@ -107,6 +107,8 @@ optcfunc : /*empty */ { $$ = NULL; } ...@@ -107,6 +107,8 @@ optcfunc : /*empty */ { $$ = NULL; }
static char input[2048]; static char input[2048];
static char *next = input; static char *next = input;
static int n_input = 0; static int n_input = 0;
static int state = 0;
char *fgets_inc(char *s, int size) char *fgets_inc(char *s, int size)
{ {
...@@ -123,9 +125,10 @@ char *fgets_inc(char *s, int size) ...@@ -123,9 +125,10 @@ char *fgets_inc(char *s, int size)
return 0; return 0;
free (inputs[n_input].filename); free (inputs[n_input].filename);
fclose (inputs[n_input--].fd); fclose (inputs[n_input--].fd);
fprintf (outputfd, "#line %d \"%s\"\n", if (state != 1)
inputs[n_input].yylineno + 1, fprintf (outputfd, "#line %d \"%s\"\n",
inputs[n_input].filename); inputs[n_input].yylineno + 1,
inputs[n_input].filename);
return fgets_inc(s, size); return fgets_inc(s, size);
} }
...@@ -150,7 +153,8 @@ char *fgets_inc(char *s, int size) ...@@ -150,7 +153,8 @@ char *fgets_inc(char *s, int size)
if (b_found == FALSE) if (b_found == FALSE)
yyerror ("`%%include %s': %s", yyerror ("`%%include %s': %s",
filename, strerror(errno)); filename, strerror(errno));
fprintf (outputfd, "#line %d \"%s\"\n", 1, path); if (state != 1)
fprintf (outputfd, "#line %d \"%s\"\n", 1, path);
inputs[++n_input].yylineno = 0; inputs[++n_input].yylineno = 0;
inputs[n_input].filename = strdup (path); inputs[n_input].filename = strdup (path);
return fgets_inc(s, size); return fgets_inc(s, size);
...@@ -175,8 +179,6 @@ yyerror (char *fmt, ...) ...@@ -175,8 +179,6 @@ yyerror (char *fmt, ...)
exit (-1); exit (-1);
} }
static int state = 0;
void void
reset_parser () reset_parser ()
{ {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment