Skip to content

Wrong parse error for malformed 'if' #76

@masak

Description

@masak

I had the code

if L >= elems(state[n]) {
    return PIN;
}

And the >= operator isn't implemented yet, so this parsefailed. But it did so with the wrong error message:

Illegal use of listop function call syntax 'if L '. (Did you mean 'if(L )'?)
  in regex EXPR at /home/masak/ours/007/lib/_007/Parser/Syntax.pm:145
  in regex statement:expr at /home/masak/ours/007/lib/_007/Parser/Syntax.pm:52
  in regex statement at /home/masak/ours/007/lib/_007/Parser/Syntax.pm:29
  in regex statementlist at /home/masak/ours/007/lib/_007/Parser/Syntax.pm:21
  in regex blockoid at /home/masak/ours/007/lib/_007/Parser/Syntax.pm:115
  in regex statement:sub at /home/masak/ours/007/lib/_007/Parser/Syntax.pm:60
  in regex statement at /home/masak/ours/007/lib/_007/Parser/Syntax.pm:29
  in regex statementlist at /home/masak/ours/007/lib/_007/Parser/Syntax.pm:21
  in regex blockoid at /home/masak/ours/007/lib/_007/Parser/Syntax.pm:115
  in regex statement:sub at /home/masak/ours/007/lib/_007/Parser/Syntax.pm:60
  in regex statement at /home/masak/ours/007/lib/_007/Parser/Syntax.pm:29
  in regex statementlist at /home/masak/ours/007/lib/_007/Parser/Syntax.pm:21
  in regex TOP at /home/masak/ours/007/lib/_007/Parser/Syntax.pm:4
  in method parse at /home/masak/ours/007/lib/_007/Parser.pm:44
  in sub run_007 at bin/007:7
  in sub MAIN at bin/007:11
  in block <unit> at bin/007:15

This is not an error message I want to see every time I get an if expression wrong. It should already have committed to the if and to the expression, and perhaps say something about an unrecognized infix operator.

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