diff options
author | murphy <murphy@rubychan.de> | 2006-03-15 21:58:19 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2006-03-15 21:58:19 +0000 |
commit | fea5260ce014ee521955c5afc929f3cae71a4c73 (patch) | |
tree | ba5cab1cf24a5cf31e7202d212d78792012884a5 | |
parent | 3b4a0d83ddd0eec0dc424798ad8ed3a53c5ba88c (diff) | |
download | coderay-fea5260ce014ee521955c5afc929f3cae71a4c73.tar.gz |
Ruby scanner errors fixed.
demo_dump and demo_encoder updated for new YAML version.
Fixes in output.rb and numerization.rb
-rw-r--r-- | demo/demo_dump.out | 2 | ||||
-rw-r--r-- | demo/demo_encoder.out | 27 | ||||
-rw-r--r-- | lib/coderay/encoders/html/numerization.rb | 4 | ||||
-rw-r--r-- | lib/coderay/encoders/html/output.rb | 2 | ||||
-rw-r--r-- | lib/coderay/scanners/ruby.rb | 8 |
5 files changed, 18 insertions, 25 deletions
diff --git a/demo/demo_dump.out b/demo/demo_dump.out index d303b08..a032b50 100644 --- a/demo/demo_dump.out +++ b/demo/demo_dump.out @@ -1,4 +1,4 @@ -YAML: 2690 bytes
+YAML: 2358 bytes
Dump: 1058 bytes
undumped:
<div class="CodeRay">
diff --git a/demo/demo_encoder.out b/demo/demo_encoder.out index 3add7bc..aa35a61 100644 --- a/demo/demo_encoder.out +++ b/demo/demo_encoder.out @@ -31,30 +31,23 @@ space \ YAML:
---
--
- - puts
+- - puts
- :ident
--
- - " "
+- - " "
- :space
--
- - "17"
+- - "17"
- :integer
--
- - " "
+- - " "
- :space
--
- - "+"
+- - +
- :operator
--
- - " "
+- - " "
- :space
--
- - "4"
+- - "4"
- :integer
--
- - "
- "
+- - |
+
+
- :space
Dump:
diff --git a/lib/coderay/encoders/html/numerization.rb b/lib/coderay/encoders/html/numerization.rb index f51b5d3..edce9eb 100644 --- a/lib/coderay/encoders/html/numerization.rb +++ b/lib/coderay/encoders/html/numerization.rb @@ -12,9 +12,9 @@ module CodeRay NUMERIZABLE_WRAPPINGS = {
:table => [:div, :page],
:inline => :all,
- :list => [:div, :page],
- nil => :all
+ :list => [:div, :page]
}
+ NUMERIZABLE_WRAPPINGS.default = :all
def numerize! mode = :table, options = {}
return self unless mode
diff --git a/lib/coderay/encoders/html/output.rb b/lib/coderay/encoders/html/output.rb index 36018a7..8096dc8 100644 --- a/lib/coderay/encoders/html/output.rb +++ b/lib/coderay/encoders/html/output.rb @@ -25,7 +25,7 @@ module CodeRay #
# a = Output.new '<span class="co">Code</span>'
# a.wrap! :page
- def new string, css, element = nil
+ def new string, css = CSS.new, element = nil
output = string.clone.extend self
output.wrapped_in = element
output.css = css
diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb index 6b4c8ea..8952422 100644 --- a/lib/coderay/scanners/ruby.rb +++ b/lib/coderay/scanners/ruby.rb @@ -134,7 +134,7 @@ module CodeRay module Scanners last_state = state # scan one token as normal code, then return here
state = :initial
else
- raise 'else-case # reached; #%p not handled' % peek(1), tokens
+ raise_inspect 'else-case # reached; #%p not handled' % peek(1), tokens
end
when state.paren
@@ -145,7 +145,7 @@ module CodeRay module Scanners tokens << [match, :function]
else
- raise 'else-case " reached; %p not handled, state = %p' % [match, state], tokens
+ raise_inspect 'else-case " reached; %p not handled, state = %p' % [match, state], tokens
end
next
@@ -178,7 +178,7 @@ module CodeRay module Scanners type = :comment
regexp_allowed = true
else
- raise 'else-case _ reached, because case %p was not handled' % [matched[0].chr], tokens
+ raise_inspect 'else-case _ reached, because case %p was not handled' % [matched[0].chr], tokens
end
tokens << [match, type]
next
@@ -274,7 +274,7 @@ module CodeRay module Scanners elsif fancy_allowed and match = scan(/#{FANCY_START}/o)
type, interpreted = *FancyStringType.fetch(self[1]) do
- raise 'Unknown fancy string: %%%p' % k, tokens
+ raise_inspect 'Unknown fancy string: %%%p' % k, tokens
end
tokens << [:open, type]
state = StringState.new type, interpreted, self[2]
|