mirror of
https://github.com/Ed94/metadesk.git
synced 2026-06-30 23:31:48 -07:00
node errors sample
This commit is contained in:
@@ -11,6 +11,7 @@ cl %compile_flags% ..\samples\old_style_custom_layer.c
|
||||
cl %compile_flags% ..\samples\static_site_generator\static_site_generator.c
|
||||
cl %compile_flags% ..\samples\output_parse\output_parse.c
|
||||
cl %compile_flags% ..\samples\c_code_generation.c
|
||||
cl %compile_flags% ..\samples\node_errors\node_errors.c
|
||||
echo.
|
||||
echo ~~~ Build All Tests ~~~
|
||||
cl %compile_flags% ..\tests\sanity_tests.c
|
||||
@@ -55,4 +56,10 @@ echo.
|
||||
echo ~~~ Running C Code Generation Sample ~~~
|
||||
pushd build
|
||||
c_code_generation.exe
|
||||
popd
|
||||
popd
|
||||
|
||||
echo.
|
||||
echo ~~~ Running Error Generation Sample ~~~
|
||||
pushd build
|
||||
node_errors.exe %~dp0\samples\node_errors\node_errors.md
|
||||
popd
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// Sample code to demonstrate errors being reported for certain nodes.
|
||||
|
||||
#include "md.h"
|
||||
#include "md.c"
|
||||
|
||||
int main(int argument_count, char **arguments)
|
||||
{
|
||||
// NOTE(rjf): Parse all the files passed in via command line.
|
||||
MD_Node *first = MD_NilNode();
|
||||
MD_Node *last = MD_NilNode();
|
||||
for(int i = 1; i < argument_count; i += 1)
|
||||
{
|
||||
MD_Node *root = MD_ParseWholeFile(MD_S8CString(arguments[i]));
|
||||
MD_PushSibling(&first, &last, MD_NilNode(), root);
|
||||
}
|
||||
|
||||
// NOTE(rjf): Put errors on every single node.
|
||||
for(MD_EachNode(root, first))
|
||||
{
|
||||
for(MD_EachNode(node, root->first_child))
|
||||
{
|
||||
MD_NodeErrorF(node, "This node has an error!");
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
@foo @bar Foo:
|
||||
{
|
||||
x, y, z,
|
||||
a, b, c,
|
||||
1, 2, 3,
|
||||
}
|
||||
|
||||
@baz Blah:
|
||||
{
|
||||
x100 y200 z300
|
||||
}
|
||||
Reference in New Issue
Block a user