A macro can only have `" and add `\`" for pragma comments
We want to support `" and `\`" when a pragma comment is part of a macro definition, but this cannot be part of a normal pragma comment.
This commit is contained in:
parent
d938654c36
commit
b12977d61a
|
|
@ -268,7 +268,8 @@ keywords (line|include|define|undef|ifdef|ifndef|else|elsif|endif)
|
||||||
<PCOMENT>`[a-zA-Z][a-zA-Z0-9_$]* {
|
<PCOMENT>`[a-zA-Z][a-zA-Z0-9_$]* {
|
||||||
if (macro_needs_args(yytext+1)) yy_push_state(MA_START); else do_expand(0);
|
if (macro_needs_args(yytext+1)) yy_push_state(MA_START); else do_expand(0);
|
||||||
}
|
}
|
||||||
<PCOMENT>`\" { fputc('\"', yyout); }
|
<PCOMENT>`\" { if (!istack->file) fputc('"', yyout); else REJECT; }
|
||||||
|
<PCOMENT>`\\`\" { if (!istack->file) fputs("\\\"", yyout); else REJECT; }
|
||||||
|
|
||||||
/* Strings do not contain preprocessor directives or macro expansions.
|
/* Strings do not contain preprocessor directives or macro expansions.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,9 @@ endfunction
|
||||||
|
|
||||||
(* attr = fn(10) *) reg attr46;
|
(* attr = fn(10) *) reg attr46;
|
||||||
|
|
||||||
// Macro escaped
|
// Macro escape only in a macro declaration
|
||||||
`define A_MACRO(arg) (* attr = `"arg`" *)
|
`define MACRO(arg) (* attr = `"`\`"arg`\`"`" *)
|
||||||
`A_MACRO(test) reg attr47;
|
`MACRO(test) reg attr47;
|
||||||
|
|
||||||
initial begin
|
initial begin
|
||||||
$display("PASSED");
|
$display("PASSED");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue