Skip to content

Commit 24a52fd

Browse files
committed
feature: visual represntation struct some other stuff, cleaned up parser
i suck
1 parent 2b83152 commit 24a52fd

5 files changed

Lines changed: 450 additions & 336 deletions

File tree

source/editor/editor_app.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
#include "editor_random.h"
88
#include "editor_libs.h"
99
#include "editor_gl.h"
10-
#include "editor_app.h"
1110

1211
#include "editor_lexer.h"
1312
#include "editor_lexer.c"
1413

1514
#include "editor_parser.h"
1615
#include "editor_parser.c"
1716

17+
#include "editor_app.h"
18+
1819
#define U32ToV3Arg(Hex) \
1920
((f32)((Hex >> 8 * 2) & 0xFF) / 255.0f), \
2021
((f32)((Hex >> 8 * 1) & 0xFF) / 255.0f), \
@@ -329,8 +330,7 @@ UPDATE_AND_RENDER(UpdateAndRender)
329330
else if(Key.Codepoint == PlatformKey_F2)
330331
{
331332
token_list *List = Lex(App, PermanentArena);
332-
concrete_syntax_tree *Tree = Parse(PermanentArena, List);
333-
visualize_tree(Tree, PermanentArena, Buffer, Input);
333+
App->tree = Parse(PermanentArena, List);
334334
}
335335
}
336336
}
@@ -390,6 +390,13 @@ UPDATE_AND_RENDER(UpdateAndRender)
390390
GlobalRectsCount = 0;
391391
GlobalRectQuadData = (rect_instance *)(RectsBufferData + ArrayCount(QuadPosData));
392392

393+
394+
// in the draw rectangles block, after the window border:
395+
if(App->tree)
396+
{
397+
visualize_tree(App->tree, PermanentArena, Buffer, Input);
398+
}
399+
393400
//- Render text (rasterized on CPU)
394401
app_offscreen_buffer TextImage;
395402
{

source/editor/editor_app.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ struct font_atlas
3737
stbtt_aligned_quad *AlignedQuads;
3838
};
3939

40+
// forward declaration for now
41+
struct concrete_syntax_tree;
42+
4043
typedef struct app_state app_state;
4144
struct app_state
4245
{
@@ -51,6 +54,7 @@ struct app_state
5154

5255
s32 CursorPos;
5356
u64 CurrentScopeHandle;
57+
concrete_syntax_tree *tree;
5458
};
5559

5660
//~ Globals

0 commit comments

Comments
 (0)