Skip to content

Commit

Permalink
Made two changes to the verilog token parsing in netfile.c in
Browse files Browse the repository at this point in the history
response to Mitch Bailey's github issue #82:

(1) When skipping comments, skip the contents of "(* ... *)"
    delimiters as well as "/* ... */" delimiters.

(2) When checking for qflow's "\abcd\" names (final space
    replaced with a backslash for SPICE compatibility of
    names), make sure that the last "\" is followed by end-
    of-string.  Otherwise names like "\a\bcd " will fail to
    parse correctly.
  • Loading branch information
RTimothyEdwards committed Sep 4, 2023
1 parent cff954f commit b1374e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.257
1.5.258
10 changes: 8 additions & 2 deletions base/netfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,8 @@ void SpiceTokNoNewline(void)
}

/*----------------------------------------------------------------------*/
/* Skip to the next token, ignoring any C-style comments. */
/* Skip to the next token, ignoring any C-style comments and verilog */
/* "(* ... *)"-style comments. */
/*----------------------------------------------------------------------*/

void SkipTokComments(char *delimiter)
Expand All @@ -627,6 +628,11 @@ void SkipTokComments(char *delimiter)
SkipTok(delimiter);
if (nexttok) SkipTok(delimiter);
}
else if (match(nexttok, "(*")) {
while (nexttok && !match(nexttok, "*)"))
SkipTok(delimiter);
if (nexttok) SkipTok(delimiter);
}
else break;
}
}
Expand Down Expand Up @@ -731,7 +737,7 @@ char *strdtok(char *pstring, char *delim1, char *delim2)
if (*s == '\\') {
s++;
while (*s != '\0') {
if ((*s == ' ') || (*s == '\\')) {
if ((*s == ' ') || ((*s == '\\') && (*(s + 1) == '\0'))) {
s++;
break;
}
Expand Down

0 comments on commit b1374e2

Please sign in to comment.