mirror of
https://github.com/Ed94/metadesk.git
synced 2026-08-06 15:48:47 +00:00
[expr parser] Detect premature end of expression.
This commit is contained in:
+8
-1
@@ -3156,7 +3156,14 @@ _MD_ExprParse_Atom(MD_Arena *arena, _MD_ExprParseCtx *ctx)
|
|||||||
MD_Node *node = ctx->first;
|
MD_Node *node = ctx->first;
|
||||||
MD_ExprOperator *op = 0;
|
MD_ExprOperator *op = 0;
|
||||||
|
|
||||||
if(node->flags & MD_NodeFlag_HasParenLeft && node->flags & MD_NodeFlag_HasParenRight)
|
|
||||||
|
if(MD_NodeIsNil(node))
|
||||||
|
{
|
||||||
|
MD_String8 error_str = MD_S8Fmt(arena, "Unexpected end of expression.");
|
||||||
|
MD_Message *error = MD_MakeNodeError(arena, node, MD_MessageKind_Error, error_str);
|
||||||
|
MD_MessageListPush(&result.errors, error);
|
||||||
|
}
|
||||||
|
else if(node->flags & MD_NodeFlag_HasParenLeft && node->flags & MD_NodeFlag_HasParenRight)
|
||||||
{ // NOTE(mal): Parens
|
{ // NOTE(mal): Parens
|
||||||
_MD_CtxAdvance(ctx);
|
_MD_CtxAdvance(ctx);
|
||||||
_MD_ExprParseCtx sub_ctx = _MD_ExprParse_MakeContext(ctx->op_table, node->first_child, node->last_child->next);
|
_MD_ExprParseCtx sub_ctx = _MD_ExprParse_MakeContext(ctx->op_table, node->first_child, node->last_child->next);
|
||||||
|
|||||||
Reference in New Issue
Block a user