From e127b7d57b06554e708752bbbc2a85e833633c26 Mon Sep 17 00:00:00 2001 From: murphy Date: Mon, 7 Jan 2008 14:42:47 +0000 Subject: Lib: - Encoder: removed a warning - Encoders::HTML: don't shadow outer variable - Plugin: move require_plugin into class namespace - Ruby Scanner: - "alias" keyword recognition - better regexp/division distinction - recognize ~, !, !=, and !~ as method names (partly Ruby 1.9 only) - reordered states for speed Tests: - updated coderay-suite to use gem instead of require_gem - general improvements (more colors!, new parameter: new, new syntax lang.test for only and new) - fixed ruby suite - adjusted a lot of Ruby tests (alias uses methods now) - new tests: ruby/operators, ruby/regexp Samples: - fixed/updated ('bout time) Rake tasks: - updated to use new rubygems API --- sample/html.expected | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'sample/html.expected') diff --git a/sample/html.expected b/sample/html.expected index 1e29612..4e4c99a 100644 --- a/sample/html.expected +++ b/sample/html.expected @@ -34,12 +34,14 @@ ol.CodeRay li { white-space: pre } .CodeRay .code pre { overflow: auto } +.CodeRay .debug { color:white ! important; background:blue ! important; } + .CodeRay .af { color:#00C } .CodeRay .an { color:#007 } .CodeRay .av { color:#700 } .CodeRay .aw { color:#C00 } .CodeRay .bi { color:#509; font-weight:bold } -.CodeRay .c { color:#888 } +.CodeRay .c { color:#666; } .CodeRay .ch { color:#04D } .CodeRay .ch .k { color:#04D } @@ -68,14 +70,14 @@ ol.CodeRay li { white-space: pre } .CodeRay .il { background: #eee } .CodeRay .il .il { background: #ddd } .CodeRay .il .il .il { background: #ccc } -.CodeRay .il .dl { font-weight: bold ! important; color: #888 ! important } +.CodeRay .il .idl { font-weight: bold; color: #888 } .CodeRay .in { color:#B2B; font-weight:bold } .CodeRay .iv { color:#33B } .CodeRay .la { color:#970; font-weight:bold } .CodeRay .lv { color:#963 } .CodeRay .oc { color:#40E; font-weight:bold } -.CodeRay .on { color:#000; font-weight:bold } +.CodeRay .of { color:#000; font-weight:bold } .CodeRay .op { } .CodeRay .pc { color:#038; font-weight:bold } .CodeRay .pd { color:#369; font-weight:bold } @@ -537,9 +539,9 @@ ol.CodeRay li { white-space: pre } add(RESERVED_WORDS, :reserved). add(PREDEFINED_CONSTANTS, :pre_constant) - METHOD_NAME = / #{IDENT} [?!]? /xo + METHOD_NAME = / #{IDENT} [?!]? /xo METHOD_NAME_EX = / - #{METHOD_NAME} # common methods: split, foo=, empty?, gsub! + #{METHOD_NAME} # common methods: split, foo=, empty?, gsub! | \*\*? # multiplication and power | [-+~]@? # plus, minus | [\/%&|^`] # division, modulo or format strings, &and, |or, ^xor, `system` @@ -548,11 +550,11 @@ ol.CodeRay li { white-space: pre } | << | >> # append or shift left, shift right | ===? # simple equality and case equality /ox - GLOBAL_VARIABLE = / \$ (?: #{IDENT} | \d+ | [~&+`'=\/,;_.<>!@0$?*":F\\] | -[a-zA-Z_0-9] ) /ox + GLOBAL_VARIABLE = / \$ (?: #{IDENT} | \d+ | [~&+`'=\/,;_.<>!@0$?*":F\\] | -[a-zA-Z_0-9] ) /ox DOUBLEQ = / " [^"\#\\]* (?: (?: \#\{.*?\} | \#(?:$")? | \\. ) [^"\#\\]* )* "? /ox SINGLEQ = / ' [^'\\]* (?: \\. [^'\\]* )* '? /ox - STRING = / #{SINGLEQ} | #{DOUBLEQ} /ox + STRING = / #{SINGLEQ} | #{DOUBLEQ} /ox SHELL = / ` [^`\#\\]* (?: (?: \#\{.*?\} | \#(?:$`)? | \\. ) [^`\#\\]* )* `? /ox REGEXP = / \/ [^\/\#\\]* (?: (?: \#\{.*?\} | \#(?:$\/)? | \\. ) [^\/\#\\]* )* \/? /ox @@ -561,9 +563,9 @@ ol.CodeRay li { white-space: pre } HEXADECIMAL = /0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*/ BINARY = /0b[01]+(?:_[01]+)*/ - EXPONENT = / [eE] [+-]? #{DECIMAL} /ox - FLOAT = / #{DECIMAL} (?: #{EXPONENT} | \. #{DECIMAL} #{EXPONENT}? ) / - INTEGER = /#{OCTAL}|#{HEXADECIMAL}|#{BINARY}|#{DECIMAL}/ + EXPONENT = / [eE] [+-]? #{DECIMAL} /ox + FLOAT = / #{DECIMAL} (?: #{EXPONENT} | \. #{DECIMAL} #{EXPONENT}? ) / + INTEGER = /#{OCTAL}|#{HEXADECIMAL}|#{BINARY}|#{DECIMAL}/ def reset super @@ -579,7 +581,7 @@ ol.CodeRay li { white-space: pre } @regexp_allowed = :set if @regexp_allowed or @scanner.matched.index(?\n) # delayed flag setting elsif @state == :def_expected - if @scanner.scan(/ (?: (?:#{IDENT}(?:\.|::))* | (?:@@?|$)? #{IDENT}(?:\.|::) ) #{METHOD_NAME_EX} /ox) + if @scanner.scan(/ (?: (?:#{IDENT}(?:\.|::))* | (?:@@?|$)? #{IDENT}(?:\.|::) ) #{METHOD_NAME_EX} /ox) kind = :method @state = :initial else @@ -592,7 +594,7 @@ ol.CodeRay li { white-space: pre } if @scanner.scan(/<</) kind = :operator else - if @scanner.scan(/ (?: #{IDENT} (?:\.|::))* #{IDENT} /ox) + if @scanner.scan(/ (?: #{IDENT} (?:\.|::))* #{IDENT} /ox) kind = :method else @scanner.scan(/./) @@ -605,9 +607,9 @@ ol.CodeRay li { white-space: pre } # IDENTIFIERS, KEYWORDS if @scanner.scan(GLOBAL_VARIABLE) kind = :global_variable - elsif @scanner.scan(/ @@ #{IDENT} /ox) + elsif @scanner.scan(/ @@ #{IDENT} /ox) kind = :class_variable - elsif @scanner.scan(/ @ #{IDENT} /ox) + elsif @scanner.scan(/ @ #{IDENT} /ox) kind = :instance_variable elsif @scanner.scan(/ __END__\n ( (?!\#CODE\#) .* )? | \#[^\n]* | =begin(?=\s).*? \n=end(?=\s|\z)(?:[^\n]*)? /x) kind = :comment @@ -635,7 +637,7 @@ ol.CodeRay li { white-space: pre } @scanner.scan(REGEXP) kind = :regexp ## %strings - elsif @scanner.scan(/:(?:#{GLOBAL_VARIABLE}|#{METHOD_NAME_EX}|#{STRING})/ox) + elsif @scanner.scan(/:(?:#{GLOBAL_VARIABLE}|#{METHOD_NAME_EX}|#{STRING})/ox) kind = :global_variable elsif @scanner.scan(/ \? (?: @@ -653,7 +655,7 @@ ol.CodeRay li { white-space: pre } kind = :float elsif @scanner.scan(INTEGER) kind = :integer - elsif @scanner.scan(/:(?:#{GLOBAL_VARIABLE}|#{METHOD_NAME_EX}|#{STRING})/ox) + elsif @scanner.scan(/:(?:#{GLOBAL_VARIABLE}|#{METHOD_NAME_EX}|#{STRING})/ox) kind = :global_variable else @scanner.scan(/./m) @@ -757,7 +759,7 @@ ol.CodeRay li { white-space: pre } when 'xhtml' @HTML_BR = "<br />\n" else - raise "Unknown HTML level: #{level}" + raise "Unknown HTML level: #{level}" end end @@ -777,14 +779,14 @@ ol.CodeRay li { white-space: pre } def to_html token css_class = ClassOfKind[token.kind] if defined? ::DEBUG and not ClassOfKind.has_key? token.kind - warn "no token class found for :#{token.kind}" + warn "no token class found for :#{token.kind}" end text = text_to_html token.text if css_class == :NO_HIGHLIGHT text else - "<span class=\"#{css_class}\">#{text}</span>" + "<span class=\"#{css_class}\">#{text}</span>" end end -- cgit v1.2.1