Skip to content

Unicode match foo #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source :rubygems
source "https://rubygems.org"

gemspec

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PATH
plist (>= 3.0.1)

GEM
remote: http://rubygems.org/
remote: https://rubygems.org/
specs:
bump (0.3.9)
diff-lcs (1.1.3)
Expand Down
10 changes: 6 additions & 4 deletions lib/textpow/syntax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def parse_captures name, pattern, match, processor

# STDERR.puts '-' * 100
# starts.sort!.reverse!.each{|c| STDERR.puts c.join(', ')}
# STDERR.puts
# STDERR.puts
# ends.sort!.reverse!.each{|c| STDERR.puts c.join(', ')}
starts.sort!.reverse!
ends.sort!.reverse!
Expand Down Expand Up @@ -238,11 +238,13 @@ def match_end string, match, position

# in spox-textpow this is \\g in 1.9 !?
regstring.gsub!( /\\k<(.*?)>/ ) { |s| match[$1.to_sym] }
if Textpow::RUBY_19
Regexp.new( regstring ).match( string, position )
klass = if Textpow::RUBY_19
Regexp
else
Oniguruma::ORegexp.new( regstring ).match( string, position )
Oniguruma::ORegexp
end
flag = (regstring.include?("\xff") ? "n" : nil)
klass.new( regstring, nil, flag ).match( string, position )
end

# find earliest matching pattern
Expand Down