1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-05 04:34:04 +02:00

b2/lang.l: reset lineno for new file and count newlines in comment

This commit is contained in:
Werner Almesberger 2012-04-28 11:51:47 -03:00
parent 90e541cd7a
commit 98f2fc8337

View File

@ -24,13 +24,14 @@ extern int yyparse(void);
static int start_token;
static int expose_nl;
static int lineno = 1;
static int lineno;
void parse_hierarchy(void)
{
start_token = START_HIERARCHY;
expose_nl = 0;
lineno = 1;
yyparse();
}
@ -39,6 +40,7 @@ void parse_characteristics(void)
{
start_token = START_CHAR;
expose_nl = 1;
lineno = 1;
yyparse();
}
@ -62,7 +64,9 @@ void parse_characteristics(void)
">=" return TOK_GE;
"//"[^\n]* ;
"/*"([^*]|("*"+([^*/])))*"*"+"/" ;
"/*"([^*]|("*"+([^*/])))*"*"+"/" { const char *s = yytext;
while (*s)
lineno += *s++ == '\n'; }
[ \t] ;
\n { lineno++;