fix build errors; remove dumb non-working printf annotations; move C++ user-defined-literal thing into the header

This commit is contained in:
ryanfleury
2021-06-30 12:17:30 -06:00
parent 3648548cfe
commit 097541c9b7
6 changed files with 37 additions and 52 deletions
-6
View File
@@ -1,12 +1,6 @@
#include "md.h"
#include "md.c"
MD_String8 operator "" _md(const char *s, size_t size)
{
MD_String8 str = MD_S8((MD_u8 *)s, (MD_u64)size);
return str;
}
int main(void)
{
MD_String8 str = "foobar"_md;
+6 -4
View File
@@ -474,13 +474,15 @@ static MD_Node *
FirstBadNodeAtPointer(MD_Node *node)
{
MD_Node *result = 0;
MD_Node *root = MD_RootFromNode(node);
MD_u8 *node_at = root->whole_string.str + node->offset;
switch(node->kind){
case MD_NodeKind_File:
{
} break;
case MD_NodeKind_Label:
{
if(node->at != node->whole_string.str)
if(node_at != node->whole_string.str)
{
if(node->whole_string.size)
{
@@ -488,7 +490,7 @@ FirstBadNodeAtPointer(MD_Node *node)
}
else
{
if(!node->at || (node->at[0] != '(' && node->at[0] != '[' && node->at[0] != '{'))
if(!node_at || (node_at[0] != '(' && node_at[0] != '[' && node_at[0] != '{'))
{
result = node;
}
@@ -503,7 +505,7 @@ FirstBadNodeAtPointer(MD_Node *node)
case MD_NodeKind_List:
case MD_NodeKind_Tag:
{
if(node->at != node->whole_string.str)
if(node_at != node->whole_string.str)
{
result = node;
goto end;
@@ -537,7 +539,7 @@ int main(int argument_count, char **arguments)
// 1) Tag []-style sets as optional
MD_Node *optional_tag = 0;
{
MD_ParseResult parse_result = MD_ParseOneNode(MD_S8Lit(""), MD_S8Lit("@"OPTIONAL_TAG" is_a_tag"));
MD_ParseResult parse_result = MD_ParseOneNode(MD_S8Lit("@"OPTIONAL_TAG" is_a_tag"), 0);
optional_tag = parse_result.node->first_tag;
}
TagSquareBracketSetsAsOptional(grammar, optional_tag);
+2
View File
@@ -858,5 +858,7 @@ int main(void)
}
}
MD_String8 str = MD_PushStringF("%i", "foobar");
return 0;
}