Skip to content

old print syntax throws #2339

Closed
Closed
@rebcabin

Description

@rebcabin

My fingers stupidly typed print syntax from Python 2.17. LPython responded with a barf, but, perhaps a friendly error message would be more appropriate.

repro:

def main():
    print "done!"


if __name__ == '__main__':
    main()

result:

(base) ┌─(~/CLionProjects/lpython/lasr/LP-pycharm)───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────(brian@MacBook-Pro:s003)─┐
└─(13:47:03 on lasr ✭)──> lpython -I. ISSUES/IssueStringMain.py                                                                                                          1 ↵ ──(Tue,Sep26)─┘
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
  File "/Users/brian/CLionProjects/lpython/src/bin/lpython.cpp", line 1888
    err = compile_python_to_object_file(arg_file, tmp_o, runtime_library_dir,
  File "/Users/brian/CLionProjects/lpython/src/bin/lpython.cpp", line 786
    LCompilers::Result<LCompilers::LPython::AST::ast_t*> r = parse_python_file(
  File "/Users/brian/CLionProjects/lpython/src/lpython/parser/parser.cpp", line 126
    Result<LPython::AST::Module_t*> res = parse(al, input, prev_loc, diagnostics);
  File "/Users/brian/CLionProjects/lpython/src/lpython/parser/parser.cpp", line 22
    p.parse(s, prev_loc);
  File "/Users/brian/CLionProjects/lpython/src/lpython/parser/parser.cpp", line 53
    m_tokenizer.set_string(inp, prev_loc);
  File "parser.yy", line 1107
  File "/Users/brian/CLionProjects/lpython/src/lpython/parser/semantics.h", line 879
    throw LCompilers::LCompilersException("The string is not recognized by the parser.");
LCompilersException: The string is not recognized by the parser.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions