| 406 | } |
| 407 | |
| 408 | char *parseword(const char *&p, int arg, int *infix, int rec) // parse single argument, including expressions |
| 409 | { |
| 410 | p += strspn(p, " \t"); |
| 411 | if(p[0]=='/' && p[1]=='/') p += strcspn(p, "\n\r\0"); |
| 412 | if(*p=='"') return parsequotes(p); |
| 413 | if(*p=='(' && !currentcontextisolated) return parseexp(p, ')', rec + 1); // on isolated contexts, only quotes are parsed |
| 414 | if(*p=='[' && !currentcontextisolated) return parseexp(p, ']', rec + 1); |
| 415 | int lvls = currentcontextisolated ? 0 : strspn(p, "$"); |
| 416 | if(lvls && (p[lvls]=='(' || p[lvls]=='[')) |
| 417 | { // $() $[] |
| 418 | p += lvls; |
| 419 | char *b = parseexp(p, *p == '(' ? ')' : ']', rec + 1); |
| 420 | if(b) return lookup(b, lvls); |
| 421 | } |
| 422 | const char *word = p; |
| 423 | p += strcspn(p, "; \t\n\r\0"); |
| 424 | if(p-word==0) return NULL; |
| 425 | if(arg == 1 && *word == '=' && p - word == 1) *infix = *word; |
| 426 | return lvls ? lookup(newstring(word + lvls, p - word - lvls), lvls) : newstring(word, p-word); |
| 427 | } |
| 428 | |
| 429 | char *conc(const char **w, int n, bool space) |
| 430 | { |
no test coverage detected