Lines Matching refs:ex

41 trace(Expr_t* ex, int lev, char* op, int c)
193 error(TRACE_lex + lev, "%s: [%d] %04d%s%s", op, ex->input->nesting, c, s, t);
203 extoken(Expr_t* ex)
209 c = extoken(ex);
210 trace(ex, 0, "exlex", c);
225 lex(register Expr_t* ex)
231 if (c = ex->input->peek)
232 ex->input->peek = 0;
233 else if (ex->input->pp)
235 if (!(c = *ex->input->pp++))
237 ex->input->pp = 0;
241 else if (ex->input->sp)
243 if (!(c = *ex->input->sp++))
245 if (!expop(ex))
247 else trace(ex, -1, "expop sp FAIL", 0);
248 ex->input->sp--;
251 else if (ex->input->fp)
253 if ((c = sfgetc(ex->input->fp)) == EOF)
255 if (!expop(ex))
257 else trace(ex, -1, "expop fp FAIL", 0);
260 else if ((ex->disc->flags & EX_INTERACTIVE) && c == '\n' && ex->input->next && !ex->input->next->next && ex->input->nesting <= 0)
263 expop(ex);
264 trace(ex, -1, "expop sp FORCE", 0);
270 setcontext(ex);
272 putcontext(ex, c);
273 trace(ex, -3, "ex--lex", c);
283 extoken(register Expr_t* ex)
292 if (ex->eof || ex->errors)
296 switch (c = lex(ex))
301 switch (q = lex(ex))
304 for (;;) switch (lex(ex))
312 switch (lex(ex))
322 exunlex(ex, '*');
331 while ((c = lex(ex)) != '\n')
350 ex->input->nesting++;
355 ex->input->nesting--;
359 if ((q = lex(ex)) == c)
365 q = lex(ex);
372 if (ex->input->fp)
373 ex->more = (const char*)ex->input->fp;
374 else ex->more = ex->input->sp;
377 else exunlex(ex, q);
381 if ((q = lex(ex)) == '=')
388 else exunlex(ex, q);
392 if ((q = lex(ex)) == c)
395 if ((q = lex(ex)) == '=')
397 else exunlex(ex, q);
403 q = lex(ex);
420 else exunlex(ex, q);
423 if (!ex->linewrap && !(ex->disc->flags & EX_PURE))
425 s = ex->linep - 1;
426 while (s > ex->line && isspace(*(s - 1)))
428 if (s == ex->line)
430 switch (extoken(ex))
443 if (extoken(ex) != STRING)
445 else if (!expush(ex, exlval.string, 1, NiL, NiL))
447 setcontext(ex);
458 sfstrseek(ex->tmp, 0, SEEK_SET);
459 ex->input->nesting++;
460 while ((c = lex(ex)) != q)
464 sfputc(ex->tmp, c);
465 c = lex(ex);
478 sfputc(ex->tmp, c);
480 ex->input->nesting--;
481 s = exstash(ex->tmp, NiL);
482 if (q == '"' || (ex->disc->flags & EX_CHARSTRING))
484 if (!(exlval.string = vmstrdup(ex->vm, s)))
492 if (isdigit(c = lex(ex)))
494 sfstrseek(ex->tmp, 0, SEEK_SET);
495 sfputc(ex->tmp, '0');
496 sfputc(ex->tmp, '.');
499 exunlex(ex, c);
503 sfstrseek(ex->tmp, 0, SEEK_SET);
504 sfputc(ex->tmp, c);
507 if ((c = lex(ex)) == 'x' || c == 'X')
510 sfputc(ex->tmp, c);
513 switch (c = lex(ex))
519 sfputc(ex->tmp, c);
529 sfputc(ex->tmp, c);
530 c = lex(ex);
534 s = exstash(ex->tmp, NiL);
538 sfputc(ex->tmp, c);
539 } while (isalnum(c = lex(ex)));
547 sfputc(ex->tmp, c);
548 while (isdigit(c = lex(ex)))
549 sfputc(ex->tmp, c);
554 sfputc(ex->tmp, c);
555 if ((c = lex(ex)) == '-' || c == '+')
557 sfputc(ex->tmp, c);
558 c = lex(ex);
562 sfputc(ex->tmp, c);
563 c = lex(ex);
568 s = exstash(ex->tmp, NiL);
576 c = lex(ex);
587 exunlex(ex, c);
597 sfstrseek(ex->tmp, 0, SEEK_SET);
598 sfputc(ex->tmp, c);
599 while (isalnum(c = lex(ex)) || c == '_' || c == '$')
600 sfputc(ex->tmp, c);
601 exunlex(ex, c);
602 s = exstash(ex->tmp, NiL);
603 v = expr.declare ? dtview(ex->symbols, NiL) : (Dt_t*)0;
604 exlval.id = (Exid_t*)dtmatch(ex->symbols, s);
606 dtview(ex->symbols, v);
622 if (c == ':' && !expr.nolabel && ex->frame && ex->frame->view)
623 dtinsert(ex->frame->view, exlval.id);
625 dtinsert(ex->symbols, exlval.id);
644 lex(ex);
673 sfstrseek(ex->tmp, 0, SEEK_SET);
678 for (c = t = lex(ex);; c = lex(ex))
685 switch (q = lex(ex))
690 switch (lex(ex))
698 switch (lex(ex))
708 exunlex(ex, '*');
719 sfputc(ex->tmp, ' ');
724 while ((c = lex(ex)) != '\n')
731 sfputc(ex->tmp, '\n');
735 sfputc(ex->tmp, c);
736 sfputc(ex->tmp, q);
745 sfputc(ex->tmp, '\n');
751 sfputc(ex->tmp, ' ');
775 sfputc(ex->tmp, c);
783 exunlex(ex, c);
786 sfputc(ex->tmp, c);
798 sfputc(ex->tmp, c);
803 sfputc(ex->tmp, c);
804 ex->input->nesting++;
806 while ((c = lex(ex)) != q)
810 sfputc(ex->tmp, c);
811 c = lex(ex);
824 sfputc(ex->tmp, c);
826 ex->input->nesting--;
830 sfputc(ex->tmp, c);
835 (*ex->disc->reff)(ex, NiL, exlval.id, NiL, exstash(ex->tmp, NiL), 0, ex->disc);
846 ex->eof = 1;