Skip to content

Instantly share code, notes, and snippets.

@rubychan
Created April 17, 2011 09:48
Show Gist options
  • Save rubychan/923897 to your computer and use it in GitHub Desktop.
Save rubychan/923897 to your computer and use it in GitHub Desktop.
Index: lib/coderay/scanners/ruby/patterns.rb
===================================================================
--- lib/coderay/scanners/ruby/patterns.rb (revision 706)
+++ lib/coderay/scanners/ruby/patterns.rb (working copy)
@@ -33,18 +33,7 @@
add(RESERVED_WORDS, :reserved).
add(PREDEFINED_CONSTANTS, :pre_constant)
- if /\w/u === '∑'
- # MRI 1.8.6, 1.8.7
- IDENT = /[^\W\d]\w*/
- else
- if //.respond_to? :encoding
- # MRI 1.9.1, 1.9.2
- IDENT = Regexp.new '[\p{L}\p{M}\p{Pc}\p{Sm}&&[^\x00-\x40\x5b-\x5e\x60\x7b-\x7f]][\p{L}\p{M}\p{N}\p{Pc}\p{Sm}&&[^\x00-\x2f\x3a-\x40\x5b-\x5e\x60\x7b-\x7f]]*'
- else
- # JRuby, Rubinius
- IDENT = /[^\x00-\x40\x5b-\x5e\x60\x7b-\x7f][^\x00-\x2f\x3a-\x40\x5b-\x5e\x60\x7b-\x7f]*/
- end
- end
+ IDENT = 'ä'[/[[:alpha:]]/] == 'ä' ? /[[:alpha:]_][[:alnum:]_]*/ : /[^\W\d]\w*/
METHOD_NAME = / #{IDENT} [?!]? /ox
METHOD_NAME_OPERATOR = /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment