mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-26 09:22:28 +02:00
b2/lang.l: reset lineno for new file and count newlines in comment
This commit is contained in:
parent
90e541cd7a
commit
98f2fc8337
@ -24,13 +24,14 @@ extern int yyparse(void);
|
|||||||
|
|
||||||
static int start_token;
|
static int start_token;
|
||||||
static int expose_nl;
|
static int expose_nl;
|
||||||
static int lineno = 1;
|
static int lineno;
|
||||||
|
|
||||||
|
|
||||||
void parse_hierarchy(void)
|
void parse_hierarchy(void)
|
||||||
{
|
{
|
||||||
start_token = START_HIERARCHY;
|
start_token = START_HIERARCHY;
|
||||||
expose_nl = 0;
|
expose_nl = 0;
|
||||||
|
lineno = 1;
|
||||||
yyparse();
|
yyparse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ void parse_characteristics(void)
|
|||||||
{
|
{
|
||||||
start_token = START_CHAR;
|
start_token = START_CHAR;
|
||||||
expose_nl = 1;
|
expose_nl = 1;
|
||||||
|
lineno = 1;
|
||||||
yyparse();
|
yyparse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +64,9 @@ void parse_characteristics(void)
|
|||||||
">=" return TOK_GE;
|
">=" return TOK_GE;
|
||||||
|
|
||||||
"//"[^\n]* ;
|
"//"[^\n]* ;
|
||||||
"/*"([^*]|("*"+([^*/])))*"*"+"/" ;
|
"/*"([^*]|("*"+([^*/])))*"*"+"/" { const char *s = yytext;
|
||||||
|
while (*s)
|
||||||
|
lineno += *s++ == '\n'; }
|
||||||
|
|
||||||
[ \t] ;
|
[ \t] ;
|
||||||
\n { lineno++;
|
\n { lineno++;
|
||||||
|
Loading…
Reference in New Issue
Block a user