Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Fix an error when using heredoc with non-word delimiters #987

Commits on Jan 7, 2024

  1. - Fix an error when using heredoc with non-word delimiters

    I've found whitequark#986 regression in the following RuboCop CI matrix:
    https://github.com/rubocop/rubocop/actions/runs/7437077900/job/20234293932?pr=12598
    
    So, whitequark#986 was not a sufficient fix. This PR fixes an error when using heredoc with non-word delimiters:
    
    ```ruby
    <<~'+'
      foo
    +
    ```
    
    The following repro test have been newly added:
    
    ```console
    $ bundle exec ruby -Itest test/test_lexer.rb
    (snip)
    
      1) Error:
    TestLexer#test_heredoc_plus_character:
    RegexpError: target of repeat operator is not specified: /+\z/
        /Users/koic/src/github.com/whitequark/parser/lib/parser/lexer/literal.rb:250:in `delimiter?'
        /Users/koic/src/github.com/whitequark/parser/lib/parser/lexer/literal.rb:138:in `nest_and_try_closing'
        /Users/koic/src/github.com/whitequark/parser/lib/parser/lexer-strings.rb:4165:in `advance'
        /Users/koic/src/github.com/whitequark/parser/lib/parser/lexer-F1.rb:11369:in `advance'
        test/test_lexer.rb:81:in `assert_scanned'
        test/test_lexer.rb:1001:in `test_heredoc_plus_character'
    ```
    koic committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    dbed657 View commit details
    Browse the repository at this point in the history