lang: lex: move structure definitions to a separate header
This commit is contained in:
55
lang/lex.h
Normal file
55
lang/lex.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#ifndef _LEX_H_
|
||||
#define _LEX_H_
|
||||
|
||||
#include <blue/core/queue.h>
|
||||
#include <blue/object/string.h>
|
||||
#include <blue/object/dict.h>
|
||||
#include <stdint.h>
|
||||
|
||||
struct ivy_lexer {
|
||||
struct ivy_lexer_symbol_node *lex_sym_tree;
|
||||
struct ivy_line_source *lex_source;
|
||||
b_dict *lex_keywords;
|
||||
enum ivy_status lex_status;
|
||||
|
||||
struct ivy_token *lex_queue;
|
||||
enum ivy_token_type lex_prev_token;
|
||||
|
||||
b_string *lex_temp;
|
||||
b_queue lex_state;
|
||||
unsigned int lex_brace_depth;
|
||||
|
||||
char *lex_linebuf;
|
||||
size_t lex_linebuf_len;
|
||||
size_t lex_linebuf_cap;
|
||||
size_t lex_linebuf_ptr;
|
||||
};
|
||||
|
||||
enum lexer_state_type {
|
||||
STATE_NORMAL,
|
||||
STATE_STRING,
|
||||
STATE_FSTRING,
|
||||
STATE_INTERPOLATION,
|
||||
};
|
||||
|
||||
struct lexer_state {
|
||||
enum lexer_state_type s_type;
|
||||
unsigned int s_brace_depth;
|
||||
b_queue_entry s_entry;
|
||||
};
|
||||
|
||||
struct ivy_lexer_symbol_node {
|
||||
char s_char;
|
||||
enum ivy_symbol s_id;
|
||||
|
||||
b_queue_entry s_entry;
|
||||
b_queue s_children;
|
||||
};
|
||||
|
||||
struct lex_token_def {
|
||||
int id;
|
||||
const char *name;
|
||||
uint64_t name_hash;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user