Give argument lists their own link, not each argument's .right
An identifier's subscript list, a unary's operand and a binary's right-hand side all lived in the same field the argument chain used, so ABS(-9), MOD(A#, B# + 12) and any array reference in a parameter list were counted as extra arguments and refused. Subscript lists move to .expr and arguments now chain through a dedicated .next. This is the third time the same collision was fixed; the first two moved it along rather than removing it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Andrew Kesterson <andrew@aklabs.net>
This commit is contained in:
@@ -49,6 +49,7 @@ akerr_ErrorContext *akbasic_leaf_init(akbasic_ASTLeaf *obj, akbasic_LeafType lea
|
||||
obj->left = NULL;
|
||||
obj->right = NULL;
|
||||
obj->expr = NULL;
|
||||
obj->next = NULL;
|
||||
obj->identifier[0] = '\0';
|
||||
obj->literal_int = 0;
|
||||
obj->literal_float = 0.0;
|
||||
@@ -96,6 +97,7 @@ static akerr_ErrorContext *clone_into(akbasic_ASTLeaf *self, akbasic_LeafPool *p
|
||||
PASS(errctx, clone_into(self->left, pool, ©->left));
|
||||
PASS(errctx, clone_into(self->right, pool, ©->right));
|
||||
PASS(errctx, clone_into(self->expr, pool, ©->expr));
|
||||
PASS(errctx, clone_into(self->next, pool, ©->next));
|
||||
|
||||
*dest = copy;
|
||||
SUCCEED_RETURN(errctx);
|
||||
@@ -124,12 +126,12 @@ akbasic_ASTLeaf *akbasic_leaf_first_argument(akbasic_ASTLeaf *self)
|
||||
akbasic_ASTLeaf *akbasic_leaf_first_subscript(akbasic_ASTLeaf *self)
|
||||
{
|
||||
if ( self == NULL ||
|
||||
self->right == NULL ||
|
||||
self->right->leaftype != AKBASIC_LEAF_ARGUMENTLIST ||
|
||||
self->right->operator_ != AKBASIC_TOK_ARRAY_SUBSCRIPT ) {
|
||||
self->expr == NULL ||
|
||||
self->expr->leaftype != AKBASIC_LEAF_ARGUMENTLIST ||
|
||||
self->expr->operator_ != AKBASIC_TOK_ARRAY_SUBSCRIPT ) {
|
||||
return NULL;
|
||||
}
|
||||
return self->right->right;
|
||||
return self->expr->right;
|
||||
}
|
||||
|
||||
bool akbasic_leaf_is_identifier(akbasic_ASTLeaf *self)
|
||||
|
||||
Reference in New Issue
Block a user