29#if defined(TRACE_lex) && TRACE_lex
139 snprintf(t = buf,
sizeof(buf),
"%llu", (
unsigned long long)
ex_lval.
integer);
232 error(TRACE_lex + lev,
"%s: [%d] %04d%s%s (%x)", op, ex->input->nesting, c,
s, t, x);
235 error(TRACE_lex + lev,
"%s: [%d] %04d%s%s", op, ex->input->nesting, c,
s, t);
245extern int _extoken_fn_(
Expr_t*);
252#define extoken_fn _extoken_fn_
255 trace(ex, 0,
"ex_lex", c);
261#define trace(p,a,b,c) do { } while (0)
276 if ((c = ex->input->peek))
278 else if (ex->input->pp)
280 if (!(c = *ex->input->pp++))
286 else if (ex->input->fp)
288 if ((c = getc(ex->input->fp)) == EOF)
292 else trace(ex, -1,
"expop fp FAIL", 0);
301 trace(ex, -3,
"ex--lex", c);
319 if (ex->eof || ex->errors)
331 for (;;)
switch (
lex(ex))
358 while ((c =
lex(ex)) !=
'\n')
378 ex->input->nesting++;
383 ex->input->nesting--;
387 if ((q =
lex(ex)) == c)
398 else if (q ==
'%' && c ==
'%')
406 if ((q =
lex(ex)) ==
'=')
412 c = c ==
'&' ?
AND :
OR;
417 if ((q =
lex(ex)) == c)
420 if ((q =
lex(ex)) ==
'=')
430 if (q ==
'=')
switch (c)
470 exerror(
"#%s: string argument expected",
s);
477 else exerror(
"unknown directive");
485 ex->input->nesting++;
486 while ((c =
lex(ex)) != q)
495 exerror(
"unterminated %c string", q);
506 ex->input->nesting--;
526 case '0':
case '1':
case '2':
case '3':
case '4':
527 case '5':
case '6':
case '7':
case '8':
case '9': {
532 if ((c =
lex(ex)) ==
'x' || c ==
'X')
566 if (c ==
'e' || c ==
'E')
570 if ((c =
lex(ex)) ==
'-' || c ==
'+')
588 if (c ==
'u' || c ==
'U')
598 if (*e ||
gv_isalpha(c) || c ==
'_' || c ==
'$')
600 exerror(
"%s: invalid numeric constant",
s);
634 if (c ==
':' && !
expr.
nolabel && ex->frame && ex->frame->view)
689 for (c = t =
lex(ex);; c =
lex(ex))
737 while ((c =
lex(ex)) !=
'\n')
802 if (c == pc && --n <= 0)
819 ex->input->nesting++;
821 while ((c =
lex(ex)) != q)
830 exerror(
"unterminated %c string", q);
841 ex->input->nesting--;
static void agxbclear(agxbuf *xb)
resets pointer to data
static WUR char * agxbuse(agxbuf *xb)
static int agxbputc(agxbuf *xb, char c)
add character to buffer
char * fmtesc(const char *as)
CDT_API Dt_t * dtview(Dt_t *, Dt_t *)
void exerror(const char *format,...)
int expush(Expr_t *, const char *, int, FILE *)
int extoken_fn(Expr_t *ex)
#define trace(p, a, b, c)
replacements for ctype.h functions
static bool gv_isxdigit(int c)
static bool gv_isalnum(int c)
static bool gv_isdigit(int c)
static bool gv_isalpha(int c)
static bool gv_isspace(int c)
static bool streq(const char *a, const char *b)
are a and b equal?
void * vmalloc(Vmalloc_t *vm, size_t size)
char * vmstrdup(Vmalloc_t *, const char *)