mirror of
https://github.com/Ed94/metadesk.git
synced 2026-07-31 11:50:05 +00:00
misc
This commit is contained in:
@@ -4,24 +4,25 @@
|
||||
|
||||
//~ includes and globals //////////////////////////////////////////////////////
|
||||
|
||||
#include "md.h"
|
||||
#include "md.c"
|
||||
|
||||
static MD_Arena *arena = 0;
|
||||
#include "gen_c11/gen/metadesk.c"
|
||||
|
||||
//~ main //////////////////////////////////////////////////////////////////////
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
MD_Context ctx = {0};
|
||||
init(& ctx);
|
||||
|
||||
// setup the global arena
|
||||
arena = MD_ArenaAlloc();
|
||||
// arena = MD_ArenaAlloc();
|
||||
|
||||
// parse a string
|
||||
MD_String8 name = MD_S8Lit("<name>");
|
||||
MD_String8 hello_world = MD_S8Lit("hello world");
|
||||
ParseResult parse = MD_ParseWholeString(arena, name, hello_world);
|
||||
String8 name = md_s8_lit("<name>");
|
||||
String8 hello_world = md_s8_lit("hello world");
|
||||
ParseResult parse = md_parse_whole_string(arena, name, hello_world);
|
||||
|
||||
// print the results
|
||||
MD_PrintDebugDumpFromNode(stdout, parse.node, MD_GenerateFlags_All);
|
||||
// MD_PrintDebugDumpFromNode(stdout, parse.node, MD_GenerateFlags_All);
|
||||
md_print_debug_dump_from_node(stdout, parse.node, MD_GenerateFlags_All);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
** Example: hello world
|
||||
*/
|
||||
|
||||
//~ includes and globals //////////////////////////////////////////////////////
|
||||
|
||||
#include "gen_cpp17/gen/metadesk.cpp"
|
||||
|
||||
//~ main //////////////////////////////////////////////////////////////////////
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
using md;
|
||||
Context ctx = {0};
|
||||
init(& ctx);
|
||||
|
||||
// setup the global arena
|
||||
// arena = MD_ArenaAlloc();
|
||||
|
||||
// parse a string
|
||||
String8 name = s8_lit("<name>");
|
||||
String8 hello_world = s8_lit("hello world");
|
||||
ParseResult parse = parse_whole_string(arena, name, hello_world);
|
||||
|
||||
// print the results
|
||||
// MD_PrintDebugDumpFromNode(stdout, parse.node, MD_GenerateFlags_All);
|
||||
print_debug_dump_from_node(stdout, parse.node, MD_GenerateFlags_All);
|
||||
}
|
||||
Reference in New Issue
Block a user