Skip to content

Larger hexadecimal number is not recognized by the new parser #917

Open
@Thirumalai-Shaktivel

Description

@Thirumalai-Shaktivel

Code:

b = np.array([0x7ff0000000000001], 'i8').view('f8')
$ lpython --show-ast examples/expr2.py --tree --new-parser
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
  Binary file "/home/thirumalai/Open_Source/lpython/src/bin/lpython", in _start()
  File "./csu/../csu/libc-start.c", line 392, in __libc_start_main_impl()
  File "./csu/../sysdeps/nptl/libc_start_call_main.h", line 58, in __libc_start_call_main()
  File "/home/thirumalai/Open_Source/lpython/src/bin/lpython.cpp", line 1008, in ??
    return emit_ast(arg_file, runtime_library_dir, compiler_options);
  File "/home/thirumalai/Open_Source/lpython/src/bin/lpython.cpp", line 114, in ??
    al, runtime_library_dir, infile, diagnostics, compiler_options.new_parser);
  File "/home/thirumalai/Open_Source/lpython/src/lpython/parser/parser.cpp", line 123, in LFortran::parse_python_file(Allocator&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, LFortran::diag::Diagnostics&, bool)
    Result<LPython::AST::Module_t*> res = parse(al, input, diagnostics);
  File "/home/thirumalai/Open_Source/lpython/src/lpython/parser/parser.cpp", line 22, in LFortran::parse(Allocator&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, LFortran::diag::Diagnostics&)
    p.parse(s);
  File "/home/thirumalai/Open_Source/lpython/src/lpython/parser/parser.cpp", line 54, in LFortran::Parser::parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    if (yyparse(*this) == 0) {
  File "/home/thirumalai/Open_Source/lpython/src/lpython/parser.tab.cc", line 3021, in yyparse(LFortran::Parser&)
  File "/home/thirumalai/Open_Source/lpython/src/lpython/parser.yy", line 36, in yylex(LFortran::YYSTYPE*, LFortran::Location*, LFortran::Parser&)
  File "/home/thirumalai/Open_Source/lpython/src/lpython/tokenizer.re", line 456, in LFortran::Tokenizer::lex(Allocator&, LFortran::YYSTYPE&, LFortran::Location&, LFortran::diag::Diagnostics&)
  File "/home/thirumalai/Open_Source/lpython/src/lpython/tokenizer.re", line 83, in LFortran::lex_int(Allocator&, unsigned char const*, unsigned char const*, LFortran::BigInt::BigInt&, LFortran::Location const&)
AssertFailed: is_small_int(i)

Metadata

Metadata

Assignees

No one assigned

    Labels

    ParserIssues or improvements related to parser

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions