diff --git a/src/spicelib/parser/inpeval.c b/src/spicelib/parser/inpeval.c index 88939a872..4ad7bb3e6 100644 --- a/src/spicelib/parser/inpeval.c +++ b/src/spicelib/parser/inpeval.c @@ -26,16 +26,12 @@ INPevaluate(char **line, int *error, int gobble) /* setup */ tmpline = *line; - if (gobble == 1) { + if (gobble) { /* MW. INPgetUTok should be called with gobble=0 or it make * errors in v(1,2) exp */ *error = INPgetUTok(line, &token, 0); if (*error) return (0.0); - } else if (gobble == 2) { - *error = INPgetU2Tok(line, &token, 0); - if (*error) - return (0.0); } else { token = *line; *error = 0; diff --git a/src/spicelib/parser/inpgtok.c b/src/spicelib/parser/inpgtok.c index 28fdd48f1..35b71c1c7 100644 --- a/src/spicelib/parser/inpgtok.c +++ b/src/spicelib/parser/inpgtok.c @@ -345,141 +345,3 @@ INPgetUTok(char **line, char **token, int gobble) return (OK); } - - -/*------------------------------------------------------------------- - * INPgetUTok plus points < > ? :, called from INPevaluate called - * from INPevaluate with gobble == 2 - * fcn added to avoid unforeseeable side effects during other calls - * to INPevaluate. - *------------------------------------------------------------------*/ - -int -INPgetU2Tok(char **line, char **token, int gobble) -/* gobble: eat non-whitespace trash AFTER token? */ -{ - char *point, separator; - int signstate; - - /* scan along throwing away garbage characters */ - for (point = *line; *point != '\0'; point++) { - if (*point == ' ') - continue; - if (*point == '\t') - continue; - if (*point == '=') - continue; - if (*point == '(') - continue; - if (*point == ')') - continue; - if (*point == ',') - continue; - break; - } - - if (*point == '"') { - separator = '"'; - point++; - } else if (*point == '\'') { - separator = '\''; - point++; - } else - separator = 0; - - /* mark beginning of token */ - *line = point; - - /* now find all good characters */ - signstate = 0; - for (point = *line; *point != '\0'; point++) { - - if (separator) { - if (*point == separator) - break; - else - continue; - } - - if (*point == ' ') - break; - if (*point == '\t') - break; - if (*point == '=') - break; - if (*point == '(') - break; - if (*point == ')') - break; - if (*point == ',') - break; - /* This is not complex enough to catch all errors, but it will - get the "good" parses */ - if (*point == '+' && (signstate == 1 || signstate == 3)) - break; - if (*point == '-') { - if (signstate == 1 || signstate == 3) - break; - signstate += 1; - continue; - } - if (*point == '*') - break; - if (*point == '/') - break; - if (*point == '^') - break; - if (*point == '<') - break; - if (*point == '>') - break; - if (*point == '?') - break; - if (*point == ':') - break; - - if (isdigit(*point) || *point == '.') { - if (signstate > 1) - signstate = 3; - else - signstate = 1; - } else if (tolower(*point) == 'e' && signstate == 1) - signstate = 2; - else - signstate = 3; - } - - if (separator && *point == separator) - point--; - - if (point == *line && *point) /* Weird items, 1 char */ - point++; - - *token = copy_substring(*line, point); - if (!*token) - return (E_NOMEM); - - /* gobble garbage to next token */ - for (; *point != '\0'; point++) { - if (*point == separator) - continue; - if (*point == ' ') - continue; - if (*point == '\t') - continue; - if ((*point == '=') && gobble) - continue; - if ((*point == ',') && gobble) - continue; - break; - } - - *line = point; - -#ifdef TRACE - /* SDB debug statement */ - /* printf("found refdes token (%s) and rest of line (%s)\n",*token,*line); */ -#endif - - return (OK); -}