lib/regexp-examples/parser.rb in regexp-examples-0.5.4 vs lib/regexp-examples/parser.rb in regexp-examples-0.6.0

- old
+ new

@@ -216,12 +216,15 @@ def parse_multi_end_group MultiGroupEnd.new end def parse_char_group - if rest_of_string =~ /\A\[\[:[^:]+:\]\]/ - raise UnsupportedSyntaxError, "POSIX bracket expressions are not yet implemented" + # TODO: Extract all this logic into ChargroupParser + if rest_of_string =~ /\A\[\[:(\^?)([^:]+):\]\]/ + @current_position += (6 + $1.length + $2.length) + chars = $1.empty? ? POSIXCharMap[$2] : CharSets::Any - POSIXCharMap[$2] + return CharGroup.new(chars, @ignorecase) end chars = [] @current_position += 1 if next_char == ']' # Beware of the sneaky edge case: @@ -236,10 +239,11 @@ # /[\\]/ (match "\") # /[\\\]]/ (match "\" or "]") chars << next_char @current_position += 1 end - CharGroup.new(chars, @ignorecase) + parsed_chars = ChargroupParser.new(chars).result + CharGroup.new(parsed_chars, @ignorecase) end def parse_dot_group DotGroup.new(@multiline) end