mirror of
https://github.com/Ed94/metadesk.git
synced 2026-08-05 23:28:45 +00:00
wrap the prev/next comment members for future upgrades
This commit is contained in:
+11
-7
@@ -605,18 +605,19 @@ struct MD_Node
|
||||
MD_String8 raw_string;
|
||||
MD_u64 string_hash;
|
||||
|
||||
// Comments.
|
||||
// TODO(rjf): @node_comments these are pretty under-powered... should they
|
||||
// just be nodes, maybe? Would that allow for some cool stuff, like comment
|
||||
// hierarchies?
|
||||
MD_String8 prev_comment;
|
||||
MD_String8 next_comment;
|
||||
|
||||
// Source code location information.
|
||||
MD_u64 offset;
|
||||
|
||||
// Reference.
|
||||
MD_Node *ref_target;
|
||||
|
||||
|
||||
// Comments.
|
||||
// @usage prev_comment/next_comment should be considered "hidden". Rely on
|
||||
// the functions MD_PrevCommentFromNode/MD_NextCommentFromNode to access
|
||||
// these. Directly access to these is likely to break in a future version.
|
||||
MD_String8 prev_comment;
|
||||
MD_String8 next_comment;
|
||||
};
|
||||
|
||||
//~ Code Location Info.
|
||||
@@ -1091,6 +1092,9 @@ MD_FUNCTION MD_i64 MD_ChildCountFromNode(MD_Node *node);
|
||||
MD_FUNCTION MD_i64 MD_TagCountFromNode(MD_Node *node);
|
||||
MD_FUNCTION MD_Node * MD_NodeFromReference(MD_Node *node);
|
||||
|
||||
MD_FUNCTION MD_String8 MD_PrevCommentFromNode(MD_Node *node);
|
||||
MD_FUNCTION MD_String8 MD_NextCommentFromNode(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_NodeFromReference(it##_r); \
|
||||
|
||||
Reference in New Issue
Block a user