Skip to content

Misleading error message on 0x_BAD__BEEF #2005

Open
@rebcabin

Description

@rebcabin

CPython reports invalid hexadecimal literal but LPython reports identifier error. This hints at deeper problems in the LPython front end:

repro: expr43.py

0xBAD_BEEF
0x_BAD_BEEF
0x_BAD__BEEF
syntax error: Token '__BEEF' (of type 'identifier') is unexpected here
 --> ./expr43.py:3:7
  |
3 | 0x_BAD__BEEF
  |       ^^^^^^ 


Note: if any of the above error or warning messages are not clear or are lacking
context please report it to us (we consider that a bug that must be fixed).
(lp) ┌─(~/CLionProjects/lpython/lasr/LP-pycharm)─────────────────────────────────────────────────────────────────────────────────────────────────────────(brian@Golf37:s012)─┐
└─(11:44:37 on brian-lasr ✹ ✭)──> python                                                                                                              1 ↵ ──(Thu,Jun22)─┘
Python 3.10.2 | packaged by conda-forge | (main, Mar  8 2022, 15:52:47) [Clang 11.1.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 0x_BAD__BEEF
  File "<stdin>", line 1
    0x_BAD__BEEF
          ^
SyntaxError: invalid hexadecimal literal

Metadata

Metadata

Assignees

No one assigned

    Labels

    ParserIssues or improvements related to parsergood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions