diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2024-06-04 14:36:46 -0400 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-06-04 20:28:54 +0000 |
| commit | 4354e452547bbd851078cd1f0f7effe932e01516 (patch) | |
| tree | e7d586dcd27f09d99679bc31c67e56fe5c2c1c53 /lib | |
| parent | f118f92a02d1a671c9662e372954434238462f5d (diff) | |
[ruby/prism] (parser) fix up srange_find to anchor at the start of the slice
https://github.com/ruby/prism/commit/aecce571d8
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/prism/translation/parser/compiler.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/prism/translation/parser/compiler.rb b/lib/prism/translation/parser/compiler.rb index 78a15ad86e..13bf5d193d 100644 --- a/lib/prism/translation/parser/compiler.rb +++ b/lib/prism/translation/parser/compiler.rb @@ -1979,7 +1979,7 @@ module Prism # Note that end_offset is allowed to be nil, in which case this will # search until the end of the string. def srange_find(start_offset, end_offset, tokens) - if (match = source_buffer.source.byteslice(start_offset...end_offset).match(/(\s*)(#{tokens.join("|")})/)) + if (match = source_buffer.source.byteslice(start_offset...end_offset).match(/\A(\s*)(#{tokens.join("|")})/)) _, whitespace, token = *match token_offset = start_offset + whitespace.bytesize |
