Skip to content

Commit

Permalink
Merge pull request #94 from dvandersluis/dvandersluis-patch-1
Browse files Browse the repository at this point in the history
Update scanner.rl to not treat lookbehinds with literal `<` characters as named groups
  • Loading branch information
jaynetics authored Nov 29, 2024
2 parents 5e4ef01 + a74c64c commit b757fd7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/regexp_parser/scanner/scanner.rl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
# try to treat every other group head as options group, like Ruby
group_options = '?' . ( [^!#'():<=>~]+ . ':'? ) ?;

group_name_id_ab = ([^!0-9\->] | utf8_multibyte) . ([^>] | utf8_multibyte)*;
group_name_id_ab = ([^!=0-9\->] | utf8_multibyte) . ([^>] | utf8_multibyte)*;
group_name_id_sq = ([^0-9\-'] | utf8_multibyte) . ([^'] | utf8_multibyte)*;
group_number = '-'? . [0-9]+;
group_level = [+\-] . [0-9]+;
Expand Down
1 change: 1 addition & 0 deletions spec/scanner/groups_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
include_examples 'scan', '(?<!abc)', 0 => [:assertion, :nlookbehind, '(?<!', 0, 4]
include_examples 'scan', '(?<!x)y>', 0 => [:assertion, :nlookbehind, '(?<!', 0, 4]
include_examples 'scan', '(?<!x>)y', 0 => [:assertion, :nlookbehind, '(?<!', 0, 4]
include_examples 'scan', '(?<=x>)y', 0 => [:assertion, :lookbehind, '(?<=', 0, 4]

# Options
include_examples 'scan', '(?-mix:abc)', 0 => [:group, :options, '(?-mix:', 0, 7]
Expand Down

0 comments on commit b757fd7

Please sign in to comment.