mirror of
https://github.com/Ed94/metadesk.git
synced 2026-07-31 20:00:07 +00:00
mdesk: at tree introspection
This commit is contained in:
@@ -231,10 +231,10 @@ MD_ExprOprPush(arena, &list, MD_ExprOprKind_##k, p, MD_S8Lit(t), Op##e, 0);
|
||||
}
|
||||
|
||||
// print the verbose parse results
|
||||
for (MD_EachNode(root_it, list->first_child))
|
||||
for (each_node(root_it, list->first_child))
|
||||
{
|
||||
Node *root = MD_ResolveNodeFromReference(root_it);
|
||||
for (MD_EachNode(node, root->first_child))
|
||||
for (each_node(node, root->first_child))
|
||||
{
|
||||
MD_ExprParseResult parse = MD_ExprParse(arena, &table, node->first_child, MD_NilNode());
|
||||
|
||||
|
||||
@@ -210,13 +210,13 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
// apply expression parsing to each top level node
|
||||
for (MD_EachNode(root_it, list->first_child))
|
||||
for (each_node(root_it, list->first_child))
|
||||
{
|
||||
// init eval map
|
||||
eval_map = MD_MapMake(arena);
|
||||
|
||||
Node *root = MD_ResolveNodeFromReference(root_it);
|
||||
for (MD_EachNode(node, root->first_child))
|
||||
for (each_node(node, root->first_child))
|
||||
{
|
||||
// @notes An expression parse is an extra stage of analysis on top
|
||||
// of the initial Metadesk parse. It takes in a range of Metadesk
|
||||
|
||||
@@ -184,7 +184,7 @@ main(int argc, char **argv)
|
||||
fprintf(stdout, "on thread %d:\n", i);
|
||||
|
||||
// print the name of each root
|
||||
for (MD_EachNode(root_it, threads[i].list->first_child))
|
||||
for (each_node(root_it, threads[i].list->first_child))
|
||||
{
|
||||
Node *root = MD_ResolveNodeFromReference(root_it);
|
||||
fprintf(stdout, "%.*s\n", MD_S8VArg(root->string));
|
||||
|
||||
@@ -71,10 +71,10 @@ int main(int argument_count, char **arguments)
|
||||
if (!failed_parse)
|
||||
{
|
||||
Initialize();
|
||||
for(MD_EachNode(ref, list->first_child))
|
||||
for(each_node(ref, list->first_child))
|
||||
{
|
||||
Node *root = MD_ResolveNodeFromReference(ref);
|
||||
for(MD_EachNode(node, root->first_child))
|
||||
for(each_node(node, root->first_child))
|
||||
{
|
||||
TopLevel(node);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
|
||||
// list. The second parameter is a pointer to the first node of the list.
|
||||
// Generally we past the `first_child` of a list or parent Node, but we
|
||||
// don't always have to.
|
||||
for (MD_EachNode(root_it, list->first_child))
|
||||
for (each_node(root_it, list->first_child))
|
||||
{
|
||||
|
||||
// @notes The `list` we have been building does not contain a normal
|
||||
@@ -81,7 +81,7 @@ int main(int argc, char **argv)
|
||||
// get the root of the parse tree.
|
||||
Node *root = MD_ResolveNodeFromReference(root_it);
|
||||
|
||||
for (MD_EachNode(node, root->first_child))
|
||||
for (each_node(node, root->first_child))
|
||||
{
|
||||
// @notes The Metadesk library likes to use MD_String8List for
|
||||
// functions that build and return big strings. This simplifies
|
||||
|
||||
@@ -208,10 +208,10 @@ gen_check_and_do_duplicate_symbol_error(Node *new_node)
|
||||
void
|
||||
gen_gather_types_and_maps(Node *list)
|
||||
{
|
||||
for(MD_EachNode(ref, list->first_child))
|
||||
for(each_node(ref, list->first_child))
|
||||
{
|
||||
Node *root = MD_ResolveNodeFromReference(ref);
|
||||
for(MD_EachNode(node, root->first_child))
|
||||
for(each_node(node, root->first_child))
|
||||
{
|
||||
// gather type
|
||||
Node *type_tag = MD_TagFromString(node, MD_S8Lit("type"), 0);
|
||||
@@ -275,10 +275,10 @@ gen_check_duplicate_member_names(void)
|
||||
type = type->next)
|
||||
{
|
||||
Node *type_root_node = type->node;
|
||||
for (MD_EachNode(member_node, type_root_node->first_child))
|
||||
for (each_node(member_node, type_root_node->first_child))
|
||||
{
|
||||
MD_String8 name = member_node->string;
|
||||
for (MD_EachNode(check_node, type_root_node->first_child))
|
||||
for (each_node(check_node, type_root_node->first_child))
|
||||
{
|
||||
if (member_node == check_node)
|
||||
{
|
||||
@@ -362,7 +362,7 @@ gen_equip_struct_members(void)
|
||||
int member_count = 0;
|
||||
|
||||
Node *type_root_node = type->node;
|
||||
for (MD_EachNode(member_node, type_root_node->first_child))
|
||||
for (each_node(member_node, type_root_node->first_child))
|
||||
{
|
||||
Node *type_name_node = member_node->first_child;
|
||||
|
||||
@@ -523,7 +523,7 @@ gen_equip_enum_members(void)
|
||||
int next_implicit_value = 0;
|
||||
|
||||
Node *type_root_node = type->node;
|
||||
for (MD_EachNode(enumerant_node, type_root_node->first_child))
|
||||
for (each_node(enumerant_node, type_root_node->first_child))
|
||||
{
|
||||
Node *value_node = enumerant_node->first_child;
|
||||
int value = 0;
|
||||
|
||||
@@ -58,7 +58,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
// check for custom errors
|
||||
for(MD_EachNode(ref, list->first_child))
|
||||
for(each_node(ref, list->first_child))
|
||||
{
|
||||
Node *root = MD_ResolveNodeFromReference(ref);
|
||||
|
||||
@@ -66,7 +66,7 @@ int main(int argc, char **argv)
|
||||
// so we can check for them by visiting each node from the root.
|
||||
// The example "type metadata" includes more advanced custom errors
|
||||
// that are only discovered after more analysis.
|
||||
for(MD_EachNode(node, root->first_child))
|
||||
for(each_node(node, root->first_child))
|
||||
{
|
||||
|
||||
// top level node should have one or zero tags.
|
||||
|
||||
Reference in New Issue
Block a user