diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2018-02-01 08:31:01 +0200 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-02-12 03:34:18 +0200 |
commit | f54e7e8c2aeb4fafebf0d5bd5570b060462c9ecf (patch) | |
tree | b3bcc7ca21cda7d655bfcc0d9ec26d4a6668f27f /src/util/ragel/ragel.h |
Initial commit
Diffstat (limited to 'src/util/ragel/ragel.h')
-rw-r--r-- | src/util/ragel/ragel.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/util/ragel/ragel.h b/src/util/ragel/ragel.h new file mode 100644 index 0000000..b2c7572 --- /dev/null +++ b/src/util/ragel/ragel.h @@ -0,0 +1,30 @@ +#pragma once + +#include <stdint.h> +#include <stdbool.h> + +struct ragel_mem { + const char *data, *end; + bool binary; // binary input bit +}; + +struct ragel { + struct ragel_mem input; // block of input data + uint64_t lineno; // current line + const char *p, *pe, *eof; // see ragel doc + const char *cl; // current line start + const char *name; // may be current file name for example + bool error; // error thrown bit +}; + +__attribute__((format(printf, 2, 3))) void +ragel_throw_error(struct ragel *ragel, const char *fmt, ...); + +void +ragel_set_name(struct ragel *ragel, const char *name); + +void +ragel_advance_line(struct ragel *ragel); + +void +ragel_feed_input(struct ragel *ragel, const bool eof, const struct ragel_mem *input); |