31#if defined(TRACE_lex) && TRACE_lex
141 snprintf(t = buf,
sizeof(buf),
"%llu", (
unsigned long long)
ex_lval.
integer);
234 error(TRACE_lex + lev,
"%s: [%d] %04d%s%s (%x)", op, ex->input->nesting, c,
s, t, x);
237 error(TRACE_lex + lev,
"%s: [%d] %04d%s%s", op, ex->input->nesting, c,
s, t);
247extern int _extoken_fn_(
Expr_t*);
254#define extoken_fn _extoken_fn_
257 trace(ex, 0,
"ex_lex", c);
263#define trace(p,a,b,c) do { } while (0)
278 if ((c = ex->input->peek))
280 else if (ex->input->pp)
282 if (!(c = *ex->input->pp++))
288 else if (ex->input->fp)
290 if ((c = getc(ex->input->fp)) == EOF)
294 else trace(ex, -1,
"expop fp FAIL", 0);
303 trace(ex, -3,
"ex--lex", c);
320 if (ex->eof || ex->errors)
332 for (;;)
switch (
lex(ex))
359 while ((c =
lex(ex)) !=
'\n')
379 ex->input->nesting++;
384 ex->input->nesting--;
388 if ((q =
lex(ex)) == c)
399 else if (q ==
'%' && c ==
'%')
407 if ((q =
lex(ex)) ==
'=')
413 c = c ==
'&' ?
AND :
OR;
418 if ((q =
lex(ex)) == c)
421 if ((q =
lex(ex)) ==
'=')
431 if (q ==
'=')
switch (c)
471 exerror(
"#%s: string argument expected",
s);
478 else exerror(
"unknown directive");
486 ex->input->nesting++;
487 while ((c =
lex(ex)) != q)
496 exerror(
"unterminated %c string", q);
507 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);
626 if (c ==
':' && !
expr.
nolabel && ex->frame && ex->frame->view)
681 for (c = t =
lex(ex);; c =
lex(ex))
729 while ((c =
lex(ex)) !=
'\n')
794 if (c == pc && --n <= 0)
811 ex->input->nesting++;
813 while ((c =
lex(ex)) != q)
822 exerror(
"unterminated %c string", q);
833 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
void * gv_arena_alloc(arena_t *arena, size_t alignment, size_t size)
char * gv_arena_strdup(arena_t *arena, const char *s)
Region-based memory allocator.
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?