Added support for `line compiler directive
authorClifford Wolf <clifford@clifford.at>
Tue, 11 Mar 2014 13:06:57 +0000 (14:06 +0100)
committerClifford Wolf <clifford@clifford.at>
Tue, 11 Mar 2014 13:06:57 +0000 (14:06 +0100)
frontends/verilog/lexer.l

index 79f44b4a6d1c5f8b8f19a0921682bb11640cc95a..e3e5e4ab2b47a58b3915c1d8c9815cd9d2e0fb42 100644 (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);
 }