Added support for `line compiler directive

This commit is contained in:
Clifford Wolf 2014-03-11 14:06:57 +01:00
parent fa75c8286e
commit 9992026a8d
1 changed files with 11 additions and 0 deletions

View File

@ -75,6 +75,17 @@ namespace VERILOG_FRONTEND {
ln_stack.pop_back();
}
"`line"[ \t]+[^ \t\r\n]+[ \t]+\"[^ \r\n]+\"[^\r\n]*\n {
char *p = yytext + 5;
while (*p == ' ' || *p == '\t') p++;
frontend_verilog_yyset_lineno(atoi(p));
while (*p && *p != ' ' && *p != '\t') p++;
while (*p == ' ' || *p == '\t') p++;
char *q = *p ? p + 1 : p;
while (*q && *q != '"') q++;
current_filename = std::string(p).substr(1, q-p-1);
}
"`file_notfound "[^\n]* {
log_error("Can't open include file `%s'!\n", yytext + 15);
}