Fix bug reported by Anant Devi in user discussion 22/9/22.
A function call, vi(v) was misparsed as the special token i(vsource) for the current in a voltage source.
This commit is contained in:
parent
b212a49982
commit
c704854b3c
|
|
@ -885,7 +885,7 @@ int PPlex(YYSTYPE *lvalp, struct PPltype *llocp, char **line)
|
||||||
* vthing#branch
|
* vthing#branch
|
||||||
* i(vthing)
|
* i(vthing)
|
||||||
*/
|
*/
|
||||||
for (; *sbuf && !strchr(specials, *sbuf); sbuf++)
|
for (; *sbuf && !strchr(specials, *sbuf); sbuf++) {
|
||||||
if (*sbuf == '@') {
|
if (*sbuf == '@') {
|
||||||
atsign = 1;
|
atsign = 1;
|
||||||
}
|
}
|
||||||
|
|
@ -897,16 +897,22 @@ int PPlex(YYSTYPE *lvalp, struct PPltype *llocp, char **line)
|
||||||
sbuf++;
|
sbuf++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
} else if ((sbuf == start || sbuf[-1] == '.') &&
|
||||||
/* keep the identifier i(vss) as a single token, even as dc1.i(vss) */
|
prefix("i(v", sbuf)) {
|
||||||
else if (prefix("i(v", sbuf)) {
|
/* Special case for current through voltage source:
|
||||||
|
* keep the identifier i(vss) as a single token,
|
||||||
|
* even as dc1.i(vss).
|
||||||
|
*/
|
||||||
|
|
||||||
if (get_r_paren(&sbuf) == 1) {
|
if (get_r_paren(&sbuf) == 1) {
|
||||||
fprintf(stderr, "Error: missing ')' in token\n %s\n", start);
|
fprintf(stderr,
|
||||||
|
"Error: missing ')' in token\n %s\n",
|
||||||
|
start);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sbuf--;
|
sbuf--; // Point at ')', last accepted char.
|
||||||
}
|
}
|
||||||
|
}
|
||||||
lvalp->str = copy_substring(start, sbuf);
|
lvalp->str = copy_substring(start, sbuf);
|
||||||
lexer_return(TOK_STR, 0);
|
lexer_return(TOK_STR, 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue