Skip to content

Error in Prism::LexCompat#insert_on_sp #3899

@tompng

Description

@tompng

Two different errors in v1.9.0 and in main branch

Prism.lex_compat('scan/\p{alpha}/')
# /path/to/prism/lib/prism/lex_compat.rb:811:in 'block in Prism::LexCompat#insert_on_sp': undefined method 'empty?' for nil (NoMethodError)
#             new_tokens << [[sp_line + 1, 0], :on_sp, second_whitespace, prev_token_state] unless second_whitespace.empty?
#                                                                                                                   ^^^^^^^
Prism.lex_compat('if;)')
# /path/to/prism/lib/prism/lex_compat.rb:823:in 'Prism::LexCompat#insert_on_sp': undefined method 'location' for nil (NoMethodError)
#         end_offset = eof_token.location.end_offset
#                               ^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions