1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-24 17:27:18 +00:00
janet/parse.h
Calvin Rose 9f09a19feb Add quoting and a global gc root. The gc root
provides global variables.
2017-03-14 19:13:17 -04:00

41 lines
932 B
C

#ifndef PARSE_H_ONYWMADW
#define PARSE_H_ONYWMADW
#include "datatypes.h"
typedef struct GstParser GstParser;
typedef struct GstParseState GstParseState;
/* Holds the parsing state */
struct GstParser {
Gst *vm;
const char *error;
GstParseState *data;
GstValue value;
uint32_t count;
uint32_t cap;
uint32_t index;
uint32_t flags;
uint32_t quoteCount;
enum {
GST_PARSER_PENDING = 0,
GST_PARSER_FULL,
GST_PARSER_ERROR
} status;
};
/* Some parser flags */
#define GST_PARSER_FLAG_INCOMMENT 1
#define GST_PARSER_FLAG_EXPECTING_COMMENT 2
/* Initialize a parser */
void gst_parser(GstParser *p, Gst *vm);
/* Parse a c style string. Returns number of bytes read */
int gst_parse_cstring(GstParser *p, const char *string);
/* Parse a gst string. Returns number of bytes read */
int gst_parse_string(GstParser *p, uint8_t *string);
#endif /* end of include guard: PARSE_H_ONYWMADW */