From 2915f8e9915db47627c3e1faa72cdbd7e0c0e7bf Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Wed, 6 Apr 2022 16:01:45 +0200 Subject: [PATCH] In case of resistor valuues r150 (r + integer number), return 150 R2 n1 n2 r150 In case of r23mod return error = 1 and val = 0, so r23mod may be read as a model, not an instance parameter R3 n3 n4 r23mod --- src/spicelib/parser/inpeval.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/spicelib/parser/inpeval.c b/src/spicelib/parser/inpeval.c index dd48e1431..8e8b24c9b 100644 --- a/src/spicelib/parser/inpeval.c +++ b/src/spicelib/parser/inpeval.c @@ -221,8 +221,8 @@ INPevaluateRKM_R(char** line, int* error, int gobble) tmpline = *line; if (gobble) { - /* MW. INPgetUTok should be called with gobble=0 or it make - * errors in v(1,2) exp */ + /* MW. INPgetUTok should be called with gobble=0 or it leads to + * errors in v(1,2) expression */ *error = INPgetUTok(line, &token, 0); if (*error) return (0.0); @@ -363,8 +363,24 @@ INPevaluateRKM_R(char** line, int* error, int gobble) break; case 'r': case 'R': - expo1 = expo1; - hasmulti = TRUE; + /* This should be R150, i.e. R followed by an integer number */ + { + int num; + char ch; + if (sscanf(here + 1, "%i%c", &num, &ch) == 1) { + expo1 = expo1; + hasmulti = TRUE; + } + else { + *error = 1; + if (gobble) { + FREE(token); + /* back out the 'gettok' operation */ + *line = tmpline; + } + return (0); + } + } break; case 'n': case 'N':