diff options
Diffstat (limited to 'lib/coderay')
-rw-r--r-- | lib/coderay/encoders/html/classes.rb | 7 | ||||
-rw-r--r-- | lib/coderay/scanners/ruby.rb | 40 |
2 files changed, 5 insertions, 42 deletions
diff --git a/lib/coderay/encoders/html/classes.rb b/lib/coderay/encoders/html/classes.rb index ea15ca0..c8f70d9 100644 --- a/lib/coderay/encoders/html/classes.rb +++ b/lib/coderay/encoders/html/classes.rb @@ -3,7 +3,10 @@ module Encoders class HTML - ClassOfKind = { + ClassOfKind = Hash.new do |h, k| + h[k] = k.to_s + end + ClassOfKind.update with = { :attribute_name => 'an', :attribute_name_fat => 'af', :attribute_value => 'av', @@ -65,7 +68,7 @@ module Encoders ClassOfKind[:open] = ClassOfKind[:close] = ClassOfKind[:delimiter] ClassOfKind[:nesting_delimiter] = ClassOfKind[:delimiter] ClassOfKind[:escape] = ClassOfKind[:delimiter] - ClassOfKind.default = ClassOfKind[:error] or raise 'no class found for :error!' + #ClassOfKind.default = ClassOfKind[:error] or raise 'no class found for :error!' end diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb index 76c87ca..77fe664 100644 --- a/lib/coderay/scanners/ruby.rb +++ b/lib/coderay/scanners/ruby.rb @@ -21,14 +21,8 @@ module Scanners helper :patterns - DEFAULT_OPTIONS = { - :parse_regexps => true, - } - private def scan_tokens tokens, options - parse_regexp = false # options[:parse_regexps] - first_bake = saved_tokens = nil last_token_dot = false fancy_allowed = regexp_allowed = true heredocs = nil @@ -72,36 +66,6 @@ module Scanners if state.type == :regexp and not eos? modifiers = scan(/#{patterns::REGEXP_MODIFIERS}/ox) tokens << [modifiers, :modifier] unless modifiers.empty? - if parse_regexp - extended = modifiers.index ?x - tokens = saved_tokens - regexp = tokens - for text, kind in regexp - if text.is_a? ::String - case kind - when :content - text.scan(/([^#]+)|(#.*)/) do |plain, comment| - if plain - tokens << [plain, :content] - else - tokens << [comment, :comment] - end - end - when :character - if text[/\\(?:[swdSWDAzZbB]|\d+)/] - tokens << [text, :modifier] - else - tokens << [text, kind] - end - else - tokens << [text, kind] - end - else - tokens << [text, kind] - end - end - first_bake = saved_tokens = nil - end end tokens << [:close, state.type] fancy_allowed = regexp_allowed = false @@ -241,10 +205,6 @@ module Scanners kind = :delimiter interpreted = true state = patterns::StringState.new :regexp, interpreted, match - if parse_regexp - tokens = [] - saved_tokens = tokens - end elsif match = scan(/#{patterns::NUMERIC}/o) kind = if self[1] then :float else :integer end |