Made two changes to the verilog token parsing in netfile.c in

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.
This commit is contained in:
Tim Edwards 2023-09-04 10:50:59 -04:00
parent cff954f36a
commit b1374e2bc8
2 changed files with 9 additions and 3 deletions

View File

@ -1 +1 @@
1.5.257 1.5.258

View File

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