tweak expression parser interface.

This commit is contained in:
Miguel Lechon
2021-09-03 13:12:06 +02:00
parent b5f9186786
commit c0a56dbcda
2 changed files with 15 additions and 4 deletions
+3 -2
View File
@@ -206,6 +206,7 @@ MD_WIN32_Release(void *ptr, MD_u64 size){
# include <fcntl.h>
# include <unistd.h>
# include <sys/syscall.h>
# include <sys/mman.h>
// 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);
}
+12 -2
View File
@@ -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