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);
318 if (ex->eof || ex->errors)
330 for (;;)
switch (
lex(ex))
357 while ((c =
lex(ex)) !=
'\n')
377 ex->input->nesting++;
382 ex->input->nesting--;
386 if ((q =
lex(ex)) == c)
397 else if (q ==
'%' && c ==
'%')
405 if ((q =
lex(ex)) ==
'=')
411 c = c ==
'&' ?
AND :
OR;
416 if ((q =
lex(ex)) == c)
419 if ((q =
lex(ex)) ==
'=')
429 if (q ==
'=')
switch (c)
469 exerror(
"#%s: string argument expected",
s);
476 else exerror(
"unknown directive");
484 ex->input->nesting++;
485 while ((c =
lex(ex)) != q)
494 exerror(
"unterminated %c string", q);
505 ex->input->nesting--;
525 case '0':
case '1':
case '2':
case '3':
case '4':
526 case '5':
case '6':
case '7':
case '8':
case '9': {
531 if ((c =
lex(ex)) ==
'x' || c ==
'X')
565 if (c ==
'e' || c ==
'E')
569 if ((c =
lex(ex)) ==
'-' || c ==
'+')
587 if (c ==
'u' || c ==
'U')
597 if (*e ||
gv_isalpha(c) || c ==
'_' || c ==
'$')
599 exerror(
"%s: invalid numeric constant",
s);
629 if (c ==
':' && !
expr.
nolabel && ex->frame && ex->frame->view)
684 for (c = t =
lex(ex);; c =
lex(ex))
732 while ((c =
lex(ex)) !=
'\n')
797 if (c == pc && --n <= 0)
814 ex->input->nesting++;
816 while ((c =
lex(ex)) != q)
825 exerror(
"unterminated %c string", q);
836 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)
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 *)