Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- correctly emit backslash-escaped UTF8 characters in character classes as one token (#104)

## [2.11.2] - 2025-08-12 - Janosch Müller

### Added
Expand Down
2 changes: 1 addition & 1 deletion lib/regexp_parser/scanner/scanner.rl
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@
# Treat all remaining escapes - those not supported in sets - as literal.
# (This currently includes \^, \-, \&, \:, although these could potentially
# be meta chars when not escaped, depending on their position in the set.)
any > (escaped_set_alpha, 1) {
any > (escaped_set_alpha, 1) | utf8_multibyte > (escaped_set_alpha, 1) {
emit(:escape, :literal, copy(data, ts-1, te))
fret;
};
Expand Down
1 change: 1 addition & 0 deletions spec/scanner/sets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
include_examples 'scan', '[\R]', 1 => [:escape, :literal, '\R', 1, 3]
include_examples 'scan', '[\X]', 1 => [:escape, :literal, '\X', 1, 3]
include_examples 'scan', '[\B]', 1 => [:escape, :literal, '\B', 1, 3]
include_examples 'scan', '[\💎]', 1 => [:escape, :literal, '\💎', 1, 3]

include_examples 'scan', /[\d]/, 1 => [:type, :digit, '\d', 1, 3]
include_examples 'scan', /[\da-z]/, 1 => [:type, :digit, '\d', 1, 3]
Expand Down