New approach, new lexer
This commit is contained in:
53
test.cc
53
test.cc
@@ -1,9 +1,53 @@
|
||||
#if 0
|
||||
|
||||
|
||||
@register
|
||||
@param_expr(size)
|
||||
@param_type(Type)
|
||||
test::struct{
|
||||
Array_Block::struct{
|
||||
next: Array_Block*;
|
||||
data: Type[size];
|
||||
}
|
||||
|
||||
@inline Array::struct{
|
||||
first: Array_Block;
|
||||
last : Array_Block*;
|
||||
block: S64;
|
||||
len : S64;
|
||||
}
|
||||
|
||||
array_make::(arena: Arena*) Type {
|
||||
thing: Test_Type;
|
||||
result: Type;
|
||||
result.arena = arena;
|
||||
result.last = &result.first;
|
||||
return result;
|
||||
}
|
||||
|
||||
array_push::(array: Array*, item: Type*){
|
||||
if array->len+1 > size{
|
||||
assert(array->len);
|
||||
block: Array_Block* = cast(Thing)arena_push_struct(array->arena, sizeof(:Array_Block));
|
||||
array->last = array->last.next = block;
|
||||
array->len = 0;
|
||||
array->block += 1;
|
||||
}
|
||||
array->last.data[array->len++] = *item;
|
||||
}
|
||||
}
|
||||
|
||||
@test(size = 4096)
|
||||
OpenGL :: struct{
|
||||
glVertexAttribPointer: (GLuint, GLint, GLenum, GLboolean, GLsizei, GLvoid*);
|
||||
glBindTexture: (GLenum, GLuint);
|
||||
glDrawArrays: (GLenum, GLint, GLsizei);
|
||||
|
||||
test_array: int*[10];
|
||||
|
||||
thing : Things*;
|
||||
thing_cap: S64;
|
||||
thing_len: S64;
|
||||
}
|
||||
|
||||
OS_Memory::struct{
|
||||
@@ -92,6 +136,7 @@ Token_Kind::enum{
|
||||
Keyword,
|
||||
}
|
||||
|
||||
@array(type=block)
|
||||
Token::struct{
|
||||
kind:Token_Kind;
|
||||
@using string:String;
|
||||
@@ -105,11 +150,6 @@ Token::struct{
|
||||
line_begin:U8*;
|
||||
}
|
||||
|
||||
Tokens::struct{
|
||||
@array tokens: Token*;
|
||||
iter : S64;
|
||||
}
|
||||
|
||||
Lex_Stream::struct{
|
||||
stream: U8*;
|
||||
line_begin: U8*;
|
||||
@@ -217,6 +257,7 @@ Scope :: struct{
|
||||
last : AST_Node*;
|
||||
}
|
||||
|
||||
|
||||
Parser :: struct{
|
||||
main_arena: Arena;
|
||||
intern_table_arena: Arena;
|
||||
@@ -247,7 +288,7 @@ Parser :: struct{
|
||||
|
||||
// This works ok
|
||||
@sllqueue error: Parser_Error;
|
||||
@using token_array: Tokens;
|
||||
//@using token_array: Tokens;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user