summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2005-10-22 01:16:34 +0000
committermurphy <murphy@rubychan.de>2005-10-22 01:16:34 +0000
commit996de449cd5130ca3f073ad241464359c4d6d4fa (patch)
treeb429e98eb5458c9ec32fded0b8ac820786ae7146 /lib
parenta4052158f89068317e5a374cc553ef95de1a842a (diff)
downloadcoderay-996de449cd5130ca3f073ad241464359c4d6d4fa.tar.gz
demo/demo_server.rb: Debug mode.
tokens.rb: orig_each alias deleted; using super now. scanners/ruby.rb: experimental Regexp/Fancy string recognition for "method /.../" cases.
Diffstat (limited to 'lib')
-rw-r--r--lib/coderay/scanners/ruby.rb3
-rw-r--r--lib/coderay/tokens.rb7
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb
index 1ceb3d5..4cb1e58 100644
--- a/lib/coderay/scanners/ruby.rb
+++ b/lib/coderay/scanners/ruby.rb
@@ -213,7 +213,8 @@ module CodeRay module Scanners
state = DEF_NEW_STATE[match]
end
end
- fancy_allowed = regexp_allowed = REGEXP_ALLOWED[match]
+ ## experimental!
+ fancy_allowed = regexp_allowed = :set if REGEXP_ALLOWED[match] or check(/\s+(?:%\S|\/\S)/)
elsif match = scan(/ ['"] /mx)
tokens << [:open, :string]
diff --git a/lib/coderay/tokens.rb b/lib/coderay/tokens.rb
index 9318844..9342897 100644
--- a/lib/coderay/tokens.rb
+++ b/lib/coderay/tokens.rb
@@ -94,15 +94,14 @@ module CodeRay
false
end
- alias :orig_each :each
# Iterates over all tokens.
#
# If a filter is given, only tokens of that kind are yielded.
def each kind_filter = nil, &block
unless kind_filter
- orig_each(&block)
+ super(&block)
else
- orig_each do |text, kind|
+ super do |text, kind|
next unless kind == kind_filter
yield text, kind
end
@@ -115,7 +114,7 @@ module CodeRay
# Example:
# tokens.each_text_token { |text, kind| text.replace html_escape(text) }
def each_text_token
- orig_each do |text, kind|
+ each do |text, kind|
next unless text.respond_to? :to_str
yield text, kind
end