Skip to content

Commit

Permalink
Ruby scanner errors fixed.
Browse files Browse the repository at this point in the history
demo_dump and demo_encoder updated for new YAML version.
Fixes in output.rb and numerization.rb
  • Loading branch information
korny committed Mar 15, 2006
1 parent 3b4a0d8 commit fea5260
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 25 deletions.
2 changes: 1 addition & 1 deletion demo/demo_dump.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
YAML: 2690 bytes
YAML: 2358 bytes
Dump: 1058 bytes
undumped:
<div class="CodeRay">
Expand Down
27 changes: 10 additions & 17 deletions demo/demo_encoder.out
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,23 @@ space \

YAML:
---
-
- puts
- - puts
- :ident
-
- " "
- - " "
- :space
-
- "17"
- - "17"
- :integer
-
- " "
- - " "
- :space
-
- "+"
- - +
- :operator
-
- " "
- - " "
- :space
-
- "4"
- - "4"
- :integer
-
- "
"
- - |

- :space

Dump:
Expand Down
4 changes: 2 additions & 2 deletions lib/coderay/encoders/html/numerization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def numerize *args
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
Expand Down
2 changes: 1 addition & 1 deletion lib/coderay/encoders/html/output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class << self
#
# 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
Expand Down
8 changes: 4 additions & 4 deletions lib/coderay/scanners/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def scan_tokens tokens, options
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
Expand All @@ -145,7 +145,7 @@ def scan_tokens tokens, options
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
Expand Down Expand Up @@ -178,7 +178,7 @@ def scan_tokens tokens, options
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
Expand Down Expand Up @@ -274,7 +274,7 @@ def scan_tokens tokens, options

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]
Expand Down

0 comments on commit fea5260

Please sign in to comment.