[docs] documentation of MD_Node

This commit is contained in:
Allen Webster
2021-03-30 19:02:00 -07:00
parent e38dbca401
commit c30090c483
3 changed files with 37 additions and 16 deletions
+5 -3
View File
@@ -356,7 +356,6 @@ struct MD_Node
MD_String8 string;
MD_String8 whole_string;
MD_u64 string_hash;
MD_Node *ref_target;
// Comments.
MD_String8 comment_before;
@@ -366,6 +365,9 @@ struct MD_Node
MD_String8 filename;
MD_u8 *file_contents;
MD_u8 *at;
// Reference.
MD_Node *ref_target;
};
//~ Code Location Info.
@@ -749,8 +751,8 @@ MD_FUNCTION MD_Node * MD_Deref(MD_Node *node);
// NOTE(rjf): For-Loop Helpers
#define MD_EachNode(it, first) MD_Node *it = (first); !MD_NodeIsNil(it); it = it->next
#define MD_EachNodeRef(it, first) MD_Node *it##_r = (first), *it = MD_Deref(it##_r); \
!MD_NodeIsNil(it##_r); \
it##_r = it##_r->next, it = MD_Deref(it##_r)
!MD_NodeIsNil(it##_r); \
it##_r = it##_r->next, it = MD_Deref(it##_r)
//~ Error/Warning Helpers
MD_FUNCTION void MD_NodeMessage(MD_Node *node, MD_MessageKind kind, MD_String8 str);
+7 -7
View File
@@ -2213,13 +2213,13 @@ MD_PushTag(MD_Node *node, MD_Node *tag)
}
MD_FUNCTION_IMPL MD_b32
MD_NodeMatch(MD_Node *a, MD_Node *b, MD_StringMatchFlags str_flags, MD_NodeMatchFlags node_flags)
MD_NodeMatch(MD_Node *a, MD_Node *b, MD_StringMatchFlags str_flags, MD_NodeMatchFlags match_flags)
{
MD_b32 result = 0;
if(a->kind == b->kind && MD_StringMatch(a->string, b->string, str_flags))
{
result = 1;
if(a->kind != MD_NodeKind_Tag && node_flags & MD_NodeMatchFlag_Tags)
if(a->kind != MD_NodeKind_Tag && (match_flags & MD_NodeMatchFlag_Tags))
{
for(MD_Node *a_tag = a->first_tag, *b_tag = b->first_tag;
!MD_NodeIsNil(a_tag) || !MD_NodeIsNil(b_tag);
@@ -2227,13 +2227,13 @@ MD_NodeMatch(MD_Node *a, MD_Node *b, MD_StringMatchFlags str_flags, MD_NodeMatch
{
if(MD_NodeMatch(a_tag, b_tag, str_flags, 0))
{
if(node_flags & MD_NodeMatchFlag_TagArguments)
if(match_flags & MD_NodeMatchFlag_TagArguments)
{
for(MD_Node *a_tag_arg = a_tag->first_child, *b_tag_arg = b_tag->first_child;
!MD_NodeIsNil(a_tag_arg) || !MD_NodeIsNil(b_tag_arg);
a_tag_arg = a_tag_arg->next, b_tag_arg = b_tag_arg->next)
{
if(!MD_NodeDeepMatch(a_tag_arg, b_tag_arg, str_flags, node_flags))
if(!MD_NodeDeepMatch(a_tag_arg, b_tag_arg, str_flags, match_flags))
{
result = 0;
goto end;
@@ -2254,16 +2254,16 @@ MD_NodeMatch(MD_Node *a, MD_Node *b, MD_StringMatchFlags str_flags, MD_NodeMatch
}
MD_FUNCTION_IMPL MD_b32
MD_NodeDeepMatch(MD_Node *a, MD_Node *b, MD_StringMatchFlags str_flags, MD_NodeMatchFlags node_flags)
MD_NodeDeepMatch(MD_Node *a, MD_Node *b, MD_StringMatchFlags str_flags, MD_NodeMatchFlags match_flags)
{
MD_b32 result = MD_NodeMatch(a, b, str_flags, node_flags);
MD_b32 result = MD_NodeMatch(a, b, str_flags, match_flags);
if(result)
{
for(MD_Node *a_child = a->first_child, *b_child = b->first_child;
!MD_NodeIsNil(a_child) || !MD_NodeIsNil(b_child);
a_child = a_child->next, b_child = b_child->next)
{
if(!MD_NodeDeepMatch(a_child, b_child, str_flags, node_flags))
if(!MD_NodeDeepMatch(a_child, b_child, str_flags, match_flags))
{
result = 0;
goto end;