Mach/builder/inc-c/parser.h

48 lines
810 B
C
Raw Normal View History

#ifndef MACH_PARSER_H
#define MACH_PARSER_H
#include <librr/types.h>
#include <librr/runes.h>
typedef struct MachToken MachToken;
typedef struct MachTokenStream MachTokenStream;
typedef enum
{
MACH_TOKEN_WORD,
MACH_TOKEN_INTEGER,
MACH_TOKEN_STRING,
MACH_TOKEN_SPECIAL_SIGN,
MACH_TOKEN_STREAM_END,
} MachTokenType;
struct MachTokenStream
{
usz_t len_source;
char *source;
usz_t num_tokens;
MachToken *tokens;
};
struct MachToken
{
u32_t offset;
u32_t length;
MachTokenType type;
union {
rr_ascii_sign_e sign_type;
char *processed_string;
} data;
};
i32_t mach_tokenize(MachTokenStream *stream);
void mach_display_token_stream(MachTokenStream *stream);
#endif // MACH_PARSER_H