introspection helper docs; remove redundant node-sibling helper; ensure that any of the introspection APIs doing string matching take match flags

This commit is contained in:
ryanfleury
2021-06-30 22:54:56 -06:00
parent 0045b05a04
commit f15fc77bfa
8 changed files with 196 additions and 104 deletions
+3 -3
View File
@@ -88,7 +88,7 @@ static void PrintRule(MD_Map *depth_map, MD_Node *rule)
{
MD_b32 is_literal_char = rule->flags & MD_NodeFlag_StringLiteral;
MD_b32 optional = MD_NodeHasTag(rule, MD_S8Lit(OPTIONAL_TAG));
MD_b32 optional = MD_NodeHasTag(rule, MD_S8Lit(OPTIONAL_TAG), 0);
if(optional)
{
@@ -163,7 +163,7 @@ static void ExpandRule(MD_Node *rule, MD_String8List *out_strings, MD_Node *cur_
for(MD_EachNode(rule_element, rule->first_child))
{
MD_b32 expand = 1;
if(MD_NodeHasTag(rule_element, MD_S8Lit(OPTIONAL_TAG)))
if(MD_NodeHasTag(rule_element, MD_S8Lit(OPTIONAL_TAG), 0))
{
expand = rand_U32(globals.random_series)%2;
@@ -656,7 +656,7 @@ int main(int argument_count, char **arguments)
ComputeElementDepth(depth_map, rule_element);
MD_u64 depth = GET_DEPTH(depth_map, rule_element);
if(!MD_NodeHasTag(rule_element, MD_S8Lit(OPTIONAL_TAG)))
if(!MD_NodeHasTag(rule_element, MD_S8Lit(OPTIONAL_TAG), 0))
{
MD_u64 depth = 0;
MD_Assert(MD_NodeIsNil(rule_element->first_child));
+4 -4
View File
@@ -744,19 +744,19 @@ int main(void)
{
MD_ParseResult result = MD_ParseWholeString(file_name, MD_S8Lit("@foo bar"));
TestResult(MD_NodeHasTag(result.node->first_child, MD_S8Lit("foo")));
TestResult(MD_NodeHasTag(result.node->first_child, MD_S8Lit("foo"), 0));
}
{
MD_ParseResult result = MD_ParseWholeString(file_name, MD_S8Lit("@+ bar"));
TestResult(MD_NodeHasTag(result.node->first_child, MD_S8Lit("+")));
TestResult(MD_NodeHasTag(result.node->first_child, MD_S8Lit("+"), 0));
}
{
MD_ParseResult result = MD_ParseWholeString(file_name, MD_S8Lit("@'a b c' bar"));
TestResult(MD_NodeHasTag(result.node->first_child, MD_S8Lit("a b c")));
TestResult(MD_NodeHasTag(result.node->first_child, MD_S8Lit("a b c"), 0));
}
{
MD_ParseResult result = MD_ParseWholeString(file_name, MD_S8Lit("@100 bar"));
TestResult(MD_NodeHasTag(result.node->first_child, MD_S8Lit("100")));
TestResult(MD_NodeHasTag(result.node->first_child, MD_S8Lit("100"), 0));
}
}