Skip to content

Commit 9c340ed

Browse files
committed
Squashed 'libs/EXTERNAL/libblifparse/' changes from dcd0f729f..ebda7e2df
ebda7e2df Broaden character set for IDs 0b308eb6d Fix test with comment on same line as blank attr and param git-subtree-dir: libs/EXTERNAL/libblifparse git-subtree-split: ebda7e2df69e2c15e98c49d649caef067a6c265d
1 parent 1c828c8 commit 9c340ed

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

src/blif_lexer.l

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@
4545
%option prefix="blifparse_"
4646

4747
/* Common character classes */
48-
ALPHA_SYMBOLS [-a-zA-Z_~|:*/\[\]\.\{\}^+$;'"]
49-
DIGITS [0-9]
50-
ALPHA_NUM_SYMBOLS ({ALPHA_SYMBOLS}|{DIGITS})
48+
ID_SET [^ \t\r\n\\=]
5149
BACK_SLASH [\\]
5250
WS [ \t]
5351
ENDL (\n|\n\r|\r\n)
@@ -61,7 +59,9 @@ ENDL (\n|\n\r|\r\n)
6159
* Symbol Definitions
6260
*/
6361
%%
64-
<*>#.*{ENDL} { /* ignore comments */ }
62+
<*>#.*{ENDL} { /* ignore comments, but forward EOL for end of line comments */
63+
return blifparse::Parser::make_EOL();
64+
}
6565
^{WS}*{ENDL} { /* Ignore blank lines. */ }
6666
\\{ENDL}{WS}*{ENDL} {
6767
/*
@@ -139,15 +139,7 @@ ENDL (\n|\n\r|\r\n)
139139
BEGIN(SO_COVER);
140140
return blifparse::Parser::make_EOL();
141141
}
142-
<INITIAL,NAMES,LATCH>({DIGITS}({ALPHA_NUM_SYMBOLS}|{BACK_SLASH})*{ALPHA_NUM_SYMBOLS}+)|(({ALPHA_SYMBOLS}|{BACK_SLASH})*({ALPHA_NUM_SYMBOLS}|{BACK_SLASH})*{ALPHA_NUM_SYMBOLS}) {
143-
/* The terrible regex above covers two cases:
144-
* 1) An identifier starts with a digit, contains a combination of
145-
* alpha numeric and symbolic characters. To avoid conflicts with
146-
* line continuation, back slashes are forbidden in the last character.
147-
* 2) An identifier with a non-numeric first letter (i.e. alpha, symbol, back slash)
148-
* followed by any number of (alpha, num, symbol, back slash) the last character
149-
* can be any alpha/num/symbol excluding back slashes (to avoid conflicts with line continuation)
150-
*/
142+
<INITIAL,NAMES,LATCH>(({ID_SET}|{BACK_SLASH})*{ID_SET}) {
151143
/*
152144
* We allow all sorts of characters in regular strings.
153145
* However we need to be careful about line continuations

test/eblif/test.eblif

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
.inputs a b clk
33
.outputs o_dff
44

5-
.names a b a_and_b
5+
.names 1\a 3 a_-1234567890~|:*/\[\]\.\{\}^+$;'"?<>
6+
7+
.names a b \
8+
a_and_b
69
11 1
710
.cname lut_a_and_b
811

0 commit comments

Comments
 (0)