diff options
Diffstat (limited to 'lib/coderay/scanners/ruby.rb')
-rw-r--r-- | lib/coderay/scanners/ruby.rb | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb index d497731..f8f27b7 100644 --- a/lib/coderay/scanners/ruby.rb +++ b/lib/coderay/scanners/ruby.rb @@ -168,8 +168,7 @@ module Scanners end end ## experimental! - value_expected = :set if - patterns::REGEXP_ALLOWED[match] or check(/#{patterns::VALUE_FOLLOWS}/o) + value_expected = :set if check(/#{patterns::VALUE_FOLLOWS}/o) elsif last_token_dot and match = scan(/#{patterns::METHOD_NAME_OPERATOR}/o) kind = :ident @@ -286,6 +285,18 @@ module Scanners next end + elsif state == :module_expected + if match = scan(/<</) + kind = :operator + else + state = :initial + if match = scan(/ (?:#{patterns::IDENT}::)* #{patterns::IDENT} /ox) + kind = :class + else + next + end + end + elsif state == :undef_expected state = :undef_comma_expected if match = scan(/#{patterns::METHOD_NAME_EX}/o) @@ -307,6 +318,15 @@ module Scanners next end + elsif state == :alias_expected + if match = scan(/(#{patterns::METHOD_NAME_OR_SYMBOL})([ \t]+)(#{patterns::METHOD_NAME_OR_SYMBOL})/o) + tokens << [self[1], (self[1][0] == ?: ? :symbol : :method)] + tokens << [self[2], :space] + tokens << [self[3], (self[3][0] == ?: ? :symbol : :method)] + end + state = :initial + next + elsif state == :undef_comma_expected if match = scan(/,/) kind = :operator @@ -316,18 +336,6 @@ module Scanners next end - elsif state == :module_expected - if match = scan(/<</) - kind = :operator - else - state = :initial - if match = scan(/ (?:#{patterns::IDENT}::)* #{patterns::IDENT} /ox) - kind = :class - else - next - end - end - end # }}} |