frontend/com_let.c, bug fix, "#302 Integer in Let Statement"

let 2foo = someexpression

was silently accepted, even though 2foo is an illegal identifier.
  (first letter is a digit)

This was especially irritating, since
  print 2foo
has a legal meaning, 2 femto oO, which is 2e-15
  (whatever Unit an oO might be)

Reported by Justin Fisher in
  http://sourceforge.net/p/ngspice/bugs/302/
This commit is contained in:
rlar 2015-05-02 11:18:30 +02:00
parent 7bc6374138
commit cab63eedd4
1 changed files with 1 additions and 1 deletions

View File

@ -123,7 +123,7 @@ com_let(wordlist *wl)
*++q = '\0';
/* sanity check */
if (eq(p, "all") ||strchr(p, '@')) {
if (eq(p, "all") || strchr(p, '@') || isdigit(*p)) {
fprintf(cp_err, "Error: bad variable name %s\n", p);
tfree(p);
return;