Prevent shadowing.

The name line_number seems to be used as a function parameter name for
one of the Lex functions. Change the name to linenumber.
This commit is contained in:
ed 2013-05-25 15:36:15 +00:00
parent 843b520e07
commit 9b52f7b4ed
6 changed files with 10 additions and 10 deletions

View File

@ -36,6 +36,6 @@ typedef struct {
} linear_zone_t;
extern int debug;
extern int line_number;
extern int linenumber;
extern int yyerror(const char *);
extern int yylex(void);

View File

@ -41,7 +41,7 @@
#include "ldef.h"
#include "yacc.h"
int line_number = 1;
int linenumber = 1;
%}
%option noinput
%option nounput
@ -51,11 +51,11 @@ int line_number = 1;
%%
[ \t]+ { }
#.*[\n]|"//".*[\n]|[\n] { line_number++; return (R_LN); }
#.*[\n]|"//".*[\n]|[\n] { linenumber++; return (R_LN); }
"/*" { BEGIN COMMENT; }
<COMMENT>"*/" { BEGIN 0; }
<COMMENT>[\n] { line_number++; }
<COMMENT>[\n] { linenumber++; }
<COMMENT>. { }
<COMMENT><<EOF>> {
yyerror("unexpected file end (unterminated comment)\n");

View File

@ -203,7 +203,7 @@ static void
warning(const char *s)
{
fprintf(stderr, "%s in %d\n", s, line_number);
fprintf(stderr, "%s in %d\n", s, linenumber);
}
int

View File

@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
extern int line_number;
extern int linenumber;
extern int yyerror(const char *);
extern int yylex(void);

View File

@ -43,7 +43,7 @@
#include "ldef.h"
#include "yacc.h"
int line_number = 1;
int linenumber = 1;
%}
%option noinput
%option nounput
@ -53,11 +53,11 @@ int line_number = 1;
%%
[ \t]+ { }
#.*[\n]|"//".*[\n]|[\n] { line_number++; return (R_LN); }
#.*[\n]|"//".*[\n]|[\n] { linenumber++; return (R_LN); }
"/*" { BEGIN COMMENT; }
<COMMENT>"*/" { BEGIN 0; }
<COMMENT>[\n] { line_number++; }
<COMMENT>[\n] { linenumber++; }
<COMMENT>. { }
<COMMENT><<EOF>> {
yyerror("unexpected file end (unterminated comment)\n");

View File

@ -114,7 +114,7 @@ int
yyerror(const char *s)
{
fprintf(stderr, "%s in %d\n", s, line_number);
fprintf(stderr, "%s in %d\n", s, linenumber);
return (0);
}