Skip to content

[BUG REPORT] Print error message: A case where the the check_if will always overflow #361

@Math-O5

Description

@Math-O5

Describe the bug
When user type incomplete programs, the "check_if(tokens[i + 1])" in sim/simc_parse.py will always overflow, if there is not tokens[i + 1].

The program typed by the use is clearly wrong, but the program should treat this properly.

To Reproduce
Complie this simc code:

test.simc:

MAIN
    if()
MAIN
    var
MAIN
    f
MAIN
    array overflow

Ouput error:

...
  File "/home/math-o5/anaconda3/lib/python3.7/site-packages/simc/simc_parser.py", line 673, in check_ptr
    if tokens[i].type == "multiply":
IndexError: list index out of range

Expected behavior
A kind message error for user

Desktop (please complete the following information):

  • OS: Fedora 30, Ubuntu 18

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingeasyEasy problem

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions