diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 3d7b1404a..9808fab07 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -5497,7 +5497,6 @@ inp_modify_exp(char* expr) { char *s; wordlist *wl = NULL, *wlist = NULL; - enum { S_value = 0, S_operator, S_unary_minus } state = S_value; /* scan the expression and remove all '{' and '}' */ for (s = expr; *s; s++) @@ -5514,7 +5513,8 @@ inp_modify_exp(char* expr) if ((c == ',') || (c == '(') || (c == ')') || (c == '*') || (c == '/') || (c == '^') || - (c == '+') || (c == '?') || (c == ':')) + (c == '+') || (c == '?') || (c == ':') || + (c == '-')) { if ((c == '*') && (s[1] == '*')) { wl->wl_word = tprintf("**"); @@ -5523,10 +5523,6 @@ inp_modify_exp(char* expr) wl->wl_word = tprintf("%c", c); s++; } - if (c == ')') - state = S_value; - else - state = S_operator; } else if ((c == '>') || (c == '<') || (c == '!') || (c == '=')) { @@ -5535,29 +5531,16 @@ inp_modify_exp(char* expr) if ((*s == '=') || (*s == '<') || (*s == '>')) s++; wl->wl_word = copy_substring(beg, s); - state = S_operator; } else if ((c == '|') || (c == '&')) { char *beg = s++; if ((*s == '|') || (*s == '&')) s++; wl->wl_word = copy_substring(beg, s); - state = S_operator; - } else if ((c == '-') && (state == S_value)) { - wl->wl_word = tprintf("%c", c); - s++; - state = S_operator; - } else if ((c == '-') && (state == S_operator)) { - wl->wl_word = copy(""); - s++; - state = S_unary_minus; } else if (isalpha(c)) { char buf[512]; int i = 0; - if (state == S_unary_minus) - buf[i++] = '-'; - if (((c == 'v') || (c == 'i')) && (s[1] == '(')) { while (*s != ')') buf[i++] = *s++; @@ -5602,15 +5585,11 @@ inp_modify_exp(char* expr) wl->wl_word = tprintf("{%s}", buf); } } - state = S_value; } else if (isdigit(c) || (c == '.')) { /* allow .5 format too */ int error1; /* allow 100p, 5MEG etc. */ double dvalue = INPevaluate(&s, &error1, 0); - if (state == S_unary_minus) - dvalue *= -1; wl->wl_word = tprintf("%18.10e", dvalue); - state = S_value; /* skip the `unit', FIXME INPevaluate() should do this */ while (isalpha(*s)) s++;