File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed
regression/verilog/preprocessor Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change
1
+ CORE
2
+ multi-line-define1.v
3
+ --preprocess
4
+ // Enable multi-line checking
5
+ activate-multi-line-match
6
+ `line 1 "multi-line-define1.v" 0
7
+
8
+ A
9
+ B
10
+ C
11
+ ^EXIT=0$
12
+ ^SIGNAL=0$
13
+ --
14
+ ^PREPROCESSING FAILED$
Original file line number Diff line number Diff line change
1
+ `define foo A \
2
+ B \
3
+ C
4
+ `foo
Original file line number Diff line number Diff line change @@ -362,13 +362,23 @@ void verilog_preprocessort::directive()
362
362
// skip whitespace
363
363
tokenizer ().skip_ws ();
364
364
365
- // Read any tokens until end of line.
365
+ // Read any tokens until end of line,
366
+ // but note that \n can be escaped with a backslash.
366
367
// Note that any defines in this sequence
367
368
// are not expanded at this point.
368
369
while (!tokenizer ().eof () && tokenizer ().peek () != ' \n ' )
369
370
{
370
371
auto token = tokenizer ().next_token ();
371
- define.tokens .push_back (std::move (token));
372
+ if (token == ' \\ ' && tokenizer ().peek () == ' \n ' )
373
+ {
374
+ // Eat the newline, which is escaped.
375
+ // Not clear whether the newline is meant to show
376
+ // in the expansion.
377
+ auto nl = tokenizer ().next_token ();
378
+ define.tokens .push_back (std::move (nl));
379
+ }
380
+ else
381
+ define.tokens .push_back (std::move (token));
372
382
}
373
383
374
384
#ifdef DEBUG
You can’t perform that action at this time.
0 commit comments