sandbox/parser.h

23 lines
478 B
C
Raw Normal View History

#ifndef __KF_PARSER_H__
#define __KF_PARSER_H__
#include "defs.h"
struct Token {
char *token;
uint8_t length;
};
2018-02-23 22:01:52 +00:00
typedef enum _PARSE_RESULT_ : uint8_t {
PARSE_OK = 0,
PARSE_EOB = 1, // end of buffer
PARSE_LEN = 2, // token is too long
PARSE_FAIL = 3 // catch-all error
} PARSE_RESULT;
bool match_token(const char *, const size_t, const char *, const size_t);
PARSE_RESULT parse_next(const char *, const size_t, size_t *, struct Token *);
#endif // __KF_PARSER_H__