New approach, new lexer

This commit is contained in:
Krzosa Karol
2022-05-06 10:13:16 +02:00
parent 557dde1936
commit e3b5e9b33a
33 changed files with 3331 additions and 784 deletions

20
lang.h
View File

@@ -4,7 +4,7 @@
#define function static
#define assert(x) do{if(!(x)) __debugbreak();}while(0)
#define assert_msg(x,msg) assert(x)
#define assert_msg(x,...) assert(x)
#define not_implemented assert_msg(0, "Not implemented")
#define invalid_codepath assert_msg(0, "Invalid codepath")
@@ -35,12 +35,30 @@ const B32 false = 0;
#define kib(x) ((x)*1024llu)
#define mib(x) (kib(x)*1024llu)
#define gib(x) (mib(x)*1024llu)
#define string_expand(x) (int)x.len, x.str
typedef struct String_Node String_Node;
typedef struct String_List String_List;
typedef struct String{
U8 *str;
S64 len;
}String;
struct String_Node{
String_Node *next;
union{
String string;
struct{U8*str; S64 len;};
};
};
struct String_List{
String_Node *first;
String_Node *last;
S64 char_count;
S64 node_count;
};
#define SLLQueuePushMod(f,l,n,next) do{\
if((f)==0){\
(f)=(l)=(n);\