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 @@ -336,13 +336,23 @@ void verilog_preprocessort::directive()
336
336
// skip whitespace
337
337
tokenizer ().skip_ws ();
338
338
339
- // Read any tokens until end of line.
339
+ // Read any tokens until end of line,
340
+ // but note that \n can be escaped with a backslash.
340
341
// Note that any defines in this sequence
341
342
// are not expanded at this point.
342
343
while (!tokenizer ().eof () && tokenizer ().peek () != ' \n ' )
343
344
{
344
345
auto token = tokenizer ().next_token ();
345
- define.tokens .push_back (std::move (token));
346
+ if (token == ' \\ ' && tokenizer ().peek () == ' \n ' )
347
+ {
348
+ // Eat the newline, which is escaped.
349
+ // Not clear whether the newline is meant to show
350
+ // in the expansion.
351
+ auto nl = tokenizer ().next_token ();
352
+ define.tokens .push_back (std::move (nl));
353
+ }
354
+ else
355
+ define.tokens .push_back (std::move (token));
346
356
}
347
357
348
358
#ifdef DEBUG
You can’t perform that action at this time.
0 commit comments