Skip to content

Outputted code results in unintended keyword #1

@TommyROM

Description

@TommyROM

Test Environment (required)

  • Eleven Version: 0.5.0

  • MEGA65 Platform: MEGA65

  • ROM Release: 920377

  • Core Commit: 93d55f0

Describe the bug
I'm having trouble with Eleven creating syntax errors in the outputted BASIC.
In Eleven the line looks like this:
'''if (x>w or x<1 or y>h or y<1) then x=w/2'''
However, Eleven is outputting the line with a syntax error that I couldn't figure out. This is the line:
'''if(n>gorn<1oro>horo<1)thenn=g/2
?syntax error in line 3'''
However, if in the outputted BASIC code (not within Eleven) I go in an add spaces between keywords and expressions it runs without any errors:
'''if (n>g or n<1 or o>h or o<1) then n=g/2'''
What I found was that BASIC was tokenizing the "go" in "n>gorn<1" creating the syntax error. To eliminate the error I had to (in Eleven) enclose each comparator (is that the right word?) with a < or > in parentheses so that the "go" would not be tokenized.

To be clear, the fix in Eleven was to change n>gorn<1 to (n>g)or(n<1)

To Reproduce
See above.

Expected behavior
I expected Eleven's output to not create a keyword where none is in the source code. It should not combine a variable (e.g., g) with an "or" statement resulting in a new "go" keyword where it wasn't intended.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
I posted this on Discord on 9-Jan-2023.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnewNew report, not classified yet

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions