mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2025-04-21 12:27:27 +03:00
b2/lang.l: reset lineno for new file and count newlines in comment
This commit is contained in:
@@ -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++;
|
||||
|
||||
Reference in New Issue
Block a user