eval_expr.y: references to unknown identifiers cause the lexer to return an error so the expression is not evaluated and returned as is, instead of erroneously interpreting the unknown identifier as 0

This commit is contained in:
stefan schippers 2025-02-25 02:00:55 +01:00
parent f9ccf878c2
commit d3e0ca82b4
2 changed files with 4 additions and 3 deletions

View File

@ -274,10 +274,11 @@ static int kklex()
while (c != 0 && isalnum(c) && i < length);
str--;
symbuf[i] = '\0';
s = getsym (symbuf);
s = getsym(symbuf);
kklval.tptr = s;
dbg(dbglev, "ylex: FNCT=%s\n", symbuf);
return FNCT;
if(s) return FNCT;
return 0; /* error : undefined identifier */
}
/* Any other character is a token by itself. */
return c;

View File

@ -28,4 +28,4 @@ S {}
E {}
P 4 5 10 -20 10 -140 140 -140 140 -20 10 -20 {}
T {@device} 12.5 -18.125 0 0 0.2 0.2 {layer=4}
T {tcleval(@spice_get_node [xschem get_fqdevice @device ] )} 12.5 -139.375 0 0 0.15 0.15 {layer=15}
T {tcleval(@spice_get_node [xschem get_fqdevice @device ] )} 12.5 -139.375 0 0 0.15 0.15 {layer=17}