/* date = July 9th 2023 11:08 am */ #ifndef VN_SCENE_H #define VN_SCENE_H //////////////////////////////// //~ sixten: Scene Node Types enum scene_node_kind { S_NodeKind_Invalid, S_NodeKind_File, S_NodeKind_Proc, S_NodeKind_Text, S_NodeKind_Branch, S_NodeKind_Count, }; struct scene_node { scene_node *Next; scene_node *Prev; scene_node *First; scene_node *Last; scene_node *Parent; scene_node *FirstTag; scene_node *LastTag; scene_node_kind Kind; string String; u64 SourceOffset; }; //////////////////////////////// //~ sixten: Scene Messages enum scene_message_type { S_MessageType_Invalid, S_MessageType_Note, S_MessageType_Warning, S_MessageType_Error, }; struct scene_message { scene_message_type Type; scene_message *Next; scene_node *Node; string String; }; struct scene_message_list { scene_message *First; scene_message *Last; s64 Count; }; //////////////////////////////// //~ sixten: Text -> Tokens struct scene_tokenize_result { token_array Tokens; scene_message_list Messages; }; struct scene_parse_context { token *TokensStart; token *TokensEnd; token *Token; }; //////////////////////////////// //~ sixten: Tokens -> Syntax Tree struct scene_parse_result { scene_node *Root; scene_message_list Messages; }; //////////////////////////////// //~ sixten: Scene Message Functions static void S_PushMessage(memory_arena *Arena, scene_message_list *Messages, scene_node *Node, scene_message_type Type, string String);; //////////////////////////////// //~ sixten: Scene Node Functions static scene_node *S_PushNode(memory_arena *Arena, scene_node_kind Kind, string String); static scene_node *S_SceneFromText(memory_arena *Arena, string Text); //////////////////////////////// //~ sixten: Tokens -> Syntax Tree static scene_node *S_ParseProc(scene_parse_context *Context, string ProcName); static scene_parse_result S_ParseFromTokens(memory_arena *Arena, string Filename, string Text, token_array Tokens); #endif //VN_SCENE_H