diff --git a/source/md.c b/source/md.c index 5cf5c7b..e46acb8 100644 --- a/source/md.c +++ b/source/md.c @@ -206,6 +206,7 @@ MD_WIN32_Release(void *ptr, MD_u64 size){ # include # include # include +# include // NOTE(mal): To get these constants I need to #define _GNU_SOURCE, // which invites non-POSIX behavior I'd rather avoid # ifndef O_PATH @@ -2992,10 +2993,10 @@ MD_ExprBakeOperatorTableFromList(MD_Arena *arena, MD_ExprOperatorList *list){ return(result); } -MD_FUNCTION MD_ExprNode* +MD_FUNCTION MD_ExprParseResult MD_ExprParse(MD_Arena *arena, MD_ExprOperatorTable *op_table, MD_Node *first, MD_Node *one_past_last){ - MD_ExprNode *result = 0; + MD_ExprParseResult result = {0}; // TODO(allen): @expr_parser return(result); } diff --git a/source/md.h b/source/md.h index 4791288..06092c2 100644 --- a/source/md.h +++ b/source/md.h @@ -681,9 +681,11 @@ struct MD_ParseResult typedef enum MD_ExprOperatorKind { + // TODO(mal): We could improve this naming scheme MD_ExprOperatorKind_Prefix, MD_ExprOperatorKind_Postfix, MD_ExprOperatorKind_Binary, + MD_ExprOperatorKind_BinaryRightAssociative, } MD_ExprOperatorKind; typedef struct MD_ExprOperator MD_ExprOperator; @@ -715,6 +717,7 @@ struct MD_ExprOperatorTable { // TODO(allen): @expr_parser fill this in however needed int foo; + MD_MessageList errors; }; typedef struct MD_ExprNode MD_ExprNode; @@ -729,6 +732,13 @@ struct MD_ExprNode MD_Node *md_op_node; }; +typedef struct MD_ExprParseResult MD_ExprParseResult; +struct MD_ExprParseResult +{ + MD_ExprNode *node; + MD_MessageList errors; +}; + //~ String Generation Types typedef MD_u32 MD_GenerateFlags; @@ -1096,8 +1106,8 @@ MD_FUNCTION void MD_ExprOperatorPush(MD_Arena *arena, MD_ExprOperatorList *lis MD_FUNCTION MD_ExprOperatorTable MD_ExprBakeOperatorTableFromList(MD_Arena *arena, MD_ExprOperatorList *list); -MD_FUNCTION MD_ExprNode* MD_ExprParse(MD_Arena *arena, MD_ExprOperatorTable *op_table, - MD_Node *first, MD_Node *one_past_last); +MD_FUNCTION MD_ExprParseResult MD_ExprParse(MD_Arena *arena, MD_ExprOperatorTable *op_table, + MD_Node *first, MD_Node *one_past_last); //~ String Generation