diff options
author | murphy <murphy@rubychan.de> | 2009-06-07 14:21:50 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2009-06-07 14:21:50 +0000 |
commit | 0db86ecbd49ce957d5d27ae98607e83aa95c951b (patch) | |
tree | e4d368635e2add0630512aface4739da09154368 /lib/coderay/scanners/ruby/patterns.rb | |
parent | 3ece1d0ba395da1119bbcef3eb83fa7cdfa146b0 (diff) | |
download | coderay-0db86ecbd49ce957d5d27ae98607e83aa95c951b.tar.gz |
Improved UTF-8 support for Ruby Scanner. Also fixed a minor bug.
* closes #108 (new Ruby 1.9 call operator syntax sugar)
* Added an example for unicode code.
* automatic UTF-8 detection (experimental)
* Still problems with different Ruby versions; new unicode test fails in
Ruby 1.9 and JRuby.
Diffstat (limited to 'lib/coderay/scanners/ruby/patterns.rb')
-rw-r--r-- | lib/coderay/scanners/ruby/patterns.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/coderay/scanners/ruby/patterns.rb b/lib/coderay/scanners/ruby/patterns.rb index e303894..cf5f8c1 100644 --- a/lib/coderay/scanners/ruby/patterns.rb +++ b/lib/coderay/scanners/ruby/patterns.rb @@ -31,18 +31,18 @@ module Scanners add(RESERVED_WORDS, :reserved). add(PREDEFINED_CONSTANTS, :pre_constant) - IDENT = /[a-z_][\w_]*/i + IDENT = /[^\W\d]\w*/ METHOD_NAME = / #{IDENT} [?!]? /ox METHOD_NAME_OPERATOR = / \*\*? # multiplication and power - | [-+~]@? # plus, minus, tilde with and without @ - | [\/%&|^`] # division, modulo or format strings, &and, |or, ^xor, `system` + | [-+~]@? # plus, minus, tilde with and without at sign + | [\/%&|^`] # division, modulo or format strings, and, or, xor, system | \[\]=? # array getter and setter | << | >> # append or shift left, shift right | <=?>? | >=? # comparison, rocket operator | ===? | =~ # simple equality, case equality, match - | ![~=@]? # negation with and without @, not-equal and not-match + | ![~=@]? # negation with and without at sign, not-equal and not-match /ox METHOD_NAME_EX = / #{IDENT} (?:[?!]|=(?!>))? | #{METHOD_NAME_OPERATOR} /ox INSTANCE_VARIABLE = / @ #{IDENT} /ox |