@@ -46,20 +46,20 @@ def parse_group(repeaters)
4646 group = parse_after_backslash_group
4747 when '^'
4848 if @current_position == 0
49- group = parse_single_char_group ( '' ) # Ignore the "illegal" character
49+ group = PlaceHolderGroup . new # Ignore the "illegal" character
5050 else
5151 raise IllegalSyntaxError , "Anchors ('#{ next_char } ') cannot be supported, as they are not regular"
5252 end
5353 when '$'
5454 if @current_position == ( regexp_string . length - 1 )
55- group = parse_single_char_group ( '' ) # Ignore the "illegal" character
55+ group = PlaceHolderGroup . new # Ignore the "illegal" character
5656 else
5757 raise IllegalSyntaxError , "Anchors ('#{ next_char } ') cannot be supported, as they are not regular"
5858 end
5959 when /[#\s ]/
6060 if @extended
6161 parse_extended_whitespace
62- group = parse_single_char_group ( '' ) # Ignore the whitespace/comment
62+ group = PlaceHolderGroup . new # Ignore the whitespace/comment
6363 else
6464 group = parse_single_char_group ( next_char )
6565 end
@@ -104,7 +104,7 @@ def parse_after_backslash_group
104104 @current_position += ( $1. length + 2 )
105105 raise UnsupportedSyntaxError , "Named properties ({\\ p#{ $1} }) are not yet supported"
106106 when next_char == 'K' # Keep (special lookbehind that CAN be supported safely!)
107- group = parse_single_char_group ( '' ) # Ignore it
107+ group = PlaceHolderGroup . new
108108 when next_char == 'R' # Linebreak
109109 group = CharGroup . new ( [ "\r \n " , "\n " , "\v " , "\f " , "\r " ] , @ignorecase ) # A bit hacky...
110110 when next_char == 'g' # Subexpression call
@@ -114,13 +114,13 @@ def parse_after_backslash_group
114114 raise IllegalSyntaxError , "Anchors ('\\ #{ next_char } ') cannot be supported, as they are not regular"
115115 when next_char =~ /[AG]/ # Start of string
116116 if @current_position == 1
117- group = parse_single_char_group ( '' ) # Ignore the "illegal" character
117+ group = PlaceHolderGroup . new
118118 else
119119 raise IllegalSyntaxError , "Anchors ('\\ #{ next_char } ') cannot be supported, as they are not regular"
120120 end
121121 when next_char =~ /[zZ]/ # End of string
122122 if @current_position == ( regexp_string . length - 1 )
123- group = parse_single_char_group ( '' ) # Ignore the "illegal" character
123+ group = PlaceHolderGroup . new
124124 else
125125 raise IllegalSyntaxError , "Anchors ('\\ #{ next_char } ') cannot be supported, as they are not regular"
126126 end
@@ -186,7 +186,7 @@ def parse_multi_group
186186 if next_char == ':' # e.g. /(?i:subexpr)/
187187 @current_position += 1
188188 else
189- return parse_single_char_group ( '' )
189+ return PlaceHolderGroup . new
190190 end
191191 when %w( ! = ) . include? ( match [ 2 ] ) # e.g. /(?=lookahead)/, /(?!neglookahead)/
192192 raise IllegalSyntaxError , "Lookaheads are not regular; cannot generate examples"
0 commit comments