Skip to content

Commit b757fd7

Browse files
authored
Merge pull request #94 from dvandersluis/dvandersluis-patch-1
Update scanner.rl to not treat lookbehinds with literal `<` characters as named groups
2 parents 5e4ef01 + a74c64c commit b757fd7

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/regexp_parser/scanner/scanner.rl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
# try to treat every other group head as options group, like Ruby
7979
group_options = '?' . ( [^!#'():<=>~]+ . ':'? ) ?;
8080

81-
group_name_id_ab = ([^!0-9\->] | utf8_multibyte) . ([^>] | utf8_multibyte)*;
81+
group_name_id_ab = ([^!=0-9\->] | utf8_multibyte) . ([^>] | utf8_multibyte)*;
8282
group_name_id_sq = ([^0-9\-'] | utf8_multibyte) . ([^'] | utf8_multibyte)*;
8383
group_number = '-'? . [0-9]+;
8484
group_level = [+\-] . [0-9]+;

spec/scanner/groups_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
include_examples 'scan', '(?<!abc)', 0 => [:assertion, :nlookbehind, '(?<!', 0, 4]
4242
include_examples 'scan', '(?<!x)y>', 0 => [:assertion, :nlookbehind, '(?<!', 0, 4]
4343
include_examples 'scan', '(?<!x>)y', 0 => [:assertion, :nlookbehind, '(?<!', 0, 4]
44+
include_examples 'scan', '(?<=x>)y', 0 => [:assertion, :lookbehind, '(?<=', 0, 4]
4445

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

0 commit comments

Comments
 (0)