Skip to content

Unexpected error message when calculating MEM -1 #103

@Overscore

Description

@Overscore

Try the following basic program:
print MEM - 1;
this results in:

NIL
Error:
    Ln 1, Col 11
    Code 30, Abort Code 3
    Message: Colon expected.

The culprit seems to be line 5760 in my_basic.c

	if(!context->last_symbol ||
		(context->last_symbol && ((context->last_symbol->type == _DT_FUNC && context->last_symbol->data.func->pointer != _core_close_bracket) ||
		context->last_symbol->type == _DT_SEP || context->last_symbol->type == _DT_EOS))) {

This test recognizes the last symbol (MEM) as a function, so the following - (minus) is recognized as _core_neg instead of _core_sub.

Replacing the part (context->last_symbol->type == _DT_FUNC && context->last_symbol->data.func->pointer != _core_close_bracket)
with (context->last_symbol->type == _DT_FUNC && context->last_symbol->data.func->pointer != _core_close_bracket && context->last_symbol->data.func->pointer != _core_mem)
works, but I'm not sure whether it's the right way to fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions