1#ifndef _VOLK_PARSER_COMMON_H
2#define _VOLK_PARSER_COMMON_H
14#define YYCTYPE uint8_t
15#define YYCURSOR it->cur
16#define YYMARKER it->mar
17#define YYLIMIT it->lim
18#define YYFILL fill(it) == 0
52static void parse_init (
ParseIterator *it, FILE *fh,
const char *sh)
60 if (!it->
buf) log_error (
"Error allocating lexer buffer.");
85 log_debug (
"Filling codec buffer @ %p.", it->
buf);
86 if (it->
eof)
return 1;
88 size_t shift = it->
tok - it->
buf;
89 size_t used = it->
lim - it->
tok;
97 cur_off = it->
cur - it->
buf,
98 tok_off = it->
tok - it->
buf,
99 lim_off = it->
lim - it->
buf,
100 mar_off = it->
mar - it->
buf;
105 log_error (
"Memory allocation error.");
110 it->
cur = it->
buf + cur_off;
111 it->
tok = it->
buf + tok_off;
112 it->
lim = it->
buf + lim_off;
113 it->
mar = it->
buf + mar_off;
116 memmove (it->
buf, it->
tok, used);
117 LOG_TRACE (
"Limit offset before reading data: %zu", it->
lim - it->
tok);
#define YYCTYPE
TTL is UTF-8 encoded.
FILE * fh
Input file handle.
size_t buf_size
Initial allocation for buffer.
unsigned line
Current line no. (for debugging).
YYCTYPE * cur
Next input character to be read (YYCURSOR).
const char * sh
Input string. Exclusive with fh.
bool eof
if we have reached EOF.
YYCTYPE * buf
Start of buffer.
unsigned ct
Number of statements parsed.
YYCTYPE * mar
Most recent match (YYMARKER).
YYCTYPE * tok
Start of current token.