Skip to content

Commit aa01f05

Browse files
committed
improve support for Unicode non-alphanumeric characters in Ruby names
1 parent b71ff6a commit aa01f05

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/coderay/scanners/ruby/patterns.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ module Ruby::Patterns # :nodoc: all
3434
add(%w[ undef ], :undef_expected).
3535
add(%w[ alias ], :alias_expected).
3636
add(%w[ class module ], :module_expected)
37-
38-
IDENT = 'ä'[/[[:alpha:]]/] == 'ä' ? /[[:alpha:]_][[:alnum:]_]*/ : /[^\W\d]\w*/
39-
37+
38+
IDENT = 'ä'[/[[:alpha:]]/] == 'ä' ? Regexp.new('[[:alpha:]_[^\0-\177]][[:alnum:]_[^\0-\177]]*') : /[^\W\d]\w*/
39+
4040
METHOD_NAME = / #{IDENT} [?!]? /ox
4141
METHOD_NAME_OPERATOR = /
4242
\*\*? # multiplication and power

0 commit comments

Comments
 (0)