##// END OF EJS Templates
Coderay upgraded to 0.9.7 (#5344)....
Jean-Philippe Lang -
r4619:144ca23442a5
parent child
Show More
@@ -0,0 +1,155
1 --- !ruby/object:Gem::Specification
2 name: coderay
3 version: !ruby/object:Gem::Version
4 hash: 53
5 prerelease: false
6 segments:
7 - 0
8 - 9
9 - 7
10 version: 0.9.7
11 platform: ruby
12 authors:
13 - murphy
14 autorequire:
15 bindir: bin
16 cert_chain: []
17
18 date: 2011-01-15 00:00:00 +01:00
19 default_executable:
20 dependencies: []
21
22 description: |
23 Fast and easy syntax highlighting for selected languages, written in Ruby.
24 Comes with RedCloth integration and LOC counter.
25
26 email: murphy@rubychan.de
27 executables:
28 - coderay
29 - coderay_stylesheet
30 extensions: []
31
32 extra_rdoc_files:
33 - lib/README
34 - FOLDERS
35 files:
36 - ./lib/coderay/duo.rb
37 - ./lib/coderay/encoder.rb
38 - ./lib/coderay/encoders/_map.rb
39 - ./lib/coderay/encoders/comment_filter.rb
40 - ./lib/coderay/encoders/count.rb
41 - ./lib/coderay/encoders/debug.rb
42 - ./lib/coderay/encoders/div.rb
43 - ./lib/coderay/encoders/filter.rb
44 - ./lib/coderay/encoders/html/css.rb
45 - ./lib/coderay/encoders/html/numerization.rb
46 - ./lib/coderay/encoders/html/output.rb
47 - ./lib/coderay/encoders/html.rb
48 - ./lib/coderay/encoders/json.rb
49 - ./lib/coderay/encoders/lines_of_code.rb
50 - ./lib/coderay/encoders/null.rb
51 - ./lib/coderay/encoders/page.rb
52 - ./lib/coderay/encoders/span.rb
53 - ./lib/coderay/encoders/statistic.rb
54 - ./lib/coderay/encoders/term.rb
55 - ./lib/coderay/encoders/text.rb
56 - ./lib/coderay/encoders/token_class_filter.rb
57 - ./lib/coderay/encoders/xml.rb
58 - ./lib/coderay/encoders/yaml.rb
59 - ./lib/coderay/for_redcloth.rb
60 - ./lib/coderay/helpers/file_type.rb
61 - ./lib/coderay/helpers/gzip_simple.rb
62 - ./lib/coderay/helpers/plugin.rb
63 - ./lib/coderay/helpers/word_list.rb
64 - ./lib/coderay/scanner.rb
65 - ./lib/coderay/scanners/_map.rb
66 - ./lib/coderay/scanners/c.rb
67 - ./lib/coderay/scanners/cpp.rb
68 - ./lib/coderay/scanners/css.rb
69 - ./lib/coderay/scanners/debug.rb
70 - ./lib/coderay/scanners/delphi.rb
71 - ./lib/coderay/scanners/diff.rb
72 - ./lib/coderay/scanners/groovy.rb
73 - ./lib/coderay/scanners/html.rb
74 - ./lib/coderay/scanners/java/builtin_types.rb
75 - ./lib/coderay/scanners/java.rb
76 - ./lib/coderay/scanners/java_script-0.9.6.rb
77 - ./lib/coderay/scanners/java_script.rb
78 - ./lib/coderay/scanners/json.rb
79 - ./lib/coderay/scanners/nitro_xhtml.rb
80 - ./lib/coderay/scanners/php.rb
81 - ./lib/coderay/scanners/plaintext.rb
82 - ./lib/coderay/scanners/python.rb
83 - ./lib/coderay/scanners/rhtml.rb
84 - ./lib/coderay/scanners/ruby/patterns.rb
85 - ./lib/coderay/scanners/ruby.rb
86 - ./lib/coderay/scanners/scheme.rb
87 - ./lib/coderay/scanners/sql.rb
88 - ./lib/coderay/scanners/xml.rb
89 - ./lib/coderay/scanners/yaml.rb
90 - ./lib/coderay/style.rb
91 - ./lib/coderay/styles/_map.rb
92 - ./lib/coderay/styles/cycnus.rb
93 - ./lib/coderay/styles/murphy.rb
94 - ./lib/coderay/token_classes.rb
95 - ./lib/coderay/tokens.rb
96 - ./lib/coderay.rb
97 - ./Rakefile
98 - ./test/functional/basic.rb
99 - ./test/functional/basic.rbc
100 - ./test/functional/for_redcloth.rb
101 - ./test/functional/for_redcloth.rbc
102 - ./test/functional/load_plugin_scanner.rb
103 - ./test/functional/load_plugin_scanner.rbc
104 - ./test/functional/suite.rb
105 - ./test/functional/suite.rbc
106 - ./test/functional/vhdl.rb
107 - ./test/functional/vhdl.rbc
108 - ./test/functional/word_list.rb
109 - ./test/functional/word_list.rbc
110 - ./lib/README
111 - ./LICENSE
112 - lib/README
113 - FOLDERS
114 - bin/coderay
115 - bin/coderay_stylesheet
116 has_rdoc: true
117 homepage: http://coderay.rubychan.de
118 licenses: []
119
120 post_install_message:
121 rdoc_options:
122 - -SNw2
123 - -mlib/README
124 - -t CodeRay Documentation
125 require_paths:
126 - lib
127 required_ruby_version: !ruby/object:Gem::Requirement
128 none: false
129 requirements:
130 - - ">="
131 - !ruby/object:Gem::Version
132 hash: 51
133 segments:
134 - 1
135 - 8
136 - 2
137 version: 1.8.2
138 required_rubygems_version: !ruby/object:Gem::Requirement
139 none: false
140 requirements:
141 - - ">="
142 - !ruby/object:Gem::Version
143 hash: 3
144 segments:
145 - 0
146 version: "0"
147 requirements: []
148
149 rubyforge_project: coderay
150 rubygems_version: 1.3.7
151 signing_key:
152 specification_version: 3
153 summary: Fast syntax highlighting for selected languages.
154 test_files:
155 - ./test/functional/suite.rb
@@ -0,0 +1,53
1 = CodeRay - Trunk folder structure
2
3 == bench - Benchmarking system
4
5 All benchmarking stuff goes here.
6
7 Test inputs are stored in files named <code>example.<lang></code>.
8 Test outputs go to <code>bench/test.<encoder-default-file-extension></code>.
9
10 Run <code>bench/bench.rb</code> to get a usage description.
11
12 Run <code>rake bench</code> to perform an example benchmark.
13
14
15 == bin - Scripts
16
17 Executional files for CodeRay.
18
19
20 == demo - Demos and functional tests
21
22 Demonstrational scripts to show of CodeRay's features.
23
24 Run them as functional tests with <code>rake test:demos</code>.
25
26
27 == etc - Lots of stuff
28
29 Some addidtional files for CodeRay, mainly graphics and Vim scripts.
30
31
32 == gem_server - Gem output folder
33
34 For <code>rake gem</code>.
35
36
37 == lib - CodeRay library code
38
39 This is the base directory for the CodeRay library.
40
41
42 == rake_helpers - Rake helper libraries
43
44 Some files to enhance Rake, including the Autumnal Rdoc template and some scripts.
45
46
47 == test - Tests
48
49 Tests for the scanners.
50
51 Each language has its own subfolder and sub-suite.
52
53 Run with <code>rake test</code>.
@@ -0,0 +1,35
1 require 'rake/rdoctask'
2
3 ROOT = '.'
4 LIB_ROOT = File.join ROOT, 'lib'
5 EXTRA_RDOC_FILES = %w(lib/README FOLDERS)
6
7 task :default => :test
8
9 if File.directory? 'rake_tasks'
10
11 # load rake tasks from subfolder
12 for task_file in Dir['rake_tasks/*.rake'].sort
13 load task_file
14 end
15
16 else
17
18 # fallback tasks when rake_tasks folder is not present
19 desc 'Run CodeRay tests (basic)'
20 task :test do
21 ruby './test/functional/suite.rb'
22 ruby './test/functional/for_redcloth.rb'
23 end
24
25 desc 'Generate documentation for CodeRay'
26 Rake::RDocTask.new :doc do |rd|
27 rd.title = 'CodeRay Documentation'
28 rd.main = 'lib/README'
29 rd.rdoc_files.add Dir['lib']
30 rd.rdoc_files.add 'lib/README'
31 rd.rdoc_files.add 'FOLDERS'
32 rd.rdoc_dir = 'doc'
33 end
34
35 end No newline at end of file
@@ -0,0 +1,86
1 #!/usr/bin/env ruby
2 # CodeRay Executable
3 #
4 # Version: 0.2
5 # Author: murphy
6
7 require 'coderay'
8
9 if ARGV.empty?
10 $stderr.puts <<-USAGE
11 CodeRay #{CodeRay::VERSION} (http://coderay.rubychan.de)
12
13 Usage:
14 coderay file [-<format>]
15 coderay -<lang> [-<format>] [< file] [> output]
16
17 Defaults:
18 lang: based on file extension
19 format: ANSI colorized output for terminal, HTML page for files
20
21 Examples:
22 coderay foo.rb # colorized output to terminal, based on file extension
23 coderay foo.rb -loc # print LOC count, based on file extension and format
24 coderay foo.rb > foo.html # HTML page output to file, based on extension
25 coderay -ruby < foo.rb # colorized output to terminal, based on lang
26 coderay -ruby -loc < foo.rb # print LOC count, based on lang
27 coderay -ruby -page foo.rb # HTML page output to terminal, based on lang and format
28 coderay -ruby -page foo.rb > foo.html # HTML page output to file, based on lang and format
29 USAGE
30 end
31
32 first, second = ARGV
33
34 def read
35 file = ARGV.grep(/^(?!-)/).last
36 if file
37 if File.exist?(file)
38 File.read file
39 else
40 $stderr.puts "No such file: #{file}"
41 end
42 else
43 $stdin.read
44 end
45 end
46
47 if first
48 if first[/-(\w+)/] == first
49 lang = $1
50 input = read
51 tokens = :scan
52 else
53 file = first
54 unless File.exist? file
55 $stderr.puts "No such file: #{file}"
56 exit 2
57 end
58 tokens = CodeRay.scan_file file
59 end
60 else
61 $stderr.puts 'No lang/file given.'
62 exit 1
63 end
64
65 if second
66 if second[/-(\w+)/] == second
67 format = $1.to_sym
68 else
69 raise 'invalid format (must be -xxx)'
70 end
71 else
72 if $stdout.tty?
73 format = :term
74 else
75 $stderr.puts 'No format given; setting to default (HTML Page).'
76 format = :page
77 end
78 end
79
80 if tokens == :scan
81 output = CodeRay::Duo[lang => format].highlight input
82 else
83 output = tokens.encode format
84 end
85 out = $stdout
86 out.puts output
@@ -0,0 +1,4
1 #!/usr/bin/env ruby
2 require 'coderay'
3
4 puts CodeRay::Encoders[:html]::CSS.new.stylesheet
@@ -0,0 +1,224
1 module CodeRay
2 module Scanners
3
4 class JavaScript < Scanner
5
6 include Streamable
7
8 register_for :java_script
9 file_extension 'js'
10
11 # The actual JavaScript keywords.
12 KEYWORDS = %w[
13 break case catch continue default delete do else
14 finally for function if in instanceof new
15 return switch throw try typeof var void while with
16 ]
17 PREDEFINED_CONSTANTS = %w[
18 false null true undefined
19 ]
20
21 MAGIC_VARIABLES = %w[ this arguments ] # arguments was introduced in JavaScript 1.4
22
23 KEYWORDS_EXPECTING_VALUE = WordList.new.add %w[
24 case delete in instanceof new return throw typeof with
25 ]
26
27 # Reserved for future use.
28 RESERVED_WORDS = %w[
29 abstract boolean byte char class debugger double enum export extends
30 final float goto implements import int interface long native package
31 private protected public short static super synchronized throws transient
32 volatile
33 ]
34
35 IDENT_KIND = WordList.new(:ident).
36 add(RESERVED_WORDS, :reserved).
37 add(PREDEFINED_CONSTANTS, :pre_constant).
38 add(MAGIC_VARIABLES, :local_variable).
39 add(KEYWORDS, :keyword)
40
41 ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x
42 UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
43 REGEXP_ESCAPE = / [bBdDsSwW] /x
44 STRING_CONTENT_PATTERN = {
45 "'" => /[^\\']+/,
46 '"' => /[^\\"]+/,
47 '/' => /[^\\\/]+/,
48 }
49 KEY_CHECK_PATTERN = {
50 "'" => / (?> [^\\']* (?: \\. [^\\']* )* ) ' \s* : /mx,
51 '"' => / (?> [^\\"]* (?: \\. [^\\"]* )* ) " \s* : /mx,
52 }
53
54 def scan_tokens tokens, options
55
56 state = :initial
57 string_delimiter = nil
58 value_expected = true
59 key_expected = false
60 function_expected = false
61
62 until eos?
63
64 kind = nil
65 match = nil
66
67 case state
68
69 when :initial
70
71 if match = scan(/ \s+ | \\\n /x)
72 value_expected = true if !value_expected && match.index(?\n)
73 tokens << [match, :space]
74 next
75
76 elsif scan(%r! // [^\n\\]* (?: \\. [^\n\\]* )* | /\* (?: .*? \*/ | .* ) !mx)
77 value_expected = true
78 kind = :comment
79
80 elsif check(/\.?\d/)
81 key_expected = value_expected = false
82 if scan(/0[xX][0-9A-Fa-f]+/)
83 kind = :hex
84 elsif scan(/(?>0[0-7]+)(?![89.eEfF])/)
85 kind = :oct
86 elsif scan(/\d+[fF]|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/)
87 kind = :float
88 elsif scan(/\d+/)
89 kind = :integer
90 end
91
92 elsif value_expected && match = scan(/<([[:alpha:]]\w*) (?: [^\/>]*\/> | .*?<\/\1>)/xim)
93 # FIXME: scan over nested tags
94 xml_scanner.tokenize match
95 value_expected = false
96 next
97
98 elsif match = scan(/ [-+*=<>?:;,!&^|(\[{~%]+ | \.(?!\d) /x)
99 value_expected = true
100 last_operator = match[-1]
101 key_expected = (last_operator == ?{) || (last_operator == ?,)
102 function_expected = false
103 kind = :operator
104
105 elsif scan(/ [)\]}]+ /x)
106 function_expected = key_expected = value_expected = false
107 kind = :operator
108
109 elsif match = scan(/ [$a-zA-Z_][A-Za-z_0-9$]* /x)
110 kind = IDENT_KIND[match]
111 value_expected = (kind == :keyword) && KEYWORDS_EXPECTING_VALUE[match]
112 # TODO: labels
113 if kind == :ident
114 if match.index(?$) # $ allowed inside an identifier
115 kind = :predefined
116 elsif function_expected
117 kind = :function
118 elsif check(/\s*[=:]\s*function\b/)
119 kind = :function
120 elsif key_expected && check(/\s*:/)
121 kind = :key
122 end
123 end
124 function_expected = (kind == :keyword) && (match == 'function')
125 key_expected = false
126
127 elsif match = scan(/["']/)
128 if key_expected && check(KEY_CHECK_PATTERN[match])
129 state = :key
130 else
131 state = :string
132 end
133 tokens << [:open, state]
134 string_delimiter = match
135 kind = :delimiter
136
137 elsif value_expected && (match = scan(/\/(?=\S)/))
138 tokens << [:open, :regexp]
139 state = :regexp
140 string_delimiter = '/'
141 kind = :delimiter
142
143 elsif scan(/ \/ /x)
144 value_expected = true
145 key_expected = false
146 kind = :operator
147
148 else
149 getch
150 kind = :error
151
152 end
153
154 when :string, :regexp, :key
155 if scan(STRING_CONTENT_PATTERN[string_delimiter])
156 kind = :content
157 elsif match = scan(/["'\/]/)
158 tokens << [match, :delimiter]
159 if state == :regexp
160 modifiers = scan(/[gim]+/)
161 tokens << [modifiers, :modifier] if modifiers && !modifiers.empty?
162 end
163 tokens << [:close, state]
164 string_delimiter = nil
165 key_expected = value_expected = false
166 state = :initial
167 next
168 elsif state != :regexp && (match = scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox))
169 if string_delimiter == "'" && !(match == "\\\\" || match == "\\'")
170 kind = :content
171 else
172 kind = :char
173 end
174 elsif state == :regexp && scan(/ \\ (?: #{ESCAPE} | #{REGEXP_ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
175 kind = :char
176 elsif scan(/\\./m)
177 kind = :content
178 elsif scan(/ \\ | $ /x)
179 tokens << [:close, state]
180 kind = :error
181 key_expected = value_expected = false
182 state = :initial
183 else
184 raise_inspect "else case \" reached; %p not handled." % peek(1), tokens
185 end
186
187 else
188 raise_inspect 'Unknown state', tokens
189
190 end
191
192 match ||= matched
193 if $CODERAY_DEBUG and not kind
194 raise_inspect 'Error token %p in line %d' %
195 [[match, kind], line], tokens
196 end
197 raise_inspect 'Empty token', tokens unless match
198
199 tokens << [match, kind]
200
201 end
202
203 if [:string, :regexp].include? state
204 tokens << [:close, state]
205 end
206
207 tokens
208 end
209
210 protected
211
212 def reset_instance
213 super
214 @xml_scanner.reset if defined? @xml_scanner
215 end
216
217 def xml_scanner
218 @xml_scanner ||= CodeRay.scanner :xml, :tokens => @tokens, :keep_tokens => true, :keep_state => false
219 end
220
221 end
222
223 end
224 end
@@ -0,0 +1,122
1 require 'test/unit'
2 require 'coderay'
3
4 class BasicTest < Test::Unit::TestCase
5
6 def test_version
7 assert_nothing_raised do
8 assert_match(/\A\d\.\d\.\d\z/, CodeRay::VERSION)
9 end
10 end
11
12 RUBY_TEST_CODE = 'puts "Hello, World!"'
13
14 RUBY_TEST_TOKENS = [
15 ['puts', :ident],
16 [' ', :space],
17 [:open, :string],
18 ['"', :delimiter],
19 ['Hello, World!', :content],
20 ['"', :delimiter],
21 [:close, :string]
22 ]
23 def test_simple_scan
24 assert_nothing_raised do
25 assert_equal RUBY_TEST_TOKENS, CodeRay.scan(RUBY_TEST_CODE, :ruby).to_ary
26 end
27 end
28
29 RUBY_TEST_HTML = 'puts <span class="s"><span class="dl">&quot;</span>' +
30 '<span class="k">Hello, World!</span><span class="dl">&quot;</span></span>'
31 def test_simple_highlight
32 assert_nothing_raised do
33 assert_equal RUBY_TEST_HTML, CodeRay.scan(RUBY_TEST_CODE, :ruby).html
34 end
35 end
36
37 def test_duo
38 assert_equal(RUBY_TEST_CODE,
39 CodeRay::Duo[:plain, :plain].highlight(RUBY_TEST_CODE))
40 assert_equal(RUBY_TEST_CODE,
41 CodeRay::Duo[:plain => :plain].highlight(RUBY_TEST_CODE))
42 end
43
44 def test_duo_stream
45 assert_equal(RUBY_TEST_CODE,
46 CodeRay::Duo[:plain, :plain].highlight(RUBY_TEST_CODE, :stream => true))
47 end
48
49 def test_comment_filter
50 assert_equal <<-EXPECTED, CodeRay.scan(<<-INPUT, :ruby).comment_filter.text
51 #!/usr/bin/env ruby
52
53 code
54
55 more code
56 EXPECTED
57 #!/usr/bin/env ruby
58 =begin
59 A multi-line comment.
60 =end
61 code
62 # A single-line comment.
63 more code # and another comment, in-line.
64 INPUT
65 end
66
67 def test_lines_of_code
68 assert_equal 2, CodeRay.scan(<<-INPUT, :ruby).lines_of_code
69 #!/usr/bin/env ruby
70 =begin
71 A multi-line comment.
72 =end
73 code
74 # A single-line comment.
75 more code # and another comment, in-line.
76 INPUT
77 rHTML = <<-RHTML
78 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
79 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
80
81 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
82 <head>
83 <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
84 <title><%= controller.controller_name.titleize %>: <%= controller.action_name %></title>
85 <%= stylesheet_link_tag 'scaffold' %>
86 </head>
87 <body>
88
89 <p style="color: green"><%= flash[:notice] %></p>
90
91 <div id="main">
92 <%= yield %>
93 </div>
94
95 </body>
96 </html>
97 RHTML
98 assert_equal 0, CodeRay.scan(rHTML, :html).lines_of_code
99 assert_equal 0, CodeRay.scan(rHTML, :php).lines_of_code
100 assert_equal 0, CodeRay.scan(rHTML, :yaml).lines_of_code
101 assert_equal 4, CodeRay.scan(rHTML, :rhtml).lines_of_code
102 end
103
104 def test_rubygems_not_loaded
105 assert_equal nil, defined? Gem
106 end if ENV['check_rubygems'] && RUBY_VERSION < '1.9'
107
108 def test_list_of_encoders
109 assert_kind_of(Array, CodeRay::Encoders.list)
110 assert CodeRay::Encoders.list.include?('count')
111 end
112
113 def test_list_of_scanners
114 assert_kind_of(Array, CodeRay::Scanners.list)
115 assert CodeRay::Scanners.list.include?('plaintext')
116 end
117
118 def test_scan_a_frozen_string
119 CodeRay.scan RUBY_VERSION, :ruby
120 end
121
122 end
This diff has been collapsed as it changes many lines, (2022 lines changed) Show them Hide them
@@ -0,0 +1,2022
1 !RBIX
2 0
3 x
4 M
5 1
6 n
7 n
8 x
9 10
10 __script__
11 i
12 53
13 5
14 7
15 0
16 64
17 47
18 49
19 1
20 1
21 15
22 5
23 7
24 2
25 64
26 47
27 49
28 1
29 1
30 15
31 99
32 7
33 3
34 45
35 4
36 5
37 43
38 6
39 43
40 7
41 65
42 49
43 8
44 3
45 13
46 99
47 12
48 7
49 9
50 12
51 7
52 10
53 12
54 65
55 12
56 49
57 11
58 4
59 15
60 49
61 9
62 0
63 15
64 2
65 11
66 I
67 6
68 I
69 0
70 I
71 0
72 I
73 0
74 n
75 p
76 12
77 s
78 9
79 test/unit
80 x
81 7
82 require
83 s
84 7
85 coderay
86 x
87 9
88 BasicTest
89 x
90 4
91 Test
92 n
93 x
94 4
95 Unit
96 x
97 8
98 TestCase
99 x
100 10
101 open_class
102 x
103 14
104 __class_init__
105 M
106 1
107 n
108 n
109 x
110 9
111 BasicTest
112 i
113 263
114 5
115 66
116 99
117 7
118 0
119 7
120 1
121 65
122 67
123 49
124 2
125 0
126 49
127 3
128 4
129 15
130 65
131 7
132 4
133 7
134 5
135 64
136 49
137 6
138 2
139 15
140 65
141 7
142 7
143 7
144 8
145 64
146 7
147 9
148 35
149 2
150 7
151 10
152 64
153 7
154 11
155 35
156 2
157 7
158 12
159 7
160 13
161 35
162 2
163 7
164 14
165 64
166 7
167 15
168 35
169 2
170 7
171 16
172 64
173 7
174 17
175 35
176 2
177 7
178 14
179 64
180 7
181 15
182 35
183 2
184 7
185 18
186 7
187 13
188 35
189 2
190 35
191 7
192 49
193 6
194 2
195 15
196 99
197 7
198 19
199 7
200 20
201 65
202 67
203 49
204 2
205 0
206 49
207 3
208 4
209 15
210 65
211 7
212 21
213 7
214 22
215 64
216 7
217 23
218 64
219 81
220 24
221 49
222 6
223 2
224 15
225 99
226 7
227 25
228 7
229 26
230 65
231 67
232 49
233 2
234 0
235 49
236 3
237 4
238 15
239 99
240 7
241 27
242 7
243 28
244 65
245 67
246 49
247 2
248 0
249 49
250 3
251 4
252 15
253 99
254 7
255 29
256 7
257 30
258 65
259 67
260 49
261 2
262 0
263 49
264 3
265 4
266 15
267 99
268 7
269 31
270 7
271 32
272 65
273 67
274 49
275 2
276 0
277 49
278 3
279 4
280 15
281 99
282 7
283 33
284 7
285 34
286 65
287 67
288 49
289 2
290 0
291 49
292 3
293 4
294 15
295 45
296 35
297 36
298 7
299 37
300 64
301 49
302 38
303 1
304 13
305 9
306 202
307 15
308 45
309 39
310 40
311 7
312 41
313 64
314 84
315 42
316 9
317 219
318 99
319 7
320 43
321 7
322 44
323 65
324 67
325 49
326 2
327 0
328 49
329 3
330 4
331 8
332 220
333 1
334 15
335 99
336 7
337 45
338 7
339 46
340 65
341 67
342 49
343 2
344 0
345 49
346 3
347 4
348 15
349 99
350 7
351 47
352 7
353 48
354 65
355 67
356 49
357 2
358 0
359 49
360 3
361 4
362 15
363 99
364 7
365 49
366 7
367 50
368 65
369 67
370 49
371 2
372 0
373 49
374 3
375 4
376 11
377 I
378 a
379 I
380 0
381 I
382 0
383 I
384 0
385 n
386 p
387 51
388 x
389 12
390 test_version
391 M
392 1
393 n
394 n
395 x
396 12
397 test_version
398 i
399 8
400 5
401 56
402 0
403 47
404 50
405 1
406 0
407 11
408 I
409 2
410 I
411 0
412 I
413 0
414 I
415 0
416 n
417 p
418 2
419 M
420 1
421 p
422 2
423 x
424 9
425 for_block
426 t
427 n
428 x
429 12
430 test_version
431 i
432 29
433 5
434 7
435 0
436 13
437 70
438 9
439 19
440 15
441 44
442 43
443 1
444 7
445 2
446 78
447 49
448 3
449 2
450 6
451 0
452 45
453 4
454 5
455 43
456 6
457 47
458 49
459 7
460 2
461 11
462 I
463 5
464 I
465 0
466 I
467 0
468 I
469 0
470 I
471 -2
472 p
473 8
474 n
475 x
476 6
477 Regexp
478 s
479 14
480 \A\d\.\d\.\d\z
481 x
482 3
483 new
484 x
485 7
486 CodeRay
487 n
488 x
489 7
490 VERSION
491 x
492 12
493 assert_match
494 p
495 5
496 I
497 0
498 I
499 7
500 I
501 0
502 I
503 8
504 I
505 1d
506 x
507 55
508 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
509 p
510 0
511 x
512 21
513 assert_nothing_raised
514 p
515 5
516 I
517 0
518 I
519 6
520 I
521 0
522 I
523 7
524 I
525 8
526 x
527 55
528 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
529 p
530 0
531 x
532 17
533 method_visibility
534 x
535 15
536 add_defn_method
537 x
538 14
539 RUBY_TEST_CODE
540 s
541 20
542 puts "Hello, World!"
543 x
544 9
545 const_set
546 x
547 16
548 RUBY_TEST_TOKENS
549 s
550 4
551 puts
552 x
553 5
554 ident
555 s
556 1
557
558 x
559 5
560 space
561 x
562 4
563 open
564 x
565 6
566 string
567 s
568 1
569 "
570 x
571 9
572 delimiter
573 s
574 13
575 Hello, World!
576 x
577 7
578 content
579 x
580 5
581 close
582 x
583 16
584 test_simple_scan
585 M
586 1
587 n
588 n
589 x
590 16
591 test_simple_scan
592 i
593 8
594 5
595 56
596 0
597 47
598 50
599 1
600 0
601 11
602 I
603 2
604 I
605 0
606 I
607 0
608 I
609 0
610 n
611 p
612 2
613 M
614 1
615 p
616 2
617 x
618 9
619 for_block
620 t
621 n
622 x
623 16
624 test_simple_scan
625 i
626 23
627 5
628 45
629 0
630 1
631 45
632 2
633 3
634 45
635 4
636 5
637 7
638 6
639 49
640 7
641 2
642 49
643 8
644 0
645 47
646 49
647 9
648 2
649 11
650 I
651 6
652 I
653 0
654 I
655 0
656 I
657 0
658 I
659 -2
660 p
661 10
662 x
663 16
664 RUBY_TEST_TOKENS
665 n
666 x
667 7
668 CodeRay
669 n
670 x
671 14
672 RUBY_TEST_CODE
673 n
674 x
675 4
676 ruby
677 x
678 4
679 scan
680 x
681 6
682 to_ary
683 x
684 12
685 assert_equal
686 p
687 5
688 I
689 0
690 I
691 18
692 I
693 0
694 I
695 19
696 I
697 17
698 x
699 55
700 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
701 p
702 0
703 x
704 21
705 assert_nothing_raised
706 p
707 5
708 I
709 0
710 I
711 17
712 I
713 0
714 I
715 18
716 I
717 8
718 x
719 55
720 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
721 p
722 0
723 x
724 14
725 RUBY_TEST_HTML
726 s
727 51
728 puts <span class="s"><span class="dl">&quot;</span>
729 s
730 73
731 <span class="k">Hello, World!</span><span class="dl">&quot;</span></span>
732 x
733 1
734 +
735 x
736 21
737 test_simple_highlight
738 M
739 1
740 n
741 n
742 x
743 21
744 test_simple_highlight
745 i
746 8
747 5
748 56
749 0
750 47
751 50
752 1
753 0
754 11
755 I
756 2
757 I
758 0
759 I
760 0
761 I
762 0
763 n
764 p
765 2
766 M
767 1
768 p
769 2
770 x
771 9
772 for_block
773 t
774 n
775 x
776 21
777 test_simple_highlight
778 i
779 23
780 5
781 45
782 0
783 1
784 45
785 2
786 3
787 45
788 4
789 5
790 7
791 6
792 49
793 7
794 2
795 49
796 8
797 0
798 47
799 49
800 9
801 2
802 11
803 I
804 6
805 I
806 0
807 I
808 0
809 I
810 0
811 I
812 -2
813 p
814 10
815 x
816 14
817 RUBY_TEST_HTML
818 n
819 x
820 7
821 CodeRay
822 n
823 x
824 14
825 RUBY_TEST_CODE
826 n
827 x
828 4
829 ruby
830 x
831 4
832 scan
833 x
834 4
835 html
836 x
837 12
838 assert_equal
839 p
840 5
841 I
842 0
843 I
844 20
845 I
846 0
847 I
848 21
849 I
850 17
851 x
852 55
853 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
854 p
855 0
856 x
857 21
858 assert_nothing_raised
859 p
860 5
861 I
862 0
863 I
864 1f
865 I
866 0
867 I
868 20
869 I
870 8
871 x
872 55
873 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
874 p
875 0
876 x
877 8
878 test_duo
879 M
880 1
881 n
882 n
883 x
884 8
885 test_duo
886 i
887 66
888 5
889 45
890 0
891 1
892 45
893 2
894 3
895 43
896 4
897 7
898 5
899 7
900 5
901 49
902 6
903 2
904 45
905 0
906 7
907 49
908 8
909 1
910 47
911 49
912 9
913 2
914 15
915 5
916 45
917 0
918 10
919 45
920 2
921 11
922 43
923 4
924 44
925 43
926 12
927 79
928 49
929 13
930 1
931 13
932 7
933 5
934 7
935 5
936 49
937 14
938 2
939 15
940 49
941 6
942 1
943 45
944 0
945 15
946 49
947 8
948 1
949 47
950 49
951 9
952 2
953 11
954 I
955 7
956 I
957 0
958 I
959 0
960 I
961 0
962 n
963 p
964 16
965 x
966 14
967 RUBY_TEST_CODE
968 n
969 x
970 7
971 CodeRay
972 n
973 x
974 3
975 Duo
976 x
977 5
978 plain
979 x
980 2
981 []
982 n
983 x
984 9
985 highlight
986 x
987 12
988 assert_equal
989 n
990 n
991 x
992 4
993 Hash
994 x
995 16
996 new_from_literal
997 x
998 3
999 []=
1000 n
1001 p
1002 15
1003 I
1004 0
1005 I
1006 25
1007 I
1008 0
1009 I
1010 26
1011 I
1012 4
1013 I
1014 27
1015 I
1016 16
1017 I
1018 26
1019 I
1020 1b
1021 I
1022 28
1023 I
1024 1f
1025 I
1026 29
1027 I
1028 3d
1029 I
1030 28
1031 I
1032 42
1033 x
1034 55
1035 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
1036 p
1037 0
1038 x
1039 15
1040 test_duo_stream
1041 M
1042 1
1043 n
1044 n
1045 x
1046 15
1047 test_duo_stream
1048 i
1049 42
1050 5
1051 45
1052 0
1053 1
1054 45
1055 2
1056 3
1057 43
1058 4
1059 7
1060 5
1061 7
1062 5
1063 49
1064 6
1065 2
1066 45
1067 0
1068 7
1069 44
1070 43
1071 8
1072 79
1073 49
1074 9
1075 1
1076 13
1077 7
1078 10
1079 2
1080 49
1081 11
1082 2
1083 15
1084 49
1085 12
1086 2
1087 47
1088 49
1089 13
1090 2
1091 11
1092 I
1093 8
1094 I
1095 0
1096 I
1097 0
1098 I
1099 0
1100 n
1101 p
1102 14
1103 x
1104 14
1105 RUBY_TEST_CODE
1106 n
1107 x
1108 7
1109 CodeRay
1110 n
1111 x
1112 3
1113 Duo
1114 x
1115 5
1116 plain
1117 x
1118 2
1119 []
1120 n
1121 x
1122 4
1123 Hash
1124 x
1125 16
1126 new_from_literal
1127 x
1128 6
1129 stream
1130 x
1131 3
1132 []=
1133 x
1134 9
1135 highlight
1136 x
1137 12
1138 assert_equal
1139 p
1140 9
1141 I
1142 0
1143 I
1144 2c
1145 I
1146 0
1147 I
1148 2d
1149 I
1150 4
1151 I
1152 2e
1153 I
1154 25
1155 I
1156 2d
1157 I
1158 2a
1159 x
1160 55
1161 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
1162 p
1163 0
1164 x
1165 19
1166 test_comment_filter
1167 M
1168 1
1169 n
1170 n
1171 x
1172 19
1173 test_comment_filter
1174 i
1175 26
1176 5
1177 7
1178 0
1179 64
1180 45
1181 1
1182 2
1183 7
1184 3
1185 64
1186 7
1187 4
1188 49
1189 5
1190 2
1191 49
1192 6
1193 0
1194 49
1195 7
1196 0
1197 47
1198 49
1199 8
1200 2
1201 11
1202 I
1203 5
1204 I
1205 0
1206 I
1207 0
1208 I
1209 0
1210 n
1211 p
1212 9
1213 s
1214 39
1215 #!/usr/bin/env ruby
1216
1217 code
1218
1219 more code
1220
1221 x
1222 7
1223 CodeRay
1224 n
1225 s
1226 127
1227 #!/usr/bin/env ruby
1228 =begin
1229 A multi-line comment.
1230 =end
1231 code
1232 # A single-line comment.
1233 more code # and another comment, in-line.
1234
1235 x
1236 4
1237 ruby
1238 x
1239 4
1240 scan
1241 x
1242 14
1243 comment_filter
1244 x
1245 4
1246 text
1247 x
1248 12
1249 assert_equal
1250 p
1251 5
1252 I
1253 0
1254 I
1255 31
1256 I
1257 0
1258 I
1259 32
1260 I
1261 1a
1262 x
1263 55
1264 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
1265 p
1266 0
1267 x
1268 18
1269 test_lines_of_code
1270 M
1271 1
1272 n
1273 n
1274 x
1275 18
1276 test_lines_of_code
1277 i
1278 108
1279 5
1280 80
1281 45
1282 0
1283 1
1284 7
1285 2
1286 64
1287 7
1288 3
1289 49
1290 4
1291 2
1292 49
1293 5
1294 0
1295 47
1296 49
1297 6
1298 2
1299 15
1300 7
1301 7
1302 64
1303 19
1304 0
1305 15
1306 5
1307 78
1308 45
1309 0
1310 8
1311 20
1312 0
1313 7
1314 9
1315 49
1316 4
1317 2
1318 49
1319 5
1320 0
1321 47
1322 49
1323 6
1324 2
1325 15
1326 5
1327 78
1328 45
1329 0
1330 10
1331 20
1332 0
1333 7
1334 11
1335 49
1336 4
1337 2
1338 49
1339 5
1340 0
1341 47
1342 49
1343 6
1344 2
1345 15
1346 5
1347 78
1348 45
1349 0
1350 12
1351 20
1352 0
1353 7
1354 13
1355 49
1356 4
1357 2
1358 49
1359 5
1360 0
1361 47
1362 49
1363 6
1364 2
1365 15
1366 5
1367 4
1368 4
1369 45
1370 0
1371 14
1372 20
1373 0
1374 7
1375 15
1376 49
1377 4
1378 2
1379 49
1380 5
1381 0
1382 47
1383 49
1384 6
1385 2
1386 11
1387 I
1388 6
1389 I
1390 1
1391 I
1392 0
1393 I
1394 0
1395 n
1396 p
1397 16
1398 x
1399 7
1400 CodeRay
1401 n
1402 s
1403 127
1404 #!/usr/bin/env ruby
1405 =begin
1406 A multi-line comment.
1407 =end
1408 code
1409 # A single-line comment.
1410 more code # and another comment, in-line.
1411
1412 x
1413 4
1414 ruby
1415 x
1416 4
1417 scan
1418 x
1419 13
1420 lines_of_code
1421 x
1422 12
1423 assert_equal
1424 s
1425 514
1426 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
1427 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
1428
1429 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
1430 <head>
1431 <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
1432 <title><%= controller.controller_name.titleize %>: <%= controller.action_name %></title>
1433 <%= stylesheet_link_tag 'scaffold' %>
1434 </head>
1435 <body>
1436
1437 <p style="color: green"><%= flash[:notice] %></p>
1438
1439 <div id="main">
1440 <%= yield %>
1441 </div>
1442
1443 </body>
1444 </html>
1445
1446 n
1447 x
1448 4
1449 html
1450 n
1451 x
1452 3
1453 php
1454 n
1455 x
1456 4
1457 yaml
1458 n
1459 x
1460 5
1461 rhtml
1462 p
1463 15
1464 I
1465 0
1466 I
1467 43
1468 I
1469 0
1470 I
1471 44
1472 I
1473 15
1474 I
1475 4d
1476 I
1477 1b
1478 I
1479 62
1480 I
1481 2f
1482 I
1483 63
1484 I
1485 43
1486 I
1487 64
1488 I
1489 57
1490 I
1491 65
1492 I
1493 6c
1494 x
1495 55
1496 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
1497 p
1498 1
1499 x
1500 5
1501 rHTML
1502 x
1503 3
1504 ENV
1505 n
1506 s
1507 14
1508 check_rubygems
1509 x
1510 2
1511 []
1512 x
1513 12
1514 RUBY_VERSION
1515 n
1516 s
1517 3
1518 1.9
1519 x
1520 1
1521 <
1522 x
1523 24
1524 test_rubygems_not_loaded
1525 M
1526 1
1527 n
1528 n
1529 x
1530 24
1531 test_rubygems_not_loaded
1532 i
1533 34
1534 5
1535 1
1536 26
1537 93
1538 0
1539 15
1540 29
1541 17
1542 0
1543 7
1544 0
1545 98
1546 1
1547 1
1548 30
1549 8
1550 23
1551 25
1552 92
1553 0
1554 27
1555 8
1556 28
1557 15
1558 7
1559 2
1560 8
1561 29
1562 1
1563 47
1564 49
1565 3
1566 2
1567 11
1568 I
1569 4
1570 I
1571 0
1572 I
1573 0
1574 I
1575 0
1576 n
1577 p
1578 4
1579 x
1580 3
1581 Gem
1582 x
1583 16
1584 vm_const_defined
1585 s
1586 8
1587 constant
1588 x
1589 12
1590 assert_equal
1591 p
1592 5
1593 I
1594 0
1595 I
1596 68
1597 I
1598 0
1599 I
1600 69
1601 I
1602 22
1603 x
1604 55
1605 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
1606 p
1607 0
1608 x
1609 21
1610 test_list_of_encoders
1611 M
1612 1
1613 n
1614 n
1615 x
1616 21
1617 test_list_of_encoders
1618 i
1619 37
1620 5
1621 45
1622 0
1623 1
1624 45
1625 2
1626 3
1627 43
1628 4
1629 49
1630 5
1631 0
1632 47
1633 49
1634 6
1635 2
1636 15
1637 5
1638 45
1639 2
1640 7
1641 43
1642 4
1643 49
1644 5
1645 0
1646 7
1647 8
1648 64
1649 49
1650 9
1651 1
1652 47
1653 49
1654 10
1655 1
1656 11
1657 I
1658 3
1659 I
1660 0
1661 I
1662 0
1663 I
1664 0
1665 n
1666 p
1667 11
1668 x
1669 5
1670 Array
1671 n
1672 x
1673 7
1674 CodeRay
1675 n
1676 x
1677 8
1678 Encoders
1679 x
1680 4
1681 list
1682 x
1683 14
1684 assert_kind_of
1685 n
1686 s
1687 5
1688 count
1689 x
1690 8
1691 include?
1692 x
1693 6
1694 assert
1695 p
1696 7
1697 I
1698 0
1699 I
1700 6c
1701 I
1702 0
1703 I
1704 6d
1705 I
1706 11
1707 I
1708 6e
1709 I
1710 25
1711 x
1712 55
1713 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
1714 p
1715 0
1716 x
1717 21
1718 test_list_of_scanners
1719 M
1720 1
1721 n
1722 n
1723 x
1724 21
1725 test_list_of_scanners
1726 i
1727 37
1728 5
1729 45
1730 0
1731 1
1732 45
1733 2
1734 3
1735 43
1736 4
1737 49
1738 5
1739 0
1740 47
1741 49
1742 6
1743 2
1744 15
1745 5
1746 45
1747 2
1748 7
1749 43
1750 4
1751 49
1752 5
1753 0
1754 7
1755 8
1756 64
1757 49
1758 9
1759 1
1760 47
1761 49
1762 10
1763 1
1764 11
1765 I
1766 3
1767 I
1768 0
1769 I
1770 0
1771 I
1772 0
1773 n
1774 p
1775 11
1776 x
1777 5
1778 Array
1779 n
1780 x
1781 7
1782 CodeRay
1783 n
1784 x
1785 8
1786 Scanners
1787 x
1788 4
1789 list
1790 x
1791 14
1792 assert_kind_of
1793 n
1794 s
1795 9
1796 plaintext
1797 x
1798 8
1799 include?
1800 x
1801 6
1802 assert
1803 p
1804 7
1805 I
1806 0
1807 I
1808 71
1809 I
1810 0
1811 I
1812 72
1813 I
1814 11
1815 I
1816 73
1817 I
1818 25
1819 x
1820 55
1821 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
1822 p
1823 0
1824 x
1825 25
1826 test_scan_a_frozen_string
1827 M
1828 1
1829 n
1830 n
1831 x
1832 25
1833 test_scan_a_frozen_string
1834 i
1835 12
1836 45
1837 0
1838 1
1839 45
1840 2
1841 3
1842 7
1843 4
1844 49
1845 5
1846 2
1847 11
1848 I
1849 3
1850 I
1851 0
1852 I
1853 0
1854 I
1855 0
1856 n
1857 p
1858 6
1859 x
1860 7
1861 CodeRay
1862 n
1863 x
1864 12
1865 RUBY_VERSION
1866 n
1867 x
1868 4
1869 ruby
1870 x
1871 4
1872 scan
1873 p
1874 5
1875 I
1876 0
1877 I
1878 76
1879 I
1880 0
1881 I
1882 77
1883 I
1884 c
1885 x
1886 55
1887 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
1888 p
1889 0
1890 p
1891 51
1892 I
1893 2
1894 I
1895 6
1896 I
1897 10
1898 I
1899 c
1900 I
1901 1a
1902 I
1903 e
1904 I
1905 1d
1906 I
1907 f
1908 I
1909 24
1910 I
1911 10
1912 I
1913 2b
1914 I
1915 11
1916 I
1917 31
1918 I
1919 12
1920 I
1921 38
1922 I
1923 13
1924 I
1925 3f
1926 I
1927 14
1928 I
1929 46
1930 I
1931 15
1932 I
1933 52
1934 I
1935 17
1936 I
1937 60
1938 I
1939 1d
1940 I
1941 63
1942 I
1943 1d
1944 I
1945 66
1946 I
1947 1e
1948 I
1949 6f
1950 I
1951 1f
1952 I
1953 7d
1954 I
1955 25
1956 I
1957 8b
1958 I
1959 2c
1960 I
1961 99
1962 I
1963 31
1964 I
1965 a7
1966 I
1967 43
1968 I
1969 b5
1970 I
1971 6a
1972 I
1973 cc
1974 I
1975 68
1976 I
1977 db
1978 I
1979 6a
1980 I
1981 dd
1982 I
1983 6c
1984 I
1985 eb
1986 I
1987 71
1988 I
1989 f9
1990 I
1991 76
1992 I
1993 107
1994 x
1995 55
1996 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
1997 p
1998 0
1999 x
2000 13
2001 attach_method
2002 p
2003 7
2004 I
2005 0
2006 I
2007 1
2008 I
2009 9
2010 I
2011 2
2012 I
2013 12
2014 I
2015 4
2016 I
2017 35
2018 x
2019 55
2020 /Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
2021 p
2022 0
@@ -0,0 +1,77
1 require 'test/unit'
2 $:.unshift 'lib'
3 require 'coderay'
4
5 begin
6 require 'rubygems' unless defined? Gem
7 gem 'RedCloth', '>= 4.0.3' rescue nil
8 require 'redcloth'
9 rescue LoadError
10 warn 'RedCloth not found - skipping for_redcloth tests.'
11 end
12
13 class BasicTest < Test::Unit::TestCase
14
15 def test_for_redcloth
16 require 'coderay/for_redcloth'
17 assert_equal "<p><span lang=\"ruby\" class=\"CodeRay\">puts <span style=\"background-color:#fff0f0;color:#D20\"><span style=\"color:#710\">&quot;</span><span style=\"\">Hello, World!</span><span style=\"color:#710\">&quot;</span></span></span></p>",
18 RedCloth.new('@[ruby]puts "Hello, World!"@').to_html
19 assert_equal <<-BLOCKCODE.chomp,
20 <div lang="ruby" class="CodeRay">
21 <div class="code"><pre>puts <span style="background-color:#fff0f0;color:#D20"><span style="color:#710">&quot;</span><span style="">Hello, World!</span><span style="color:#710">&quot;</span></span></pre></div>
22 </div>
23 BLOCKCODE
24 RedCloth.new('bc[ruby]. puts "Hello, World!"').to_html
25 end
26
27 def test_for_redcloth_no_lang
28 require 'coderay/for_redcloth'
29 assert_equal "<p><code>puts \"Hello, World!\"</code></p>",
30 RedCloth.new('@puts "Hello, World!"@').to_html
31 assert_equal <<-BLOCKCODE.chomp,
32 <pre><code>puts \"Hello, World!\"</code></pre>
33 BLOCKCODE
34 RedCloth.new('bc. puts "Hello, World!"').to_html
35 end
36
37 def test_for_redcloth_style
38 require 'coderay/for_redcloth'
39 assert_equal <<-BLOCKCODE.chomp,
40 <pre style=\"color: red;\"><code style=\"color: red;\">puts \"Hello, World!\"</code></pre>
41 BLOCKCODE
42 RedCloth.new('bc{color: red}. puts "Hello, World!"').to_html
43 end
44
45 def test_for_redcloth_escapes
46 require 'coderay/for_redcloth'
47 assert_equal '<p><span lang="ruby" class="CodeRay">&gt;</span></p>',
48 RedCloth.new('@[ruby]>@').to_html
49 assert_equal <<-BLOCKCODE.chomp,
50 <div lang="ruby" class="CodeRay">
51 <div class="code"><pre>&amp;</pre></div>
52 </div>
53 BLOCKCODE
54 RedCloth.new('bc[ruby]. &').to_html
55 end
56
57 def test_for_redcloth_escapes2
58 require 'coderay/for_redcloth'
59 assert_equal "<p><span lang=\"c\" class=\"CodeRay\"><span style=\"color:#579\">#include</span> <span style=\"color:#B44;font-weight:bold\">&lt;test.h&gt;</span></span></p>",
60 RedCloth.new('@[c]#include <test.h>@').to_html
61 end
62
63 # See http://jgarber.lighthouseapp.com/projects/13054/tickets/124-code-markup-does-not-allow-brackets.
64 def test_for_redcloth_false_positive
65 require 'coderay/for_redcloth'
66 assert_equal '<p><code>[project]_dff.skjd</code></p>',
67 RedCloth.new('@[project]_dff.skjd@').to_html
68 # false positive, but expected behavior / known issue
69 assert_equal "<p><span lang=\"ruby\" class=\"CodeRay\">_dff.skjd</span></p>",
70 RedCloth.new('@[ruby]_dff.skjd@').to_html
71 assert_equal <<-BLOCKCODE.chomp,
72 <pre><code>[project]_dff.skjd</code></pre>
73 BLOCKCODE
74 RedCloth.new('bc. [project]_dff.skjd').to_html
75 end
76
77 end if defined? RedCloth No newline at end of file
This diff has been collapsed as it changes many lines, (1708 lines changed) Show them Hide them
@@ -0,0 +1,1708
1 !RBIX
2 0
3 x
4 M
5 1
6 n
7 n
8 x
9 10
10 __script__
11 i
12 249
13 5
14 7
15 0
16 64
17 47
18 49
19 1
20 1
21 15
22 99
23 43
24 2
25 7
26 3
27 49
28 4
29 1
30 7
31 5
32 64
33 49
34 6
35 1
36 15
37 5
38 7
39 7
40 64
41 47
42 49
43 1
44 1
45 15
46 26
47 93
48 0
49 15
50 29
51 144
52 0
53 26
54 93
55 1
56 15
57 29
58 55
59 0
60 7
61 8
62 98
63 9
64 1
65 30
66 8
67 61
68 25
69 92
70 1
71 27
72 8
73 66
74 15
75 7
76 10
77 8
78 67
79 1
80 9
81 72
82 1
83 8
84 80
85 5
86 7
87 11
88 64
89 47
90 49
91 1
92 1
93 15
94 26
95 93
96 2
97 15
98 29
99 102
100 0
101 5
102 7
103 12
104 64
105 7
106 13
107 64
108 47
109 49
110 14
111 2
112 30
113 8
114 129
115 26
116 93
117 3
118 15
119 24
120 13
121 45
122 15
123 16
124 12
125 49
126 17
127 1
128 10
129 119
130 8
131 124
132 15
133 1
134 25
135 8
136 129
137 15
138 92
139 3
140 27
141 34
142 92
143 2
144 27
145 15
146 5
147 7
148 18
149 64
150 47
151 49
152 1
153 1
154 30
155 8
156 178
157 26
158 93
159 4
160 15
161 24
162 13
163 45
164 19
165 20
166 12
167 49
168 17
169 1
170 10
171 161
172 8
173 173
174 15
175 5
176 7
177 21
178 64
179 47
180 49
181 22
182 1
183 25
184 8
185 178
186 15
187 92
188 4
189 27
190 34
191 92
192 0
193 27
194 15
195 26
196 93
197 5
198 15
199 29
200 197
201 0
202 7
203 23
204 98
205 9
206 1
207 30
208 8
209 203
210 25
211 92
212 5
213 27
214 8
215 208
216 15
217 7
218 10
219 8
220 209
221 1
222 9
223 245
224 99
225 7
226 24
227 45
228 25
229 26
230 43
231 27
232 43
233 28
234 65
235 49
236 29
237 3
238 13
239 99
240 12
241 7
242 30
243 12
244 7
245 31
246 12
247 65
248 12
249 49
250 32
251 4
252 15
253 49
254 30
255 0
256 8
257 246
258 1
259 15
260 2
261 11
262 I
263 c
264 I
265 0
266 I
267 0
268 I
269 0
270 n
271 p
272 33
273 s
274 9
275 test/unit
276 x
277 7
278 require
279 x
280 7
281 Globals
282 x
283 2
284 $:
285 x
286 2
287 []
288 s
289 3
290 lib
291 x
292 2
293 <<
294 s
295 7
296 coderay
297 x
298 3
299 Gem
300 x
301 16
302 vm_const_defined
303 s
304 8
305 constant
306 s
307 8
308 rubygems
309 s
310 8
311 RedCloth
312 s
313 8
314 >= 4.0.3
315 x
316 3
317 gem
318 x
319 13
320 StandardError
321 n
322 x
323 3
324 ===
325 s
326 8
327 redcloth
328 x
329 9
330 LoadError
331 n
332 s
333 49
334 RedCloth not found - skipping for_redcloth tests.
335 x
336 4
337 warn
338 x
339 8
340 RedCloth
341 x
342 9
343 BasicTest
344 x
345 4
346 Test
347 n
348 x
349 4
350 Unit
351 x
352 8
353 TestCase
354 x
355 10
356 open_class
357 x
358 14
359 __class_init__
360 M
361 1
362 n
363 n
364 x
365 9
366 BasicTest
367 i
368 86
369 5
370 66
371 99
372 7
373 0
374 7
375 1
376 65
377 67
378 49
379 2
380 0
381 49
382 3
383 4
384 15
385 99
386 7
387 4
388 7
389 5
390 65
391 67
392 49
393 2
394 0
395 49
396 3
397 4
398 15
399 99
400 7
401 6
402 7
403 7
404 65
405 67
406 49
407 2
408 0
409 49
410 3
411 4
412 15
413 99
414 7
415 8
416 7
417 9
418 65
419 67
420 49
421 2
422 0
423 49
424 3
425 4
426 15
427 99
428 7
429 10
430 7
431 11
432 65
433 67
434 49
435 2
436 0
437 49
438 3
439 4
440 15
441 99
442 7
443 12
444 7
445 13
446 65
447 67
448 49
449 2
450 0
451 49
452 3
453 4
454 11
455 I
456 5
457 I
458 0
459 I
460 0
461 I
462 0
463 n
464 p
465 14
466 x
467 17
468 test_for_redcloth
469 M
470 1
471 n
472 n
473 x
474 17
475 test_for_redcloth
476 i
477 96
478 5
479 7
480 0
481 64
482 47
483 49
484 1
485 1
486 15
487 5
488 7
489 2
490 64
491 45
492 3
493 4
494 13
495 71
496 5
497 47
498 9
499 37
500 47
501 49
502 6
503 0
504 13
505 7
506 7
507 64
508 47
509 49
510 8
511 1
512 15
513 8
514 43
515 7
516 7
517 64
518 49
519 5
520 1
521 49
522 9
523 0
524 47
525 49
526 10
527 2
528 15
529 5
530 7
531 11
532 64
533 49
534 12
535 0
536 45
537 3
538 13
539 13
540 71
541 5
542 47
543 9
544 82
545 47
546 49
547 6
548 0
549 13
550 7
551 14
552 64
553 47
554 49
555 8
556 1
557 15
558 8
559 88
560 7
561 14
562 64
563 49
564 5
565 1
566 49
567 9
568 0
569 47
570 49
571 10
572 2
573 11
574 I
575 5
576 I
577 0
578 I
579 0
580 I
581 0
582 n
583 p
584 15
585 s
586 20
587 coderay/for_redcloth
588 x
589 7
590 require
591 s
592 221
593 <p><span lang="ruby" class="CodeRay">puts <span style="background-color:#fff0f0;color:#D20"><span style="color:#710">&quot;</span><span style="">Hello, World!</span><span style="color:#710">&quot;</span></span></span></p>
594 x
595 8
596 RedCloth
597 n
598 x
599 3
600 new
601 x
602 8
603 allocate
604 s
605 28
606 @[ruby]puts "Hello, World!"@
607 x
608 10
609 initialize
610 x
611 7
612 to_html
613 x
614 12
615 assert_equal
616 s
617 252
618 <div lang="ruby" class="CodeRay">
619 <div class="code"><pre>puts <span style="background-color:#fff0f0;color:#D20"><span style="color:#710">&quot;</span><span style="">Hello, World!</span><span style="color:#710">&quot;</span></span></pre></div>
620 </div>
621
622 x
623 5
624 chomp
625 n
626 s
627 30
628 bc[ruby]. puts "Hello, World!"
629 p
630 17
631 I
632 0
633 I
634 f
635 I
636 0
637 I
638 10
639 I
640 9
641 I
642 11
643 I
644 d
645 I
646 12
647 I
648 2e
649 I
650 11
651 I
652 33
653 I
654 13
655 I
656 3a
657 I
658 18
659 I
660 5b
661 I
662 13
663 I
664 60
665 x
666 62
667 /Users/murphy/ruby/coderay-0.9/test/functional/for_redcloth.rb
668 p
669 0
670 x
671 17
672 method_visibility
673 x
674 15
675 add_defn_method
676 x
677 25
678 test_for_redcloth_no_lang
679 M
680 1
681 n
682 n
683 x
684 25
685 test_for_redcloth_no_lang
686 i
687 96
688 5
689 7
690 0
691 64
692 47
693 49
694 1
695 1
696 15
697 5
698 7
699 2
700 64
701 45
702 3
703 4
704 13
705 71
706 5
707 47
708 9
709 37
710 47
711 49
712 6
713 0
714 13
715 7
716 7
717 64
718 47
719 49
720 8
721 1
722 15
723 8
724 43
725 7
726 7
727 64
728 49
729 5
730 1
731 49
732 9
733 0
734 47
735 49
736 10
737 2
738 15
739 5
740 7
741 11
742 64
743 49
744 12
745 0
746 45
747 3
748 13
749 13
750 71
751 5
752 47
753 9
754 82
755 47
756 49
757 6
758 0
759 13
760 7
761 14
762 64
763 47
764 49
765 8
766 1
767 15
768 8
769 88
770 7
771 14
772 64
773 49
774 5
775 1
776 49
777 9
778 0
779 47
780 49
781 10
782 2
783 11
784 I
785 5
786 I
787 0
788 I
789 0
790 I
791 0
792 n
793 p
794 15
795 s
796 20
797 coderay/for_redcloth
798 x
799 7
800 require
801 s
802 40
803 <p><code>puts "Hello, World!"</code></p>
804 x
805 8
806 RedCloth
807 n
808 x
809 3
810 new
811 x
812 8
813 allocate
814 s
815 22
816 @puts "Hello, World!"@
817 x
818 10
819 initialize
820 x
821 7
822 to_html
823 x
824 12
825 assert_equal
826 s
827 45
828 <pre><code>puts "Hello, World!"</code></pre>
829
830 x
831 5
832 chomp
833 n
834 s
835 24
836 bc. puts "Hello, World!"
837 p
838 17
839 I
840 0
841 I
842 1b
843 I
844 0
845 I
846 1c
847 I
848 9
849 I
850 1d
851 I
852 d
853 I
854 1e
855 I
856 2e
857 I
858 1d
859 I
860 33
861 I
862 1f
863 I
864 3a
865 I
866 22
867 I
868 5b
869 I
870 1f
871 I
872 60
873 x
874 62
875 /Users/murphy/ruby/coderay-0.9/test/functional/for_redcloth.rb
876 p
877 0
878 x
879 23
880 test_for_redcloth_style
881 M
882 1
883 n
884 n
885 x
886 23
887 test_for_redcloth_style
888 i
889 54
890 5
891 7
892 0
893 64
894 47
895 49
896 1
897 1
898 15
899 5
900 7
901 2
902 64
903 49
904 3
905 0
906 45
907 4
908 5
909 13
910 71
911 6
912 47
913 9
914 40
915 47
916 49
917 7
918 0
919 13
920 7
921 8
922 64
923 47
924 49
925 9
926 1
927 15
928 8
929 46
930 7
931 8
932 64
933 49
934 6
935 1
936 49
937 10
938 0
939 47
940 49
941 11
942 2
943 11
944 I
945 5
946 I
947 0
948 I
949 0
950 I
951 0
952 n
953 p
954 12
955 s
956 20
957 coderay/for_redcloth
958 x
959 7
960 require
961 s
962 85
963 <pre style="color: red;"><code style="color: red;">puts "Hello, World!"</code></pre>
964
965 x
966 5
967 chomp
968 x
969 8
970 RedCloth
971 n
972 x
973 3
974 new
975 x
976 8
977 allocate
978 s
979 36
980 bc{color: red}. puts "Hello, World!"
981 x
982 10
983 initialize
984 x
985 7
986 to_html
987 x
988 12
989 assert_equal
990 p
991 11
992 I
993 0
994 I
995 25
996 I
997 0
998 I
999 26
1000 I
1001 9
1002 I
1003 27
1004 I
1005 10
1006 I
1007 2a
1008 I
1009 31
1010 I
1011 27
1012 I
1013 36
1014 x
1015 62
1016 /Users/murphy/ruby/coderay-0.9/test/functional/for_redcloth.rb
1017 p
1018 0
1019 x
1020 25
1021 test_for_redcloth_escapes
1022 M
1023 1
1024 n
1025 n
1026 x
1027 25
1028 test_for_redcloth_escapes
1029 i
1030 96
1031 5
1032 7
1033 0
1034 64
1035 47
1036 49
1037 1
1038 1
1039 15
1040 5
1041 7
1042 2
1043 64
1044 45
1045 3
1046 4
1047 13
1048 71
1049 5
1050 47
1051 9
1052 37
1053 47
1054 49
1055 6
1056 0
1057 13
1058 7
1059 7
1060 64
1061 47
1062 49
1063 8
1064 1
1065 15
1066 8
1067 43
1068 7
1069 7
1070 64
1071 49
1072 5
1073 1
1074 49
1075 9
1076 0
1077 47
1078 49
1079 10
1080 2
1081 15
1082 5
1083 7
1084 11
1085 64
1086 49
1087 12
1088 0
1089 45
1090 3
1091 13
1092 13
1093 71
1094 5
1095 47
1096 9
1097 82
1098 47
1099 49
1100 6
1101 0
1102 13
1103 7
1104 14
1105 64
1106 47
1107 49
1108 8
1109 1
1110 15
1111 8
1112 88
1113 7
1114 14
1115 64
1116 49
1117 5
1118 1
1119 49
1120 9
1121 0
1122 47
1123 49
1124 10
1125 2
1126 11
1127 I
1128 5
1129 I
1130 0
1131 I
1132 0
1133 I
1134 0
1135 n
1136 p
1137 15
1138 s
1139 20
1140 coderay/for_redcloth
1141 x
1142 7
1143 require
1144 s
1145 52
1146 <p><span lang="ruby" class="CodeRay">&gt;</span></p>
1147 x
1148 8
1149 RedCloth
1150 n
1151 x
1152 3
1153 new
1154 x
1155 8
1156 allocate
1157 s
1158 9
1159 @[ruby]>@
1160 x
1161 10
1162 initialize
1163 x
1164 7
1165 to_html
1166 x
1167 12
1168 assert_equal
1169 s
1170 84
1171 <div lang="ruby" class="CodeRay">
1172 <div class="code"><pre>&amp;</pre></div>
1173 </div>
1174
1175 x
1176 5
1177 chomp
1178 n
1179 s
1180 11
1181 bc[ruby]. &
1182 p
1183 17
1184 I
1185 0
1186 I
1187 2d
1188 I
1189 0
1190 I
1191 2e
1192 I
1193 9
1194 I
1195 2f
1196 I
1197 d
1198 I
1199 30
1200 I
1201 2e
1202 I
1203 2f
1204 I
1205 33
1206 I
1207 31
1208 I
1209 3a
1210 I
1211 36
1212 I
1213 5b
1214 I
1215 31
1216 I
1217 60
1218 x
1219 62
1220 /Users/murphy/ruby/coderay-0.9/test/functional/for_redcloth.rb
1221 p
1222 0
1223 x
1224 26
1225 test_for_redcloth_escapes2
1226 M
1227 1
1228 n
1229 n
1230 x
1231 26
1232 test_for_redcloth_escapes2
1233 i
1234 51
1235 5
1236 7
1237 0
1238 64
1239 47
1240 49
1241 1
1242 1
1243 15
1244 5
1245 7
1246 2
1247 64
1248 45
1249 3
1250 4
1251 13
1252 71
1253 5
1254 47
1255 9
1256 37
1257 47
1258 49
1259 6
1260 0
1261 13
1262 7
1263 7
1264 64
1265 47
1266 49
1267 8
1268 1
1269 15
1270 8
1271 43
1272 7
1273 7
1274 64
1275 49
1276 5
1277 1
1278 49
1279 9
1280 0
1281 47
1282 49
1283 10
1284 2
1285 11
1286 I
1287 5
1288 I
1289 0
1290 I
1291 0
1292 I
1293 0
1294 n
1295 p
1296 11
1297 s
1298 20
1299 coderay/for_redcloth
1300 x
1301 7
1302 require
1303 s
1304 149
1305 <p><span lang="c" class="CodeRay"><span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;test.h&gt;</span></span></p>
1306 x
1307 8
1308 RedCloth
1309 n
1310 x
1311 3
1312 new
1313 x
1314 8
1315 allocate
1316 s
1317 22
1318 @[c]#include <test.h>@
1319 x
1320 10
1321 initialize
1322 x
1323 7
1324 to_html
1325 x
1326 12
1327 assert_equal
1328 p
1329 11
1330 I
1331 0
1332 I
1333 39
1334 I
1335 0
1336 I
1337 3a
1338 I
1339 9
1340 I
1341 3b
1342 I
1343 d
1344 I
1345 3c
1346 I
1347 2e
1348 I
1349 3b
1350 I
1351 33
1352 x
1353 62
1354 /Users/murphy/ruby/coderay-0.9/test/functional/for_redcloth.rb
1355 p
1356 0
1357 x
1358 32
1359 test_for_redcloth_false_positive
1360 M
1361 1
1362 n
1363 n
1364 x
1365 32
1366 test_for_redcloth_false_positive
1367 i
1368 138
1369 5
1370 7
1371 0
1372 64
1373 47
1374 49
1375 1
1376 1
1377 15
1378 5
1379 7
1380 2
1381 64
1382 45
1383 3
1384 4
1385 13
1386 71
1387 5
1388 47
1389 9
1390 37
1391 47
1392 49
1393 6
1394 0
1395 13
1396 7
1397 7
1398 64
1399 47
1400 49
1401 8
1402 1
1403 15
1404 8
1405 43
1406 7
1407 7
1408 64
1409 49
1410 5
1411 1
1412 49
1413 9
1414 0
1415 47
1416 49
1417 10
1418 2
1419 15
1420 5
1421 7
1422 11
1423 64
1424 45
1425 3
1426 12
1427 13
1428 71
1429 5
1430 47
1431 9
1432 79
1433 47
1434 49
1435 6
1436 0
1437 13
1438 7
1439 13
1440 64
1441 47
1442 49
1443 8
1444 1
1445 15
1446 8
1447 85
1448 7
1449 13
1450 64
1451 49
1452 5
1453 1
1454 49
1455 9
1456 0
1457 47
1458 49
1459 10
1460 2
1461 15
1462 5
1463 7
1464 14
1465 64
1466 49
1467 15
1468 0
1469 45
1470 3
1471 16
1472 13
1473 71
1474 5
1475 47
1476 9
1477 124
1478 47
1479 49
1480 6
1481 0
1482 13
1483 7
1484 17
1485 64
1486 47
1487 49
1488 8
1489 1
1490 15
1491 8
1492 130
1493 7
1494 17
1495 64
1496 49
1497 5
1498 1
1499 49
1500 9
1501 0
1502 47
1503 49
1504 10
1505 2
1506 11
1507 I
1508 5
1509 I
1510 0
1511 I
1512 0
1513 I
1514 0
1515 n
1516 p
1517 18
1518 s
1519 20
1520 coderay/for_redcloth
1521 x
1522 7
1523 require
1524 s
1525 38
1526 <p><code>[project]_dff.skjd</code></p>
1527 x
1528 8
1529 RedCloth
1530 n
1531 x
1532 3
1533 new
1534 x
1535 8
1536 allocate
1537 s
1538 20
1539 @[project]_dff.skjd@
1540 x
1541 10
1542 initialize
1543 x
1544 7
1545 to_html
1546 x
1547 12
1548 assert_equal
1549 s
1550 57
1551 <p><span lang="ruby" class="CodeRay">_dff.skjd</span></p>
1552 n
1553 s
1554 17
1555 @[ruby]_dff.skjd@
1556 s
1557 43
1558 <pre><code>[project]_dff.skjd</code></pre>
1559
1560 x
1561 5
1562 chomp
1563 n
1564 s
1565 22
1566 bc. [project]_dff.skjd
1567 p
1568 23
1569 I
1570 0
1571 I
1572 40
1573 I
1574 0
1575 I
1576 41
1577 I
1578 9
1579 I
1580 42
1581 I
1582 d
1583 I
1584 43
1585 I
1586 2e
1587 I
1588 42
1589 I
1590 33
1591 I
1592 45
1593 I
1594 37
1595 I
1596 46
1597 I
1598 58
1599 I
1600 45
1601 I
1602 5d
1603 I
1604 47
1605 I
1606 64
1607 I
1608 4a
1609 I
1610 85
1611 I
1612 47
1613 I
1614 8a
1615 x
1616 62
1617 /Users/murphy/ruby/coderay-0.9/test/functional/for_redcloth.rb
1618 p
1619 0
1620 p
1621 13
1622 I
1623 2
1624 I
1625 f
1626 I
1627 10
1628 I
1629 1b
1630 I
1631 1e
1632 I
1633 25
1634 I
1635 2c
1636 I
1637 2d
1638 I
1639 3a
1640 I
1641 39
1642 I
1643 48
1644 I
1645 40
1646 I
1647 56
1648 x
1649 62
1650 /Users/murphy/ruby/coderay-0.9/test/functional/for_redcloth.rb
1651 p
1652 0
1653 x
1654 13
1655 attach_method
1656 p
1657 23
1658 I
1659 0
1660 I
1661 1
1662 I
1663 9
1664 I
1665 2
1666 I
1667 18
1668 I
1669 3
1670 I
1671 21
1672 I
1673 6
1674 I
1675 51
1676 I
1677 7
1678 I
1679 85
1680 I
1681 8
1682 I
1683 95
1684 I
1685 9
1686 I
1687 a2
1688 I
1689 a
1690 I
1691 b6
1692 I
1693 4d
1694 I
1695 d3
1696 I
1697 d
1698 I
1699 f5
1700 I
1701 4d
1702 I
1703 f9
1704 x
1705 62
1706 /Users/murphy/ruby/coderay-0.9/test/functional/for_redcloth.rb
1707 p
1708 0
@@ -0,0 +1,11
1 require 'test/unit'
2 require 'coderay'
3
4 class PluginScannerTest < Test::Unit::TestCase
5
6 def test_load
7 require File.join(File.dirname(__FILE__), 'vhdl')
8 assert_equal 'VHDL', CodeRay.scanner(:vhdl).class.name
9 end
10
11 end
@@ -0,0 +1,317
1 !RBIX
2 0
3 x
4 M
5 1
6 n
7 n
8 x
9 10
10 __script__
11 i
12 53
13 5
14 7
15 0
16 64
17 47
18 49
19 1
20 1
21 15
22 5
23 7
24 2
25 64
26 47
27 49
28 1
29 1
30 15
31 99
32 7
33 3
34 45
35 4
36 5
37 43
38 6
39 43
40 7
41 65
42 49
43 8
44 3
45 13
46 99
47 12
48 7
49 9
50 12
51 7
52 10
53 12
54 65
55 12
56 49
57 11
58 4
59 15
60 49
61 9
62 0
63 15
64 2
65 11
66 I
67 6
68 I
69 0
70 I
71 0
72 I
73 0
74 n
75 p
76 12
77 s
78 9
79 test/unit
80 x
81 7
82 require
83 s
84 7
85 coderay
86 x
87 17
88 PluginScannerTest
89 x
90 4
91 Test
92 n
93 x
94 4
95 Unit
96 x
97 8
98 TestCase
99 x
100 10
101 open_class
102 x
103 14
104 __class_init__
105 M
106 1
107 n
108 n
109 x
110 17
111 PluginScannerTest
112 i
113 16
114 5
115 66
116 99
117 7
118 0
119 7
120 1
121 65
122 67
123 49
124 2
125 0
126 49
127 3
128 4
129 11
130 I
131 5
132 I
133 0
134 I
135 0
136 I
137 0
138 n
139 p
140 4
141 x
142 9
143 test_load
144 M
145 1
146 n
147 n
148 x
149 9
150 test_load
151 i
152 48
153 5
154 45
155 0
156 1
157 45
158 0
159 2
160 65
161 49
162 3
163 0
164 49
165 4
166 1
167 7
168 5
169 64
170 49
171 6
172 2
173 47
174 49
175 7
176 1
177 15
178 5
179 7
180 8
181 64
182 45
183 9
184 10
185 7
186 11
187 49
188 12
189 1
190 49
191 13
192 0
193 49
194 14
195 0
196 47
197 49
198 15
199 2
200 11
201 I
202 4
203 I
204 0
205 I
206 0
207 I
208 0
209 n
210 p
211 16
212 x
213 4
214 File
215 n
216 n
217 x
218 11
219 active_path
220 x
221 7
222 dirname
223 s
224 4
225 vhdl
226 x
227 4
228 join
229 x
230 7
231 require
232 s
233 4
234 VHDL
235 x
236 7
237 CodeRay
238 n
239 x
240 4
241 vhdl
242 x
243 7
244 scanner
245 x
246 5
247 class
248 x
249 4
250 name
251 x
252 12
253 assert_equal
254 p
255 7
256 I
257 0
258 I
259 6
260 I
261 0
262 I
263 7
264 I
265 19
266 I
267 8
268 I
269 30
270 x
271 69
272 /Users/murphy/ruby/coderay-0.9/test/functional/load_plugin_scanner.rb
273 p
274 0
275 x
276 17
277 method_visibility
278 x
279 15
280 add_defn_method
281 p
282 3
283 I
284 2
285 I
286 6
287 I
288 10
289 x
290 69
291 /Users/murphy/ruby/coderay-0.9/test/functional/load_plugin_scanner.rb
292 p
293 0
294 x
295 13
296 attach_method
297 p
298 7
299 I
300 0
301 I
302 1
303 I
304 9
305 I
306 2
307 I
308 12
309 I
310 4
311 I
312 35
313 x
314 69
315 /Users/murphy/ruby/coderay-0.9/test/functional/load_plugin_scanner.rb
316 p
317 0
@@ -0,0 +1,12
1 require 'test/unit'
2
3 MYDIR = File.dirname(__FILE__)
4
5 $:.unshift 'lib'
6 require 'coderay'
7 puts "Running basic CodeRay #{CodeRay::VERSION} tests..."
8
9 suite = %w(basic load_plugin_scanner word_list)
10 for test_case in suite
11 load File.join(MYDIR, test_case + '.rb')
12 end
@@ -0,0 +1,322
1 !RBIX
2 0
3 x
4 M
5 1
6 n
7 n
8 x
9 10
10 __script__
11 i
12 95
13 5
14 7
15 0
16 64
17 47
18 49
19 1
20 1
21 15
22 65
23 7
24 2
25 45
26 3
27 4
28 65
29 49
30 5
31 0
32 49
33 6
34 1
35 49
36 7
37 2
38 15
39 99
40 43
41 8
42 7
43 9
44 49
45 10
46 1
47 7
48 11
49 64
50 49
51 12
52 1
53 15
54 5
55 7
56 13
57 64
58 47
59 49
60 1
61 1
62 15
63 5
64 7
65 14
66 45
67 15
68 16
69 43
70 17
71 47
72 49
73 18
74 0
75 7
76 19
77 63
78 3
79 47
80 49
81 20
82 1
83 15
84 7
85 21
86 64
87 7
88 22
89 64
90 7
91 23
92 64
93 35
94 3
95 19
96 0
97 15
98 20
99 0
100 56
101 24
102 50
103 25
104 0
105 15
106 2
107 11
108 I
109 6
110 I
111 2
112 I
113 0
114 I
115 0
116 n
117 p
118 26
119 s
120 9
121 test/unit
122 x
123 7
124 require
125 x
126 5
127 MYDIR
128 x
129 4
130 File
131 n
132 x
133 11
134 active_path
135 x
136 7
137 dirname
138 x
139 9
140 const_set
141 x
142 7
143 Globals
144 x
145 2
146 $:
147 x
148 2
149 []
150 s
151 3
152 lib
153 x
154 2
155 <<
156 s
157 7
158 coderay
159 s
160 22
161 Running basic CodeRay
162 x
163 7
164 CodeRay
165 n
166 x
167 7
168 VERSION
169 x
170 4
171 to_s
172 s
173 9
174 tests...
175 x
176 4
177 puts
178 s
179 5
180 basic
181 s
182 19
183 load_plugin_scanner
184 s
185 9
186 word_list
187 M
188 1
189 p
190 2
191 x
192 9
193 for_block
194 t
195 n
196 x
197 9
198 __block__
199 i
200 28
201 57
202 22
203 1
204 1
205 15
206 5
207 45
208 0
209 1
210 45
211 2
212 3
213 21
214 1
215 1
216 7
217 4
218 64
219 81
220 5
221 49
222 6
223 2
224 47
225 49
226 7
227 1
228 11
229 I
230 6
231 I
232 0
233 I
234 1
235 I
236 1
237 n
238 p
239 8
240 x
241 4
242 File
243 n
244 x
245 5
246 MYDIR
247 n
248 s
249 3
250 .rb
251 x
252 1
253 +
254 x
255 4
256 join
257 x
258 4
259 load
260 p
261 5
262 I
263 0
264 I
265 a
266 I
267 5
268 I
269 b
270 I
271 1c
272 x
273 55
274 /Users/murphy/ruby/coderay-0.9/test/functional/suite.rb
275 p
276 0
277 x
278 4
279 each
280 p
281 15
282 I
283 0
284 I
285 1
286 I
287 9
288 I
289 3
290 I
291 1a
292 I
293 5
294 I
295 29
296 I
297 6
298 I
299 32
300 I
301 7
302 I
303 47
304 I
305 9
306 I
307 55
308 I
309 a
310 I
311 5f
312 x
313 55
314 /Users/murphy/ruby/coderay-0.9/test/functional/suite.rb
315 p
316 2
317 x
318 5
319 suite
320 x
321 9
322 test_case
@@ -0,0 +1,126
1 class VHDL < CodeRay::Scanners::Scanner
2
3 register_for :vhdl
4
5 RESERVED_WORDS = [
6 'access','after','alias','all','assert','architecture','begin',
7 'block','body','buffer','bus','case','component','configuration','constant',
8 'disconnect','downto','else','elsif','end','entity','exit','file','for',
9 'function','generate','generic','group','guarded','if','impure','in',
10 'inertial','inout','is','label','library','linkage','literal','loop',
11 'map','new','next','null','of','on','open','others','out','package',
12 'port','postponed','procedure','process','pure','range','record','register',
13 'reject','report','return','select','severity','signal','shared','subtype',
14 'then','to','transport','type','unaffected','units','until','use','variable',
15 'wait','when','while','with','note','warning','error','failure','and',
16 'or','xor','not','nor',
17 'array'
18 ]
19
20 PREDEFINED_TYPES = [
21 'bit','bit_vector','character','boolean','integer','real','time','string',
22 'severity_level','positive','natural','signed','unsigned','line','text',
23 'std_logic','std_logic_vector','std_ulogic','std_ulogic_vector','qsim_state',
24 'qsim_state_vector','qsim_12state','qsim_12state_vector','qsim_strength',
25 'mux_bit','mux_vector','reg_bit','reg_vector','wor_bit','wor_vector'
26 ]
27
28 PREDEFINED_CONSTANTS = [
29
30 ]
31
32 IDENT_KIND = CodeRay::CaseIgnoringWordList.new(:ident).
33 add(RESERVED_WORDS, :reserved).
34 add(PREDEFINED_TYPES, :pre_type).
35 add(PREDEFINED_CONSTANTS, :pre_constant)
36
37 ESCAPE = / [rbfntv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x
38 UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
39
40 def scan_tokens tokens, options
41
42 state = :initial
43
44 until eos?
45
46 kind = nil
47 match = nil
48
49 case state
50
51 when :initial
52
53 if scan(/ \s+ | \\\n /x)
54 kind = :space
55
56 elsif scan(/-- .*/x)
57 kind = :comment
58
59 elsif scan(/ [-+*\/=<>?:;,!&^|()\[\]{}~%]+ | \.(?!\d) /x)
60 kind = :operator
61
62 elsif match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x)
63 kind = IDENT_KIND[match.downcase]
64
65 elsif match = scan(/[a-z]?"/i)
66 tokens << [:open, :string]
67 state = :string
68 kind = :delimiter
69
70 elsif scan(/ L?' (?: [^\'\n\\] | \\ #{ESCAPE} )? '? /ox)
71 kind = :char
72
73 elsif scan(/(?:\d+)(?![.eEfF])/)
74 kind = :integer
75
76 elsif scan(/\d[fF]?|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/)
77 kind = :float
78
79 else
80 getch
81 kind = :error
82
83 end
84
85 when :string
86 if scan(/[^\\\n"]+/)
87 kind = :content
88 elsif scan(/"/)
89 tokens << ['"', :delimiter]
90 tokens << [:close, :string]
91 state = :initial
92 next
93 elsif scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
94 kind = :char
95 elsif scan(/ \\ | $ /x)
96 tokens << [:close, :string]
97 kind = :error
98 state = :initial
99 else
100 raise_inspect "else case \" reached; %p not handled." % peek(1), tokens
101 end
102
103 else
104 raise_inspect 'Unknown state', tokens
105
106 end
107
108 match ||= matched
109 if $DEBUG and not kind
110 raise_inspect 'Error token %p in line %d' %
111 [[match, kind], line], tokens
112 end
113 raise_inspect 'Empty token', tokens unless match
114
115 tokens << [match, kind]
116
117 end
118
119 if state == :string
120 tokens << [:close, :string]
121 end
122
123 tokens
124 end
125
126 end
This diff has been collapsed as it changes many lines, (2334 lines changed) Show them Hide them
@@ -0,0 +1,2334
1 !RBIX
2 0
3 x
4 M
5 1
6 n
7 n
8 x
9 10
10 __script__
11 i
12 35
13 99
14 7
15 0
16 45
17 1
18 2
19 43
20 3
21 43
22 4
23 65
24 49
25 5
26 3
27 13
28 99
29 12
30 7
31 6
32 12
33 7
34 7
35 12
36 65
37 12
38 49
39 8
40 4
41 15
42 49
43 6
44 0
45 15
46 2
47 11
48 I
49 6
50 I
51 0
52 I
53 0
54 I
55 0
56 n
57 p
58 9
59 x
60 4
61 VHDL
62 x
63 7
64 CodeRay
65 n
66 x
67 8
68 Scanners
69 x
70 7
71 Scanner
72 x
73 10
74 open_class
75 x
76 14
77 __class_init__
78 M
79 1
80 n
81 n
82 x
83 4
84 VHDL
85 i
86 519
87 5
88 66
89 5
90 7
91 0
92 47
93 49
94 1
95 1
96 15
97 65
98 7
99 2
100 7
101 3
102 64
103 7
104 4
105 64
106 7
107 5
108 64
109 7
110 6
111 64
112 7
113 7
114 64
115 7
116 8
117 64
118 7
119 9
120 64
121 7
122 10
123 64
124 7
125 11
126 64
127 7
128 12
129 64
130 7
131 13
132 64
133 7
134 14
135 64
136 7
137 15
138 64
139 7
140 16
141 64
142 7
143 17
144 64
145 7
146 18
147 64
148 7
149 19
150 64
151 7
152 20
153 64
154 7
155 21
156 64
157 7
158 22
159 64
160 7
161 23
162 64
163 7
164 24
165 64
166 7
167 25
168 64
169 7
170 26
171 64
172 7
173 27
174 64
175 7
176 28
177 64
178 7
179 29
180 64
181 7
182 30
183 64
184 7
185 31
186 64
187 7
188 32
189 64
190 7
191 33
192 64
193 7
194 34
195 64
196 7
197 35
198 64
199 7
200 36
201 64
202 7
203 37
204 64
205 7
206 38
207 64
208 7
209 39
210 64
211 7
212 40
213 64
214 7
215 41
216 64
217 7
218 42
219 64
220 7
221 43
222 64
223 7
224 44
225 64
226 7
227 45
228 64
229 7
230 46
231 64
232 7
233 47
234 64
235 7
236 48
237 64
238 7
239 49
240 64
241 7
242 50
243 64
244 7
245 51
246 64
247 7
248 52
249 64
250 7
251 53
252 64
253 7
254 54
255 64
256 7
257 55
258 64
259 7
260 56
261 64
262 7
263 57
264 64
265 7
266 58
267 64
268 7
269 59
270 64
271 7
272 60
273 64
274 7
275 61
276 64
277 7
278 62
279 64
280 7
281 63
282 64
283 7
284 64
285 64
286 7
287 65
288 64
289 7
290 66
291 64
292 7
293 67
294 64
295 7
296 68
297 64
298 7
299 69
300 64
301 7
302 70
303 64
304 7
305 71
306 64
307 7
308 72
309 64
310 7
311 73
312 64
313 7
314 74
315 64
316 7
317 75
318 64
319 7
320 76
321 64
322 7
323 77
324 64
325 7
326 78
327 64
328 7
329 79
330 64
331 7
332 80
333 64
334 7
335 81
336 64
337 7
338 82
339 64
340 7
341 83
342 64
343 7
344 84
345 64
346 7
347 85
348 64
349 7
350 86
351 64
352 7
353 87
354 64
355 7
356 88
357 64
358 7
359 89
360 64
361 7
362 90
363 64
364 7
365 91
366 64
367 35
368 89
369 49
370 92
371 2
372 15
373 65
374 7
375 93
376 7
377 94
378 64
379 7
380 95
381 64
382 7
383 96
384 64
385 7
386 97
387 64
388 7
389 98
390 64
391 7
392 99
393 64
394 7
395 100
396 64
397 7
398 101
399 64
400 7
401 102
402 64
403 7
404 103
405 64
406 7
407 104
408 64
409 7
410 105
411 64
412 7
413 106
414 64
415 7
416 107
417 64
418 7
419 108
420 64
421 7
422 109
423 64
424 7
425 110
426 64
427 7
428 111
429 64
430 7
431 112
432 64
433 7
434 113
435 64
436 7
437 114
438 64
439 7
440 115
441 64
442 7
443 116
444 64
445 7
446 117
447 64
448 7
449 118
450 64
451 7
452 119
453 64
454 7
455 120
456 64
457 7
458 121
459 64
460 7
461 122
462 64
463 7
464 123
465 64
466 35
467 30
468 49
469 92
470 2
471 15
472 65
473 7
474 124
475 35
476 0
477 49
478 92
479 2
480 15
481 65
482 7
483 125
484 45
485 126
486 127
487 43
488 128
489 13
490 71
491 129
492 47
493 9
494 422
495 47
496 49
497 130
498 0
499 13
500 7
501 131
502 47
503 49
504 132
505 1
506 15
507 8
508 427
509 7
510 131
511 49
512 129
513 1
514 45
515 2
516 133
517 7
518 134
519 49
520 135
521 2
522 45
523 93
524 136
525 7
526 137
527 49
528 135
529 2
530 45
531 124
532 138
533 7
534 139
535 49
536 135
537 2
538 49
539 92
540 2
541 15
542 65
543 7
544 140
545 7
546 141
547 13
548 70
549 9
550 476
551 15
552 44
553 43
554 142
555 7
556 143
557 80
558 49
559 129
560 2
561 6
562 141
563 49
564 92
565 2
566 15
567 65
568 7
569 144
570 7
571 145
572 13
573 70
574 9
575 501
576 15
577 44
578 43
579 142
580 7
581 146
582 80
583 49
584 129
585 2
586 6
587 145
588 49
589 92
590 2
591 15
592 99
593 7
594 147
595 7
596 148
597 65
598 67
599 49
600 149
601 0
602 49
603 150
604 4
605 11
606 I
607 5b
608 I
609 0
610 I
611 0
612 I
613 0
614 n
615 p
616 151
617 x
618 4
619 vhdl
620 x
621 12
622 register_for
623 x
624 14
625 RESERVED_WORDS
626 s
627 6
628 access
629 s
630 5
631 after
632 s
633 5
634 alias
635 s
636 3
637 all
638 s
639 6
640 assert
641 s
642 12
643 architecture
644 s
645 5
646 begin
647 s
648 5
649 block
650 s
651 4
652 body
653 s
654 6
655 buffer
656 s
657 3
658 bus
659 s
660 4
661 case
662 s
663 9
664 component
665 s
666 13
667 configuration
668 s
669 8
670 constant
671 s
672 10
673 disconnect
674 s
675 6
676 downto
677 s
678 4
679 else
680 s
681 5
682 elsif
683 s
684 3
685 end
686 s
687 6
688 entity
689 s
690 4
691 exit
692 s
693 4
694 file
695 s
696 3
697 for
698 s
699 8
700 function
701 s
702 8
703 generate
704 s
705 7
706 generic
707 s
708 5
709 group
710 s
711 7
712 guarded
713 s
714 2
715 if
716 s
717 6
718 impure
719 s
720 2
721 in
722 s
723 8
724 inertial
725 s
726 5
727 inout
728 s
729 2
730 is
731 s
732 5
733 label
734 s
735 7
736 library
737 s
738 7
739 linkage
740 s
741 7
742 literal
743 s
744 4
745 loop
746 s
747 3
748 map
749 s
750 3
751 new
752 s
753 4
754 next
755 s
756 4
757 null
758 s
759 2
760 of
761 s
762 2
763 on
764 s
765 4
766 open
767 s
768 6
769 others
770 s
771 3
772 out
773 s
774 7
775 package
776 s
777 4
778 port
779 s
780 9
781 postponed
782 s
783 9
784 procedure
785 s
786 7
787 process
788 s
789 4
790 pure
791 s
792 5
793 range
794 s
795 6
796 record
797 s
798 8
799 register
800 s
801 6
802 reject
803 s
804 6
805 report
806 s
807 6
808 return
809 s
810 6
811 select
812 s
813 8
814 severity
815 s
816 6
817 signal
818 s
819 6
820 shared
821 s
822 7
823 subtype
824 s
825 4
826 then
827 s
828 2
829 to
830 s
831 9
832 transport
833 s
834 4
835 type
836 s
837 10
838 unaffected
839 s
840 5
841 units
842 s
843 5
844 until
845 s
846 3
847 use
848 s
849 8
850 variable
851 s
852 4
853 wait
854 s
855 4
856 when
857 s
858 5
859 while
860 s
861 4
862 with
863 s
864 4
865 note
866 s
867 7
868 warning
869 s
870 5
871 error
872 s
873 7
874 failure
875 s
876 3
877 and
878 s
879 2
880 or
881 s
882 3
883 xor
884 s
885 3
886 not
887 s
888 3
889 nor
890 s
891 5
892 array
893 x
894 9
895 const_set
896 x
897 16
898 PREDEFINED_TYPES
899 s
900 3
901 bit
902 s
903 10
904 bit_vector
905 s
906 9
907 character
908 s
909 7
910 boolean
911 s
912 7
913 integer
914 s
915 4
916 real
917 s
918 4
919 time
920 s
921 6
922 string
923 s
924 14
925 severity_level
926 s
927 8
928 positive
929 s
930 7
931 natural
932 s
933 6
934 signed
935 s
936 8
937 unsigned
938 s
939 4
940 line
941 s
942 4
943 text
944 s
945 9
946 std_logic
947 s
948 16
949 std_logic_vector
950 s
951 10
952 std_ulogic
953 s
954 17
955 std_ulogic_vector
956 s
957 10
958 qsim_state
959 s
960 17
961 qsim_state_vector
962 s
963 12
964 qsim_12state
965 s
966 19
967 qsim_12state_vector
968 s
969 13
970 qsim_strength
971 s
972 7
973 mux_bit
974 s
975 10
976 mux_vector
977 s
978 7
979 reg_bit
980 s
981 10
982 reg_vector
983 s
984 7
985 wor_bit
986 s
987 10
988 wor_vector
989 x
990 20
991 PREDEFINED_CONSTANTS
992 x
993 10
994 IDENT_KIND
995 x
996 7
997 CodeRay
998 n
999 x
1000 20
1001 CaseIgnoringWordList
1002 x
1003 3
1004 new
1005 x
1006 8
1007 allocate
1008 x
1009 5
1010 ident
1011 x
1012 10
1013 initialize
1014 n
1015 x
1016 8
1017 reserved
1018 x
1019 3
1020 add
1021 n
1022 x
1023 8
1024 pre_type
1025 n
1026 x
1027 12
1028 pre_constant
1029 x
1030 6
1031 ESCAPE
1032 n
1033 x
1034 6
1035 Regexp
1036 s
1037 49
1038 [rbfntv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3}
1039 x
1040 14
1041 UNICODE_ESCAPE
1042 n
1043 s
1044 35
1045 u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8}
1046 x
1047 11
1048 scan_tokens
1049 M
1050 1
1051 n
1052 n
1053 x
1054 11
1055 scan_tokens
1056 i
1057 688
1058 7
1059 0
1060 19
1061 2
1062 15
1063 5
1064 47
1065 49
1066 1
1067 0
1068 10
1069 660
1070 1
1071 19
1072 3
1073 15
1074 1
1075 19
1076 4
1077 15
1078 20
1079 2
1080 13
1081 7
1082 0
1083 12
1084 49
1085 2
1086 1
1087 9
1088 331
1089 15
1090 5
1091 7
1092 3
1093 13
1094 70
1095 9
1096 51
1097 15
1098 44
1099 43
1100 4
1101 7
1102 5
1103 80
1104 49
1105 6
1106 2
1107 6
1108 3
1109 47
1110 49
1111 7
1112 1
1113 9
1114 63
1115 7
1116 8
1117 19
1118 3
1119 8
1120 329
1121 5
1122 7
1123 9
1124 13
1125 70
1126 9
1127 82
1128 15
1129 44
1130 43
1131 4
1132 7
1133 10
1134 80
1135 49
1136 6
1137 2
1138 6
1139 9
1140 47
1141 49
1142 7
1143 1
1144 9
1145 94
1146 7
1147 11
1148 19
1149 3
1150 8
1151 329
1152 5
1153 7
1154 12
1155 13
1156 70
1157 9
1158 113
1159 15
1160 44
1161 43
1162 4
1163 7
1164 13
1165 80
1166 49
1167 6
1168 2
1169 6
1170 12
1171 47
1172 49
1173 7
1174 1
1175 9
1176 125
1177 7
1178 14
1179 19
1180 3
1181 8
1182 329
1183 5
1184 7
1185 15
1186 13
1187 70
1188 9
1189 144
1190 15
1191 44
1192 43
1193 4
1194 7
1195 16
1196 80
1197 49
1198 6
1199 2
1200 6
1201 15
1202 47
1203 49
1204 7
1205 1
1206 19
1207 4
1208 9
1209 167
1210 45
1211 17
1212 18
1213 20
1214 4
1215 49
1216 19
1217 0
1218 49
1219 20
1220 1
1221 19
1222 3
1223 8
1224 329
1225 5
1226 7
1227 21
1228 13
1229 70
1230 9
1231 186
1232 15
1233 44
1234 43
1235 4
1236 7
1237 22
1238 79
1239 49
1240 6
1241 2
1242 6
1243 21
1244 47
1245 49
1246 7
1247 1
1248 19
1249 4
1250 9
1251 217
1252 20
1253 0
1254 7
1255 23
1256 7
1257 24
1258 35
1259 2
1260 49
1261 25
1262 1
1263 15
1264 7
1265 24
1266 19
1267 2
1268 15
1269 7
1270 26
1271 19
1272 3
1273 8
1274 329
1275 5
1276 7
1277 27
1278 13
1279 70
1280 9
1281 247
1282 15
1283 44
1284 43
1285 4
1286 7
1287 28
1288 45
1289 29
1290 30
1291 47
1292 49
1293 31
1294 0
1295 7
1296 32
1297 63
1298 3
1299 80
1300 49
1301 6
1302 2
1303 6
1304 27
1305 47
1306 49
1307 7
1308 1
1309 9
1310 259
1311 7
1312 33
1313 19
1314 3
1315 8
1316 329
1317 5
1318 7
1319 34
1320 13
1321 70
1322 9
1323 278
1324 15
1325 44
1326 43
1327 4
1328 7
1329 35
1330 78
1331 49
1332 6
1333 2
1334 6
1335 34
1336 47
1337 49
1338 7
1339 1
1340 9
1341 290
1342 7
1343 36
1344 19
1345 3
1346 8
1347 329
1348 5
1349 7
1350 37
1351 13
1352 70
1353 9
1354 309
1355 15
1356 44
1357 43
1358 4
1359 7
1360 38
1361 78
1362 49
1363 6
1364 2
1365 6
1366 37
1367 47
1368 49
1369 7
1370 1
1371 9
1372 321
1373 7
1374 39
1375 19
1376 3
1377 8
1378 329
1379 5
1380 48
1381 40
1382 15
1383 7
1384 41
1385 19
1386 3
1387 8
1388 564
1389 13
1390 7
1391 24
1392 12
1393 49
1394 2
1395 1
1396 9
1397 553
1398 15
1399 5
1400 7
1401 42
1402 13
1403 70
1404 9
1405 360
1406 15
1407 44
1408 43
1409 4
1410 7
1411 43
1412 78
1413 49
1414 6
1415 2
1416 6
1417 42
1418 47
1419 49
1420 7
1421 1
1422 9
1423 372
1424 7
1425 44
1426 19
1427 3
1428 8
1429 551
1430 5
1431 7
1432 45
1433 13
1434 70
1435 9
1436 391
1437 15
1438 44
1439 43
1440 4
1441 7
1442 46
1443 78
1444 49
1445 6
1446 2
1447 6
1448 45
1449 47
1450 49
1451 7
1452 1
1453 9
1454 432
1455 20
1456 0
1457 7
1458 46
1459 64
1460 7
1461 26
1462 35
1463 2
1464 49
1465 25
1466 1
1467 15
1468 20
1469 0
1470 7
1471 47
1472 7
1473 24
1474 35
1475 2
1476 49
1477 25
1478 1
1479 15
1480 7
1481 0
1482 19
1483 2
1484 15
1485 1
1486 8
1487 656
1488 8
1489 551
1490 5
1491 7
1492 48
1493 13
1494 70
1495 9
1496 472
1497 15
1498 44
1499 43
1500 4
1501 7
1502 49
1503 45
1504 29
1505 50
1506 47
1507 49
1508 31
1509 0
1510 7
1511 51
1512 45
1513 52
1514 53
1515 47
1516 49
1517 31
1518 0
1519 7
1520 54
1521 63
1522 5
1523 4
1524 6
1525 49
1526 6
1527 2
1528 6
1529 48
1530 47
1531 49
1532 7
1533 1
1534 9
1535 484
1536 7
1537 33
1538 19
1539 3
1540 8
1541 551
1542 5
1543 7
1544 55
1545 13
1546 70
1547 9
1548 503
1549 15
1550 44
1551 43
1552 4
1553 7
1554 56
1555 80
1556 49
1557 6
1558 2
1559 6
1560 55
1561 47
1562 49
1563 7
1564 1
1565 9
1566 532
1567 20
1568 0
1569 7
1570 47
1571 7
1572 24
1573 35
1574 2
1575 49
1576 25
1577 1
1578 15
1579 7
1580 41
1581 19
1582 3
1583 15
1584 7
1585 0
1586 19
1587 2
1588 8
1589 551
1590 5
1591 7
1592 57
1593 64
1594 5
1595 79
1596 47
1597 49
1598 58
1599 1
1600 49
1601 59
1602 1
1603 20
1604 0
1605 47
1606 49
1607 60
1608 2
1609 8
1610 564
1611 15
1612 5
1613 7
1614 61
1615 64
1616 20
1617 0
1618 47
1619 49
1620 60
1621 2
1622 15
1623 20
1624 4
1625 13
1626 10
1627 576
1628 15
1629 5
1630 48
1631 62
1632 19
1633 4
1634 15
1635 99
1636 43
1637 63
1638 7
1639 64
1640 49
1641 20
1642 1
1643 13
1644 9
1645 597
1646 15
1647 20
1648 3
1649 10
1650 596
1651 2
1652 8
1653 597
1654 3
1655 9
1656 625
1657 5
1658 7
1659 65
1660 64
1661 20
1662 4
1663 20
1664 3
1665 35
1666 2
1667 5
1668 48
1669 66
1670 35
1671 2
1672 49
1673 59
1674 1
1675 20
1676 0
1677 47
1678 49
1679 60
1680 2
1681 8
1682 626
1683 1
1684 15
1685 20
1686 4
1687 9
1688 634
1689 1
1690 8
1691 644
1692 5
1693 7
1694 67
1695 64
1696 20
1697 0
1698 47
1699 49
1700 60
1701 2
1702 15
1703 20
1704 0
1705 20
1706 4
1707 20
1708 3
1709 35
1710 2
1711 49
1712 25
1713 1
1714 15
1715 68
1716 8
1717 5
1718 1
1719 15
1720 20
1721 2
1722 7
1723 24
1724 83
1725 68
1726 9
1727 683
1728 20
1729 0
1730 7
1731 47
1732 7
1733 24
1734 35
1735 2
1736 49
1737 25
1738 1
1739 8
1740 684
1741 1
1742 15
1743 20
1744 0
1745 11
1746 I
1747 c
1748 I
1749 5
1750 I
1751 2
1752 I
1753 2
1754 n
1755 p
1756 69
1757 x
1758 7
1759 initial
1760 x
1761 4
1762 eos?
1763 x
1764 3
1765 ===
1766 n
1767 x
1768 6
1769 Regexp
1770 s
1771 12
1772 \s+ | \\\n
1773 x
1774 3
1775 new
1776 x
1777 4
1778 scan
1779 x
1780 5
1781 space
1782 n
1783 s
1784 5
1785 -- .*
1786 x
1787 7
1788 comment
1789 n
1790 s
1791 42
1792 [-+*\/=<>?:;,!&^|()\[\]{}~%]+ | \.(?!\d)
1793 x
1794 8
1795 operator
1796 n
1797 s
1798 24
1799 [A-Za-z_][A-Za-z_0-9]*
1800 x
1801 10
1802 IDENT_KIND
1803 n
1804 x
1805 8
1806 downcase
1807 x
1808 2
1809 []
1810 n
1811 s
1812 7
1813 [a-z]?"
1814 x
1815 4
1816 open
1817 x
1818 6
1819 string
1820 x
1821 2
1822 <<
1823 x
1824 9
1825 delimiter
1826 n
1827 s
1828 24
1829 L?' (?: [^\'\n\\] | \\
1830 x
1831 6
1832 ESCAPE
1833 n
1834 x
1835 4
1836 to_s
1837 s
1838 7
1839 )? '?
1840 x
1841 4
1842 char
1843 n
1844 s
1845 18
1846 (?:\d+)(?![.eEfF])
1847 x
1848 7
1849 integer
1850 n
1851 s
1852 59
1853 \d[fF]?|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?
1854 x
1855 5
1856 float
1857 x
1858 5
1859 getch
1860 x
1861 5
1862 error
1863 n
1864 s
1865 9
1866 [^\\\n"]+
1867 x
1868 7
1869 content
1870 n
1871 s
1872 1
1873 "
1874 x
1875 5
1876 close
1877 n
1878 s
1879 8
1880 \\ (?:
1881 n
1882 s
1883 3
1884 |
1885 x
1886 14
1887 UNICODE_ESCAPE
1888 n
1889 s
1890 3
1891 )
1892 n
1893 s
1894 8
1895 \\ | $
1896 s
1897 36
1898 else case " reached; %p not handled.
1899 x
1900 4
1901 peek
1902 x
1903 1
1904 %
1905 x
1906 13
1907 raise_inspect
1908 s
1909 13
1910 Unknown state
1911 x
1912 7
1913 matched
1914 x
1915 7
1916 Globals
1917 x
1918 6
1919 $DEBUG
1920 s
1921 25
1922 Error token %p in line %d
1923 x
1924 4
1925 line
1926 s
1927 11
1928 Empty token
1929 x
1930 2
1931 ==
1932 p
1933 111
1934 I
1935 0
1936 I
1937 28
1938 I
1939 0
1940 I
1941 2a
1942 I
1943 5
1944 I
1945 2c
1946 I
1947 c
1948 I
1949 2e
1950 I
1951 10
1952 I
1953 2f
1954 I
1955 14
1956 I
1957 31
1958 I
1959 17
1960 I
1961 33
1962 I
1963 20
1964 I
1965 35
1966 I
1967 39
1968 I
1969 36
1970 I
1971 3f
1972 I
1973 38
1974 I
1975 58
1976 I
1977 39
1978 I
1979 5e
1980 I
1981 3b
1982 I
1983 77
1984 I
1985 3c
1986 I
1987 7d
1988 I
1989 3e
1990 I
1991 98
1992 I
1993 3f
1994 I
1995 a7
1996 I
1997 41
1998 I
1999 c2
2000 I
2001 42
2002 I
2003 ce
2004 I
2005 43
2006 I
2007 d3
2008 I
2009 44
2010 I
2011 d9
2012 I
2013 46
2014 I
2015 fd
2016 I
2017 47
2018 I
2019 103
2020 I
2021 49
2022 I
2023 11c
2024 I
2025 4a
2026 I
2027 122
2028 I
2029 4c
2030 I
2031 13b
2032 I
2033 4d
2034 I
2035 141
2036 I
2037 50
2038 I
2039 145
2040 I
2041 51
2042 I
2043 14c
2044 I
2045 55
2046 I
2047 155
2048 I
2049 56
2050 I
2051 16e
2052 I
2053 57
2054 I
2055 174
2056 I
2057 58
2058 I
2059 18d
2060 I
2061 59
2062 I
2063 19a
2064 I
2065 5a
2066 I
2067 1a6
2068 I
2069 5b
2070 I
2071 1ab
2072 I
2073 5c
2074 I
2075 1b0
2076 I
2077 5d
2078 I
2079 1de
2080 I
2081 5e
2082 I
2083 1e4
2084 I
2085 5f
2086 I
2087 1fd
2088 I
2089 60
2090 I
2091 209
2092 I
2093 61
2094 I
2095 20e
2096 I
2097 62
2098 I
2099 214
2100 I
2101 64
2102 I
2103 22a
2104 I
2105 68
2106 I
2107 235
2108 I
2109 6c
2110 I
2111 241
2112 I
2113 6d
2114 I
2115 257
2116 I
2117 6f
2118 I
2119 258
2120 I
2121 6e
2122 I
2123 25b
2124 I
2125 6f
2126 I
2127 271
2128 I
2129 6d
2130 I
2131 273
2132 I
2133 71
2134 I
2135 285
2136 I
2137 73
2138 I
2139 296
2140 I
2141 77
2142 I
2143 29e
2144 I
2145 78
2146 I
2147 2ab
2148 I
2149 77
2150 I
2151 2ad
2152 I
2153 7b
2154 I
2155 2b0
2156 x
2157 54
2158 /Users/murphy/ruby/coderay-0.9/test/functional/vhdl.rb
2159 p
2160 5
2161 x
2162 6
2163 tokens
2164 x
2165 7
2166 options
2167 x
2168 5
2169 state
2170 x
2171 4
2172 kind
2173 x
2174 5
2175 match
2176 x
2177 17
2178 method_visibility
2179 x
2180 15
2181 add_defn_method
2182 p
2183 65
2184 I
2185 2
2186 I
2187 3
2188 I
2189 a
2190 I
2191 5
2192 I
2193 d
2194 I
2195 6
2196 I
2197 22
2198 I
2199 7
2200 I
2201 3a
2202 I
2203 8
2204 I
2205 55
2206 I
2207 9
2208 I
2209 6d
2210 I
2211 a
2212 I
2213 85
2214 I
2215 b
2216 I
2217 a3
2218 I
2219 c
2220 I
2221 bb
2222 I
2223 d
2224 I
2225 d3
2226 I
2227 e
2228 I
2229 ee
2230 I
2231 f
2232 I
2233 109
2234 I
2235 10
2236 I
2237 115
2238 I
2239 11
2240 I
2241 11e
2242 I
2243 14
2244 I
2245 121
2246 I
2247 15
2248 I
2249 139
2250 I
2251 16
2252 I
2253 14e
2254 I
2255 17
2256 I
2257 15d
2258 I
2259 18
2260 I
2261 169
2262 I
2263 19
2264 I
2265 181
2266 I
2267 1c
2268 I
2269 184
2270 I
2271 1e
2272 I
2273 18a
2274 I
2275 20
2276 I
2277 1ab
2278 I
2279 21
2280 I
2281 1b0
2282 I
2283 20
2284 I
2285 1b3
2286 I
2287 22
2288 I
2289 1b8
2290 I
2291 20
2292 I
2293 1bb
2294 I
2295 23
2296 I
2297 1c0
2298 I
2299 20
2300 I
2301 1c7
2302 I
2303 25
2304 I
2305 1e0
2306 I
2307 26
2308 I
2309 1f9
2310 I
2311 28
2312 I
2313 207
2314 x
2315 54
2316 /Users/murphy/ruby/coderay-0.9/test/functional/vhdl.rb
2317 p
2318 0
2319 x
2320 13
2321 attach_method
2322 p
2323 3
2324 I
2325 0
2326 I
2327 1
2328 I
2329 23
2330 x
2331 54
2332 /Users/murphy/ruby/coderay-0.9/test/functional/vhdl.rb
2333 p
2334 0
@@ -0,0 +1,79
1 require 'test/unit'
2 require 'coderay'
3
4 class WordListTest < Test::Unit::TestCase
5
6 include CodeRay
7
8 # define word arrays
9 RESERVED_WORDS = %w[
10 asm break case continue default do else
11 ...
12 ]
13
14 PREDEFINED_TYPES = %w[
15 int long short char void
16 ...
17 ]
18
19 PREDEFINED_CONSTANTS = %w[
20 EOF NULL ...
21 ]
22
23 # make a WordList
24 IDENT_KIND = WordList.new(:ident).
25 add(RESERVED_WORDS, :reserved).
26 add(PREDEFINED_TYPES, :pre_type).
27 add(PREDEFINED_CONSTANTS, :pre_constant)
28
29 def test_word_list_example
30 assert_equal :pre_type, IDENT_KIND['void']
31 # assert_equal :pre_constant, IDENT_KIND['...'] # not specified
32 end
33
34 def test_word_list
35 list = WordList.new(:ident).add(['foobar'], :reserved)
36 assert_equal :reserved, list['foobar']
37 assert_equal :ident, list['FooBar']
38 end
39
40 def test_word_list_cached
41 list = WordList.new(:ident, true).add(['foobar'], :reserved)
42 assert_equal :reserved, list['foobar']
43 assert_equal :ident, list['FooBar']
44 end
45
46 def test_case_ignoring_word_list
47 list = CaseIgnoringWordList.new(:ident).add(['foobar'], :reserved)
48 assert_equal :ident, list['foo']
49 assert_equal :reserved, list['foobar']
50 assert_equal :reserved, list['FooBar']
51
52 list = CaseIgnoringWordList.new(:ident).add(['FooBar'], :reserved)
53 assert_equal :ident, list['foo']
54 assert_equal :reserved, list['foobar']
55 assert_equal :reserved, list['FooBar']
56 end
57
58 def test_case_ignoring_word_list_cached
59 list = CaseIgnoringWordList.new(:ident, true).add(['foobar'], :reserved)
60 assert_equal :ident, list['foo']
61 assert_equal :reserved, list['foobar']
62 assert_equal :reserved, list['FooBar']
63
64 list = CaseIgnoringWordList.new(:ident, true).add(['FooBar'], :reserved)
65 assert_equal :ident, list['foo']
66 assert_equal :reserved, list['foobar']
67 assert_equal :reserved, list['FooBar']
68 end
69
70 def test_dup
71 list = WordList.new(:ident).add(['foobar'], :reserved)
72 assert_equal :reserved, list['foobar']
73 list2 = list.dup
74 list2.add(%w[foobar], :keyword)
75 assert_equal :keyword, list2['foobar']
76 assert_equal :reserved, list['foobar']
77 end
78
79 end No newline at end of file
This diff has been collapsed as it changes many lines, (1763 lines changed) Show them Hide them
@@ -0,0 +1,1763
1 !RBIX
2 0
3 x
4 M
5 1
6 n
7 n
8 x
9 10
10 __script__
11 i
12 53
13 5
14 7
15 0
16 64
17 47
18 49
19 1
20 1
21 15
22 5
23 7
24 2
25 64
26 47
27 49
28 1
29 1
30 15
31 99
32 7
33 3
34 45
35 4
36 5
37 43
38 6
39 43
40 7
41 65
42 49
43 8
44 3
45 13
46 99
47 12
48 7
49 9
50 12
51 7
52 10
53 12
54 65
55 12
56 49
57 11
58 4
59 15
60 49
61 9
62 0
63 15
64 2
65 11
66 I
67 6
68 I
69 0
70 I
71 0
72 I
73 0
74 n
75 p
76 12
77 s
78 9
79 test/unit
80 x
81 7
82 require
83 s
84 7
85 coderay
86 x
87 12
88 WordListTest
89 x
90 4
91 Test
92 n
93 x
94 4
95 Unit
96 x
97 8
98 TestCase
99 x
100 10
101 open_class
102 x
103 14
104 __class_init__
105 M
106 1
107 n
108 n
109 x
110 12
111 WordListTest
112 i
113 232
114 5
115 66
116 5
117 45
118 0
119 1
120 47
121 49
122 2
123 1
124 15
125 65
126 7
127 3
128 7
129 4
130 64
131 7
132 5
133 64
134 7
135 6
136 64
137 7
138 7
139 64
140 7
141 8
142 64
143 7
144 9
145 64
146 7
147 10
148 64
149 7
150 11
151 64
152 35
153 8
154 49
155 12
156 2
157 15
158 65
159 7
160 13
161 7
162 14
163 64
164 7
165 15
166 64
167 7
168 16
169 64
170 7
171 17
172 64
173 7
174 18
175 64
176 7
177 11
178 64
179 35
180 6
181 49
182 12
183 2
184 15
185 65
186 7
187 19
188 7
189 20
190 64
191 7
192 21
193 64
194 7
195 11
196 64
197 35
198 3
199 49
200 12
201 2
202 15
203 65
204 7
205 22
206 45
207 23
208 24
209 13
210 71
211 25
212 47
213 9
214 115
215 47
216 49
217 26
218 0
219 13
220 7
221 27
222 47
223 49
224 28
225 1
226 15
227 8
228 120
229 7
230 27
231 49
232 25
233 1
234 45
235 3
236 29
237 7
238 30
239 49
240 31
241 2
242 45
243 13
244 32
245 7
246 33
247 49
248 31
249 2
250 45
251 19
252 34
253 7
254 35
255 49
256 31
257 2
258 49
259 12
260 2
261 15
262 99
263 7
264 36
265 7
266 37
267 65
268 67
269 49
270 38
271 0
272 49
273 39
274 4
275 15
276 99
277 7
278 40
279 7
280 41
281 65
282 67
283 49
284 38
285 0
286 49
287 39
288 4
289 15
290 99
291 7
292 42
293 7
294 43
295 65
296 67
297 49
298 38
299 0
300 49
301 39
302 4
303 15
304 99
305 7
306 44
307 7
308 45
309 65
310 67
311 49
312 38
313 0
314 49
315 39
316 4
317 15
318 99
319 7
320 46
321 7
322 47
323 65
324 67
325 49
326 38
327 0
328 49
329 39
330 4
331 15
332 99
333 7
334 48
335 7
336 49
337 65
338 67
339 49
340 38
341 0
342 49
343 39
344 4
345 11
346 I
347 a
348 I
349 0
350 I
351 0
352 I
353 0
354 n
355 p
356 50
357 x
358 7
359 CodeRay
360 n
361 x
362 7
363 include
364 x
365 14
366 RESERVED_WORDS
367 s
368 3
369 asm
370 s
371 5
372 break
373 s
374 4
375 case
376 s
377 8
378 continue
379 s
380 7
381 default
382 s
383 2
384 do
385 s
386 4
387 else
388 s
389 3
390 ...
391 x
392 9
393 const_set
394 x
395 16
396 PREDEFINED_TYPES
397 s
398 3
399 int
400 s
401 4
402 long
403 s
404 5
405 short
406 s
407 4
408 char
409 s
410 4
411 void
412 x
413 20
414 PREDEFINED_CONSTANTS
415 s
416 3
417 EOF
418 s
419 4
420 NULL
421 x
422 10
423 IDENT_KIND
424 x
425 8
426 WordList
427 n
428 x
429 3
430 new
431 x
432 8
433 allocate
434 x
435 5
436 ident
437 x
438 10
439 initialize
440 n
441 x
442 8
443 reserved
444 x
445 3
446 add
447 n
448 x
449 8
450 pre_type
451 n
452 x
453 12
454 pre_constant
455 x
456 22
457 test_word_list_example
458 M
459 1
460 n
461 n
462 x
463 22
464 test_word_list_example
465 i
466 17
467 5
468 7
469 0
470 45
471 1
472 2
473 7
474 3
475 64
476 49
477 4
478 1
479 47
480 49
481 5
482 2
483 11
484 I
485 4
486 I
487 0
488 I
489 0
490 I
491 0
492 n
493 p
494 6
495 x
496 8
497 pre_type
498 x
499 10
500 IDENT_KIND
501 n
502 s
503 4
504 void
505 x
506 2
507 []
508 x
509 12
510 assert_equal
511 p
512 5
513 I
514 0
515 I
516 1d
517 I
518 0
519 I
520 1e
521 I
522 11
523 x
524 59
525 /Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
526 p
527 0
528 x
529 17
530 method_visibility
531 x
532 15
533 add_defn_method
534 x
535 14
536 test_word_list
537 M
538 1
539 n
540 n
541 x
542 14
543 test_word_list
544 i
545 73
546 45
547 0
548 1
549 13
550 71
551 2
552 47
553 9
554 23
555 47
556 49
557 3
558 0
559 13
560 7
561 4
562 47
563 49
564 5
565 1
566 15
567 8
568 28
569 7
570 4
571 49
572 2
573 1
574 7
575 6
576 64
577 35
578 1
579 7
580 7
581 49
582 8
583 2
584 19
585 0
586 15
587 5
588 7
589 7
590 20
591 0
592 7
593 6
594 64
595 49
596 9
597 1
598 47
599 49
600 10
601 2
602 15
603 5
604 7
605 4
606 20
607 0
608 7
609 11
610 64
611 49
612 9
613 1
614 47
615 49
616 10
617 2
618 11
619 I
620 5
621 I
622 1
623 I
624 0
625 I
626 0
627 n
628 p
629 12
630 x
631 8
632 WordList
633 n
634 x
635 3
636 new
637 x
638 8
639 allocate
640 x
641 5
642 ident
643 x
644 10
645 initialize
646 s
647 6
648 foobar
649 x
650 8
651 reserved
652 x
653 3
654 add
655 x
656 2
657 []
658 x
659 12
660 assert_equal
661 s
662 6
663 FooBar
664 p
665 9
666 I
667 0
668 I
669 22
670 I
671 0
672 I
673 23
674 I
675 29
676 I
677 24
678 I
679 39
680 I
681 25
682 I
683 49
684 x
685 59
686 /Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
687 p
688 1
689 x
690 4
691 list
692 x
693 21
694 test_word_list_cached
695 M
696 1
697 n
698 n
699 x
700 21
701 test_word_list_cached
702 i
703 75
704 45
705 0
706 1
707 13
708 71
709 2
710 47
711 9
712 24
713 47
714 49
715 3
716 0
717 13
718 7
719 4
720 2
721 47
722 49
723 5
724 2
725 15
726 8
727 30
728 7
729 4
730 2
731 49
732 2
733 2
734 7
735 6
736 64
737 35
738 1
739 7
740 7
741 49
742 8
743 2
744 19
745 0
746 15
747 5
748 7
749 7
750 20
751 0
752 7
753 6
754 64
755 49
756 9
757 1
758 47
759 49
760 10
761 2
762 15
763 5
764 7
765 4
766 20
767 0
768 7
769 11
770 64
771 49
772 9
773 1
774 47
775 49
776 10
777 2
778 11
779 I
780 5
781 I
782 1
783 I
784 0
785 I
786 0
787 n
788 p
789 12
790 x
791 8
792 WordList
793 n
794 x
795 3
796 new
797 x
798 8
799 allocate
800 x
801 5
802 ident
803 x
804 10
805 initialize
806 s
807 6
808 foobar
809 x
810 8
811 reserved
812 x
813 3
814 add
815 x
816 2
817 []
818 x
819 12
820 assert_equal
821 s
822 6
823 FooBar
824 p
825 9
826 I
827 0
828 I
829 28
830 I
831 0
832 I
833 29
834 I
835 2b
836 I
837 2a
838 I
839 3b
840 I
841 2b
842 I
843 4b
844 x
845 59
846 /Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
847 p
848 1
849 x
850 4
851 list
852 x
853 28
854 test_case_ignoring_word_list
855 M
856 1
857 n
858 n
859 x
860 28
861 test_case_ignoring_word_list
862 i
863 178
864 45
865 0
866 1
867 13
868 71
869 2
870 47
871 9
872 23
873 47
874 49
875 3
876 0
877 13
878 7
879 4
880 47
881 49
882 5
883 1
884 15
885 8
886 28
887 7
888 4
889 49
890 2
891 1
892 7
893 6
894 64
895 35
896 1
897 7
898 7
899 49
900 8
901 2
902 19
903 0
904 15
905 5
906 7
907 4
908 20
909 0
910 7
911 9
912 64
913 49
914 10
915 1
916 47
917 49
918 11
919 2
920 15
921 5
922 7
923 7
924 20
925 0
926 7
927 6
928 64
929 49
930 10
931 1
932 47
933 49
934 11
935 2
936 15
937 5
938 7
939 7
940 20
941 0
942 7
943 12
944 64
945 49
946 10
947 1
948 47
949 49
950 11
951 2
952 15
953 45
954 0
955 13
956 13
957 71
958 2
959 47
960 9
961 112
962 47
963 49
964 3
965 0
966 13
967 7
968 4
969 47
970 49
971 5
972 1
973 15
974 8
975 117
976 7
977 4
978 49
979 2
980 1
981 7
982 12
983 64
984 35
985 1
986 7
987 7
988 49
989 8
990 2
991 19
992 0
993 15
994 5
995 7
996 4
997 20
998 0
999 7
1000 9
1001 64
1002 49
1003 10
1004 1
1005 47
1006 49
1007 11
1008 2
1009 15
1010 5
1011 7
1012 7
1013 20
1014 0
1015 7
1016 6
1017 64
1018 49
1019 10
1020 1
1021 47
1022 49
1023 11
1024 2
1025 15
1026 5
1027 7
1028 7
1029 20
1030 0
1031 7
1032 12
1033 64
1034 49
1035 10
1036 1
1037 47
1038 49
1039 11
1040 2
1041 11
1042 I
1043 5
1044 I
1045 1
1046 I
1047 0
1048 I
1049 0
1050 n
1051 p
1052 14
1053 x
1054 20
1055 CaseIgnoringWordList
1056 n
1057 x
1058 3
1059 new
1060 x
1061 8
1062 allocate
1063 x
1064 5
1065 ident
1066 x
1067 10
1068 initialize
1069 s
1070 6
1071 foobar
1072 x
1073 8
1074 reserved
1075 x
1076 3
1077 add
1078 s
1079 3
1080 foo
1081 x
1082 2
1083 []
1084 x
1085 12
1086 assert_equal
1087 s
1088 6
1089 FooBar
1090 n
1091 p
1092 19
1093 I
1094 0
1095 I
1096 2e
1097 I
1098 0
1099 I
1100 2f
1101 I
1102 29
1103 I
1104 30
1105 I
1106 39
1107 I
1108 31
1109 I
1110 49
1111 I
1112 32
1113 I
1114 59
1115 I
1116 34
1117 I
1118 82
1119 I
1120 35
1121 I
1122 92
1123 I
1124 36
1125 I
1126 a2
1127 I
1128 37
1129 I
1130 b2
1131 x
1132 59
1133 /Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
1134 p
1135 1
1136 x
1137 4
1138 list
1139 x
1140 35
1141 test_case_ignoring_word_list_cached
1142 M
1143 1
1144 n
1145 n
1146 x
1147 35
1148 test_case_ignoring_word_list_cached
1149 i
1150 182
1151 45
1152 0
1153 1
1154 13
1155 71
1156 2
1157 47
1158 9
1159 24
1160 47
1161 49
1162 3
1163 0
1164 13
1165 7
1166 4
1167 2
1168 47
1169 49
1170 5
1171 2
1172 15
1173 8
1174 30
1175 7
1176 4
1177 2
1178 49
1179 2
1180 2
1181 7
1182 6
1183 64
1184 35
1185 1
1186 7
1187 7
1188 49
1189 8
1190 2
1191 19
1192 0
1193 15
1194 5
1195 7
1196 4
1197 20
1198 0
1199 7
1200 9
1201 64
1202 49
1203 10
1204 1
1205 47
1206 49
1207 11
1208 2
1209 15
1210 5
1211 7
1212 7
1213 20
1214 0
1215 7
1216 6
1217 64
1218 49
1219 10
1220 1
1221 47
1222 49
1223 11
1224 2
1225 15
1226 5
1227 7
1228 7
1229 20
1230 0
1231 7
1232 12
1233 64
1234 49
1235 10
1236 1
1237 47
1238 49
1239 11
1240 2
1241 15
1242 45
1243 0
1244 13
1245 13
1246 71
1247 2
1248 47
1249 9
1250 115
1251 47
1252 49
1253 3
1254 0
1255 13
1256 7
1257 4
1258 2
1259 47
1260 49
1261 5
1262 2
1263 15
1264 8
1265 121
1266 7
1267 4
1268 2
1269 49
1270 2
1271 2
1272 7
1273 12
1274 64
1275 35
1276 1
1277 7
1278 7
1279 49
1280 8
1281 2
1282 19
1283 0
1284 15
1285 5
1286 7
1287 4
1288 20
1289 0
1290 7
1291 9
1292 64
1293 49
1294 10
1295 1
1296 47
1297 49
1298 11
1299 2
1300 15
1301 5
1302 7
1303 7
1304 20
1305 0
1306 7
1307 6
1308 64
1309 49
1310 10
1311 1
1312 47
1313 49
1314 11
1315 2
1316 15
1317 5
1318 7
1319 7
1320 20
1321 0
1322 7
1323 12
1324 64
1325 49
1326 10
1327 1
1328 47
1329 49
1330 11
1331 2
1332 11
1333 I
1334 5
1335 I
1336 1
1337 I
1338 0
1339 I
1340 0
1341 n
1342 p
1343 14
1344 x
1345 20
1346 CaseIgnoringWordList
1347 n
1348 x
1349 3
1350 new
1351 x
1352 8
1353 allocate
1354 x
1355 5
1356 ident
1357 x
1358 10
1359 initialize
1360 s
1361 6
1362 foobar
1363 x
1364 8
1365 reserved
1366 x
1367 3
1368 add
1369 s
1370 3
1371 foo
1372 x
1373 2
1374 []
1375 x
1376 12
1377 assert_equal
1378 s
1379 6
1380 FooBar
1381 n
1382 p
1383 19
1384 I
1385 0
1386 I
1387 3a
1388 I
1389 0
1390 I
1391 3b
1392 I
1393 2b
1394 I
1395 3c
1396 I
1397 3b
1398 I
1399 3d
1400 I
1401 4b
1402 I
1403 3e
1404 I
1405 5b
1406 I
1407 40
1408 I
1409 86
1410 I
1411 41
1412 I
1413 96
1414 I
1415 42
1416 I
1417 a6
1418 I
1419 43
1420 I
1421 b6
1422 x
1423 59
1424 /Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
1425 p
1426 1
1427 x
1428 4
1429 list
1430 x
1431 8
1432 test_dup
1433 M
1434 1
1435 n
1436 n
1437 x
1438 8
1439 test_dup
1440 i
1441 110
1442 45
1443 0
1444 1
1445 13
1446 71
1447 2
1448 47
1449 9
1450 23
1451 47
1452 49
1453 3
1454 0
1455 13
1456 7
1457 4
1458 47
1459 49
1460 5
1461 1
1462 15
1463 8
1464 28
1465 7
1466 4
1467 49
1468 2
1469 1
1470 7
1471 6
1472 64
1473 35
1474 1
1475 7
1476 7
1477 49
1478 8
1479 2
1480 19
1481 0
1482 15
1483 5
1484 7
1485 7
1486 20
1487 0
1488 7
1489 6
1490 64
1491 49
1492 9
1493 1
1494 47
1495 49
1496 10
1497 2
1498 15
1499 20
1500 0
1501 49
1502 11
1503 0
1504 19
1505 1
1506 15
1507 20
1508 1
1509 7
1510 6
1511 64
1512 35
1513 1
1514 7
1515 12
1516 49
1517 8
1518 2
1519 15
1520 5
1521 7
1522 12
1523 20
1524 1
1525 7
1526 6
1527 64
1528 49
1529 9
1530 1
1531 47
1532 49
1533 10
1534 2
1535 15
1536 5
1537 7
1538 7
1539 20
1540 0
1541 7
1542 6
1543 64
1544 49
1545 9
1546 1
1547 47
1548 49
1549 10
1550 2
1551 11
1552 I
1553 6
1554 I
1555 2
1556 I
1557 0
1558 I
1559 0
1560 n
1561 p
1562 13
1563 x
1564 8
1565 WordList
1566 n
1567 x
1568 3
1569 new
1570 x
1571 8
1572 allocate
1573 x
1574 5
1575 ident
1576 x
1577 10
1578 initialize
1579 s
1580 6
1581 foobar
1582 x
1583 8
1584 reserved
1585 x
1586 3
1587 add
1588 x
1589 2
1590 []
1591 x
1592 12
1593 assert_equal
1594 x
1595 3
1596 dup
1597 x
1598 7
1599 keyword
1600 p
1601 15
1602 I
1603 0
1604 I
1605 46
1606 I
1607 0
1608 I
1609 47
1610 I
1611 29
1612 I
1613 48
1614 I
1615 39
1616 I
1617 49
1618 I
1619 41
1620 I
1621 4a
1622 I
1623 4e
1624 I
1625 4b
1626 I
1627 5e
1628 I
1629 4c
1630 I
1631 6e
1632 x
1633 59
1634 /Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
1635 p
1636 2
1637 x
1638 4
1639 list
1640 x
1641 5
1642 list2
1643 p
1644 45
1645 I
1646 2
1647 I
1648 6
1649 I
1650 b
1651 I
1652 9
1653 I
1654 e
1655 I
1656 a
1657 I
1658 23
1659 I
1660 b
1661 I
1662 2c
1663 I
1664 e
1665 I
1666 2f
1667 I
1668 f
1669 I
1670 3e
1671 I
1672 10
1673 I
1674 47
1675 I
1676 13
1677 I
1678 4a
1679 I
1680 14
1681 I
1682 59
1683 I
1684 18
1685 I
1686 78
1687 I
1688 19
1689 I
1690 7d
1691 I
1692 18
1693 I
1694 80
1695 I
1696 1a
1697 I
1698 85
1699 I
1700 18
1701 I
1702 88
1703 I
1704 1b
1705 I
1706 8d
1707 I
1708 18
1709 I
1710 94
1711 I
1712 1d
1713 I
1714 a2
1715 I
1716 22
1717 I
1718 b0
1719 I
1720 28
1721 I
1722 be
1723 I
1724 2e
1725 I
1726 cc
1727 I
1728 3a
1729 I
1730 da
1731 I
1732 46
1733 I
1734 e8
1735 x
1736 59
1737 /Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
1738 p
1739 0
1740 x
1741 13
1742 attach_method
1743 p
1744 7
1745 I
1746 0
1747 I
1748 1
1749 I
1750 9
1751 I
1752 2
1753 I
1754 12
1755 I
1756 4
1757 I
1758 35
1759 x
1760 59
1761 /Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
1762 p
1763 0
@@ -51,6 +51,7 Rails::Initializer.run do |config|
51 config.action_mailer.perform_deliveries = false
51 config.action_mailer.perform_deliveries = false
52
52
53 config.gem 'rubytree', :lib => 'tree'
53 config.gem 'rubytree', :lib => 'tree'
54 config.gem 'coderay', :version => '~>0.9.7'
54
55
55 # Load any local configuration that is kept out of source control
56 # Load any local configuration that is kept out of source control
56 # (e.g. gems, patches).
57 # (e.g. gems, patches).
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/LICENSE to vendor/gems/coderay-0.9.7/LICENSE
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/LICENSE to vendor/gems/coderay-0.9.7/LICENSE
@@ -18,7 +18,7 And with line numbers.
18 * is what everybody should have on their website
18 * is what everybody should have on their website
19 * solves all your problems and makes the girls run after you
19 * solves all your problems and makes the girls run after you
20
20
21 Version: 0.9.2
21 Version: 0.9.7
22 Author:: murphy (Kornelius Kalnbach)
22 Author:: murphy (Kornelius Kalnbach)
23 Contact:: murphy rubychan de
23 Contact:: murphy rubychan de
24 Website:: coderay.rubychan.de[http://coderay.rubychan.de]
24 Website:: coderay.rubychan.de[http://coderay.rubychan.de]
@@ -94,6 +94,7 Please report errors in this documentation to <murphy rubychan de>.
94 * Rob Aldred for the terminal encoder
94 * Rob Aldred for the terminal encoder
95 * Trans for pointing out $DEBUG dependencies
95 * Trans for pointing out $DEBUG dependencies
96 * Flameeyes for finding that Term::ANSIColor was obsolete
96 * Flameeyes for finding that Term::ANSIColor was obsolete
97 * Etienne Massip for reporting a serious bug in JavaScript scanner
97 * matz and all Ruby gods and gurus
98 * matz and all Ruby gods and gurus
98 * The inventors of: the computer, the internet, the true color display, HTML &
99 * The inventors of: the computer, the internet, the true color display, HTML &
99 CSS, VIM, Ruby, pizza, microwaves, guitars, scouting, programming, anime,
100 CSS, VIM, Ruby, pizza, microwaves, guitars, scouting, programming, anime,
@@ -134,7 +134,7 module CodeRay
134 # Minor: feature milestone
134 # Minor: feature milestone
135 # Teeny: development state, 0 for pre-release
135 # Teeny: development state, 0 for pre-release
136 # Revision: Subversion Revision number (generated on rake gem:make)
136 # Revision: Subversion Revision number (generated on rake gem:make)
137 VERSION = '0.9.2'
137 VERSION = '0.9.7'
138
138
139 require 'coderay/tokens'
139 require 'coderay/tokens'
140 require 'coderay/token_classes'
140 require 'coderay/token_classes'
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/duo.rb to vendor/gems/coderay-0.9.7/lib/coderay/duo.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/duo.rb to vendor/gems/coderay-0.9.7/lib/coderay/duo.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoder.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoder.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoder.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoder.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/_map.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/_map.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/_map.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/_map.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/comment_filter.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/comment_filter.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/comment_filter.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/comment_filter.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/count.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/count.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/count.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/count.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/debug.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/debug.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/debug.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/debug.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/div.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/div.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/div.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/div.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/filter.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/filter.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/filter.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/filter.rb
@@ -276,9 +276,13 module Encoders
276 when :begin_line
276 when :begin_line
277 @opened[0] = type
277 @opened[0] = type
278 if style = @css_style[@opened]
278 if style = @css_style[@opened]
279 @out << style.sub('<span', '<div')
279 if style['class="']
280 @out << style.sub('class="', 'class="line ')
281 else
282 @out << style.sub('>', ' class="line">')
283 end
280 else
284 else
281 @out << '<div>'
285 @out << '<span class="line">'
282 end
286 end
283 @opened << type
287 @opened << type
284 when :end_line
288 when :end_line
@@ -289,7 +293,7 module Encoders
289 raise 'Malformed token stream: Trying to close a line (%p) \
293 raise 'Malformed token stream: Trying to close a line (%p) \
290 that is not open. Open are: %p.' % [type, @opened[1..-1]]
294 that is not open. Open are: %p.' % [type, @opened[1..-1]]
291 end
295 end
292 @out << '</div>'
296 @out << '</span>'
293 @opened.pop
297 @opened.pop
294 end
298 end
295
299
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/css.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/html/css.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/css.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/html/css.rb
@@ -80,8 +80,8 module Encoders
80 line_numbers.gsub!(/\n/) { "<tt>\n</tt>" }
80 line_numbers.gsub!(/\n/) { "<tt>\n</tt>" }
81
81
82 line_numbers_table_tpl = TABLE.apply('LINE_NUMBERS', line_numbers)
82 line_numbers_table_tpl = TABLE.apply('LINE_NUMBERS', line_numbers)
83 gsub!(/<\/div>\n/) { '</div>' }
83 gsub!("</div>\n", '</div>')
84 gsub!(/\n/) { "<tt>\n</tt>" }
84 gsub!("\n", "<tt>\n</tt>")
85 wrap_in! line_numbers_table_tpl
85 wrap_in! line_numbers_table_tpl
86 @wrapped_in = :div
86 @wrapped_in = :div
87
87
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/output.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/html/output.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/output.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/html/output.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/json.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/json.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/json.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/json.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/lines_of_code.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/lines_of_code.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/lines_of_code.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/lines_of_code.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/null.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/null.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/null.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/null.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/page.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/page.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/page.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/page.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/span.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/span.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/span.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/span.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/statistic.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/statistic.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/statistic.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/statistic.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/term.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/term.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/term.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/term.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/text.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/text.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/text.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/text.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/token_class_filter.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/token_class_filter.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/token_class_filter.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/token_class_filter.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/xml.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/xml.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/xml.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/xml.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/yaml.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/yaml.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/yaml.rb to vendor/gems/coderay-0.9.7/lib/coderay/encoders/yaml.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/for_redcloth.rb to vendor/gems/coderay-0.9.7/lib/coderay/for_redcloth.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/for_redcloth.rb to vendor/gems/coderay-0.9.7/lib/coderay/for_redcloth.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/helpers/file_type.rb to vendor/gems/coderay-0.9.7/lib/coderay/helpers/file_type.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/helpers/file_type.rb to vendor/gems/coderay-0.9.7/lib/coderay/helpers/file_type.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/helpers/gzip_simple.rb to vendor/gems/coderay-0.9.7/lib/coderay/helpers/gzip_simple.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/helpers/gzip_simple.rb to vendor/gems/coderay-0.9.7/lib/coderay/helpers/gzip_simple.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/helpers/plugin.rb to vendor/gems/coderay-0.9.7/lib/coderay/helpers/plugin.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/helpers/plugin.rb to vendor/gems/coderay-0.9.7/lib/coderay/helpers/plugin.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/helpers/word_list.rb to vendor/gems/coderay-0.9.7/lib/coderay/helpers/word_list.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/helpers/word_list.rb to vendor/gems/coderay-0.9.7/lib/coderay/helpers/word_list.rb
@@ -68,15 +68,16 module CodeRay
68
68
69 def normify code
69 def normify code
70 code = code.to_s
70 code = code.to_s
71 if code.respond_to? :force_encoding
71 if code.respond_to?(:encoding) && (code.encoding.name != 'UTF-8' || !code.valid_encoding?)
72 debug, $DEBUG = $DEBUG, false
72 code = code.dup
73 begin
73 original_encoding = code.encoding
74 code.force_encoding 'utf-8'
74 code.force_encoding 'Windows-1252'
75 code[/\z/] # raises an ArgumentError when code contains a non-UTF-8 char
75 unless code.valid_encoding?
76 rescue ArgumentError
76 code.force_encoding original_encoding
77 code.force_encoding 'binary'
77 if code.encoding.name == 'UTF-8'
78 ensure
78 code.encode! 'UTF-16BE', :invalid => :replace, :undef => :replace, :replace => '?'
79 $DEBUG = debug
79 end
80 code.encode! 'UTF-8', :invalid => :replace, :undef => :replace, :replace => '?'
80 end
81 end
81 end
82 end
82 code.to_unix
83 code.to_unix
@@ -147,7 +148,12 module CodeRay
147
148
148 def string= code
149 def string= code
149 code = Scanner.normify(code)
150 code = Scanner.normify(code)
150 super code
151 if defined?(RUBY_DESCRIPTION) && RUBY_DESCRIPTION['rubinius 1.0.1']
152 reset_state
153 @string = code
154 else
155 super code
156 end
151 reset_instance
157 reset_instance
152 end
158 end
153
159
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/_map.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/_map.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/_map.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/_map.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/c.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/c.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/c.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/c.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/cpp.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/cpp.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/cpp.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/cpp.rb
@@ -14,12 +14,11 module Scanners
14 ]
14 ]
15
15
16 module RE
16 module RE
17 NonASCII = /[\x80-\xFF]/
18 Hex = /[0-9a-fA-F]/
17 Hex = /[0-9a-fA-F]/
19 Unicode = /\\#{Hex}{1,6}(?:\r\n|\s)?/ # differs from standard because it allows uppercase hex too
18 Unicode = /\\#{Hex}{1,6}(?:\r\n|\s)?/ # differs from standard because it allows uppercase hex too
20 Escape = /#{Unicode}|\\[^\r\n\f0-9a-fA-F]/
19 Escape = /#{Unicode}|\\[^\r\n\f0-9a-fA-F]/
21 NMChar = /[-_a-zA-Z0-9]|#{NonASCII}|#{Escape}/
20 NMChar = /[-_a-zA-Z0-9]|#{Escape}/
22 NMStart = /[_a-zA-Z]|#{NonASCII}|#{Escape}/
21 NMStart = /[_a-zA-Z]|#{Escape}/
23 NL = /\r\n|\r|\n|\f/
22 NL = /\r\n|\r|\n|\f/
24 String1 = /"(?:[^\n\r\f\\"]|\\#{NL}|#{Escape})*"?/ # FIXME: buggy regexp
23 String1 = /"(?:[^\n\r\f\\"]|\\#{NL}|#{Escape})*"?/ # FIXME: buggy regexp
25 String2 = /'(?:[^\n\r\f\\']|\\#{NL}|#{Escape})*'?/ # FIXME: buggy regexp
24 String2 = /'(?:[^\n\r\f\\']|\\#{NL}|#{Escape})*'?/ # FIXME: buggy regexp
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/debug.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/debug.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/debug.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/debug.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/delphi.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/delphi.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/delphi.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/delphi.rb
@@ -47,11 +47,16 module Scanners
47 tokens << [match, :change]
47 tokens << [match, :change]
48 next unless match = scan(/.+/)
48 next unless match = scan(/.+/)
49 kind = :plain
49 kind = :plain
50 elsif scan(/(@@)((?>[^@\n]*))(@@)/)
50 elsif match = scan(/@@(?>[^@\n]*)@@/)
51 tokens << [:begin_line, line_kind = :change]
51 if check(/\n|$/)
52 tokens << [self[1], :change]
52 tokens << [:begin_line, line_kind = :change]
53 tokens << [self[2], :plain]
53 else
54 tokens << [self[3], :change]
54 tokens << [:open, :change]
55 end
56 tokens << [match[0,2], :change]
57 tokens << [match[2...-2], :plain]
58 tokens << [match[-2,2], :change]
59 tokens << [:close, :change] unless line_kind
55 next unless match = scan(/.+/)
60 next unless match = scan(/.+/)
56 kind = :plain
61 kind = :plain
57 elsif match = scan(/\+/)
62 elsif match = scan(/\+/)
@@ -67,7 +72,7 module Scanners
67 elsif scan(/ .*/)
72 elsif scan(/ .*/)
68 kind = :comment
73 kind = :comment
69 elsif scan(/.+/)
74 elsif scan(/.+/)
70 tokens << [:begin_line, line_kind = :head]
75 tokens << [:begin_line, line_kind = :comment]
71 kind = :plain
76 kind = :plain
72 else
77 else
73 raise_inspect 'else case rached'
78 raise_inspect 'else case rached'
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/groovy.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/groovy.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/groovy.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/groovy.rb
@@ -91,7 +91,7 module Scanners
91 end
91 end
92
92
93 when :attribute
93 when :attribute
94 if scan(/#{TAG_END}/)
94 if scan(/#{TAG_END}/o)
95 kind = :tag
95 kind = :tag
96 state = :initial
96 state = :initial
97 elsif scan(/#{ATTR_NAME}/o)
97 elsif scan(/#{ATTR_NAME}/o)
@@ -138,7 +138,7 module Scanners
138 elsif scan(/\\./m)
138 elsif scan(/\\./m)
139 kind = :content
139 kind = :content
140 elsif scan(/ \\ | $ /x)
140 elsif scan(/ \\ | $ /x)
141 tokens << [:close, :delimiter]
141 tokens << [:close, state]
142 kind = :error
142 kind = :error
143 state = :initial
143 state = :initial
144 else
144 else
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/java/builtin_types.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/java/builtin_types.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/java/builtin_types.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/java/builtin_types.rb
@@ -215,7 +215,7 module Scanners
215 end
215 end
216
216
217 def xml_scanner
217 def xml_scanner
218 @xml_scanner ||= CodeRay.scanner :xml, :tokens => @tokens, :keep_tokens => true, :keep_state => true
218 @xml_scanner ||= CodeRay.scanner :xml, :tokens => @tokens, :keep_tokens => true, :keep_state => false
219 end
219 end
220
220
221 end
221 end
@@ -13,9 +13,6 module Scanners
13 :error, :integer, :operator, :value,
13 :error, :integer, :operator, :value,
14 ]
14 ]
15
15
16 CONSTANTS = %w( true false null )
17 IDENT_KIND = WordList.new(:key).add(CONSTANTS, :value)
18
19 ESCAPE = / [bfnrt\\"\/] /x
16 ESCAPE = / [bfnrt\\"\/] /x
20 UNICODE_ESCAPE = / u[a-fA-F0-9]{4} /x
17 UNICODE_ESCAPE = / u[a-fA-F0-9]{4} /x
21
18
@@ -23,7 +20,6 module Scanners
23
20
24 state = :initial
21 state = :initial
25 stack = []
22 stack = []
26 string_delimiter = nil
27 key_expected = false
23 key_expected = false
28
24
29 until eos?
25 until eos?
@@ -47,7 +43,7 module Scanners
47 when '}', ']' then stack.pop # no error recovery, but works for valid JSON
43 when '}', ']' then stack.pop # no error recovery, but works for valid JSON
48 end
44 end
49 elsif match = scan(/ true | false | null /x)
45 elsif match = scan(/ true | false | null /x)
50 kind = IDENT_KIND[match]
46 kind = :value
51 elsif match = scan(/-?(?:0|[1-9]\d*)/)
47 elsif match = scan(/-?(?:0|[1-9]\d*)/)
52 kind = :integer
48 kind = :integer
53 if scan(/\.\d+(?:[eE][-+]?\d+)?|[eE][-+]?\d+/)
49 if scan(/\.\d+(?:[eE][-+]?\d+)?|[eE][-+]?\d+/)
@@ -76,7 +72,7 module Scanners
76 elsif scan(/\\./m)
72 elsif scan(/\\./m)
77 kind = :content
73 kind = :content
78 elsif scan(/ \\ | $ /x)
74 elsif scan(/ \\ | $ /x)
79 tokens << [:close, :delimiter]
75 tokens << [:close, state]
80 kind = :error
76 kind = :error
81 state = :initial
77 state = :initial
82 else
78 else
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/nitro_xhtml.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/nitro_xhtml.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/nitro_xhtml.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/nitro_xhtml.rb
@@ -225,6 +225,12 module Scanners
225 end
225 end
226
226
227 def scan_tokens tokens, options
227 def scan_tokens tokens, options
228 if string.respond_to?(:encoding)
229 unless string.encoding == Encoding::ASCII_8BIT
230 self.string = string.encode Encoding::ASCII_8BIT,
231 :invalid => :replace, :undef => :replace, :replace => '?'
232 end
233 end
228
234
229 if check(RE::PHP_START) || # starts with <?
235 if check(RE::PHP_START) || # starts with <?
230 (match?(/\s*<\S/) && exist?(RE::PHP_START)) || # starts with tag and contains <?
236 (match?(/\s*<\S/) && exist?(RE::PHP_START)) || # starts with tag and contains <?
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/plaintext.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/plaintext.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/plaintext.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/plaintext.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/python.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/python.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/python.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/python.rb
@@ -49,12 +49,16 module Scanners
49 @html_scanner.tokenize match
49 @html_scanner.tokenize match
50
50
51 elsif match = scan(/#{ERB_RUBY_BLOCK}/o)
51 elsif match = scan(/#{ERB_RUBY_BLOCK}/o)
52 start_tag = match[/\A<%[-=]?/]
52 start_tag = match[/\A<%[-=#]?/]
53 end_tag = match[/-?%?>?\z/]
53 end_tag = match[/-?%?>?\z/]
54 tokens << [:open, :inline]
54 tokens << [:open, :inline]
55 tokens << [start_tag, :inline_delimiter]
55 tokens << [start_tag, :inline_delimiter]
56 code = match[start_tag.size .. -1 - end_tag.size]
56 code = match[start_tag.size .. -1 - end_tag.size]
57 @ruby_scanner.tokenize code
57 if start_tag == '<%#'
58 tokens << [code, :comment]
59 else
60 @ruby_scanner.tokenize code
61 end
58 tokens << [end_tag, :inline_delimiter] unless end_tag.empty?
62 tokens << [end_tag, :inline_delimiter] unless end_tag.empty?
59 tokens << [:close, :inline]
63 tokens << [:close, :inline]
60
64
@@ -1,3 +1,4
1 # encoding: utf-8
1 module CodeRay
2 module CodeRay
2 module Scanners
3 module Scanners
3
4
@@ -28,6 +29,16 module Scanners
28
29
29 private
30 private
30 def scan_tokens tokens, options
31 def scan_tokens tokens, options
32 if string.respond_to?(:encoding)
33 unless string.encoding == Encoding::UTF_8
34 self.string = string.encode Encoding::UTF_8,
35 :invalid => :replace, :undef => :replace, :replace => '?'
36 end
37 unicode = false
38 else
39 unicode = exist?(/[^\x00-\x7f]/)
40 end
41
31 last_token_dot = false
42 last_token_dot = false
32 value_expected = true
43 value_expected = true
33 heredocs = nil
44 heredocs = nil
@@ -35,7 +46,7 module Scanners
35 state = :initial
46 state = :initial
36 depth = nil
47 depth = nil
37 inline_block_stack = []
48 inline_block_stack = []
38 unicode = string.respond_to?(:encoding) && string.encoding.name == 'UTF-8'
49
39
50
40 patterns = Patterns # avoid constant lookup
51 patterns = Patterns # avoid constant lookup
41
52
@@ -170,19 +181,28 module Scanners
170 if last_token_dot
181 if last_token_dot
171 kind = if match[/^[A-Z]/] and not match?(/\(/) then :constant else :ident end
182 kind = if match[/^[A-Z]/] and not match?(/\(/) then :constant else :ident end
172 else
183 else
173 kind = patterns::IDENT_KIND[match]
184 if value_expected != :expect_colon && scan(/:(?= )/)
174 if kind == :ident and match[/^[A-Z]/] and not match[/[!?]$/] and not match?(/\(/)
185 tokens << [match, :key]
175 kind = :constant
186 match = ':'
176 elsif kind == :reserved
187 kind = :operator
177 state = patterns::DEF_NEW_STATE[match]
188 else
178 value_expected = :set if patterns::KEYWORDS_EXPECTING_VALUE[match]
189 kind = patterns::IDENT_KIND[match]
190 if kind == :ident
191 if match[/\A[A-Z]/] and not match[/[!?]$/] and not match?(/\(/)
192 kind = :constant
193 end
194 elsif kind == :reserved
195 state = patterns::DEF_NEW_STATE[match]
196 value_expected = :set if patterns::KEYWORDS_EXPECTING_VALUE[match]
197 end
179 end
198 end
180 end
199 end
181 value_expected = :set if check(/#{patterns::VALUE_FOLLOWS}/o)
200 value_expected = :set if check(/#{patterns::VALUE_FOLLOWS}/o)
182
201
183 elsif last_token_dot and match = scan(/#{patterns::METHOD_NAME_OPERATOR}|\(/o)
202 elsif last_token_dot and match = scan(/#{patterns::METHOD_NAME_OPERATOR}|\(/o)
184 kind = :ident
203 kind = :ident
185 value_expected = :set if check(/#{patterns::VALUE_FOLLOWS}/o)
204 value_expected = :set if check(unicode ? /#{patterns::VALUE_FOLLOWS}/uo :
205 /#{patterns::VALUE_FOLLOWS}/o)
186
206
187 # OPERATORS #
207 # OPERATORS #
188 elsif not last_token_dot and match = scan(/ \.\.\.? | (?:\.|::)() | [,\(\)\[\]\{\}] | ==?=? /x)
208 elsif not last_token_dot and match = scan(/ \.\.\.? | (?:\.|::)() | [,\(\)\[\]\{\}] | ==?=? /x)
@@ -212,7 +232,8 module Scanners
212 kind = :delimiter
232 kind = :delimiter
213 state = patterns::StringState.new :string, match == '"', match # important for streaming
233 state = patterns::StringState.new :string, match == '"', match # important for streaming
214
234
215 elsif match = scan(/#{patterns::INSTANCE_VARIABLE}/o)
235 elsif match = scan(unicode ? /#{patterns::INSTANCE_VARIABLE}/uo :
236 /#{patterns::INSTANCE_VARIABLE}/o)
216 kind = :instance_variable
237 kind = :instance_variable
217
238
218 elsif value_expected and match = scan(/\//)
239 elsif value_expected and match = scan(/\//)
@@ -225,7 +246,8 module Scanners
225 elsif match = value_expected ? scan(/[-+]?#{patterns::NUMERIC}/o) : scan(/#{patterns::NUMERIC}/o)
246 elsif match = value_expected ? scan(/[-+]?#{patterns::NUMERIC}/o) : scan(/#{patterns::NUMERIC}/o)
226 kind = self[1] ? :float : :integer
247 kind = self[1] ? :float : :integer
227
248
228 elsif match = scan(/#{patterns::SYMBOL}/o)
249 elsif match = scan(unicode ? /#{patterns::SYMBOL}/uo :
250 /#{patterns::SYMBOL}/o)
229 case delim = match[1]
251 case delim = match[1]
230 when ?', ?"
252 when ?', ?"
231 tokens << [:open, :symbol]
253 tokens << [:open, :symbol]
@@ -237,11 +259,12 module Scanners
237 kind = :symbol
259 kind = :symbol
238 end
260 end
239
261
240 elsif match = scan(/ [-+!~^]=? | [*|&]{1,2}=? | >>? /x)
262 elsif match = scan(/ -[>=]? | [+!~^]=? | [*|&]{1,2}=? | >>? /x)
241 value_expected = :set
263 value_expected = :set
242 kind = :operator
264 kind = :operator
243
265
244 elsif value_expected and match = scan(/#{patterns::HEREDOC_OPEN}/o)
266 elsif value_expected and match = scan(unicode ? /#{patterns::HEREDOC_OPEN}/uo :
267 /#{patterns::HEREDOC_OPEN}/o)
245 indented = self[1] == '-'
268 indented = self[1] == '-'
246 quote = self[3]
269 quote = self[3]
247 delim = self[quote ? 4 : 2]
270 delim = self[quote ? 4 : 2]
@@ -261,7 +284,8 module Scanners
261 state = patterns::StringState.new kind, interpreted, self[2]
284 state = patterns::StringState.new kind, interpreted, self[2]
262 kind = :delimiter
285 kind = :delimiter
263
286
264 elsif value_expected and match = scan(/#{patterns::CHARACTER}/o)
287 elsif value_expected and match = scan(unicode ? /#{patterns::CHARACTER}/uo :
288 /#{patterns::CHARACTER}/o)
265 kind = :integer
289 kind = :integer
266
290
267 elsif match = scan(/ [\/%]=? | <(?:<|=>?)? | [?:;] /x)
291 elsif match = scan(/ [\/%]=? | <(?:<|=>?)? | [?:;] /x)
@@ -277,14 +301,16 module Scanners
277 state = patterns::StringState.new :shell, true, match
301 state = patterns::StringState.new :shell, true, match
278 end
302 end
279
303
280 elsif match = scan(/#{patterns::GLOBAL_VARIABLE}/o)
304 elsif match = scan(unicode ? /#{patterns::GLOBAL_VARIABLE}/uo :
305 /#{patterns::GLOBAL_VARIABLE}/o)
281 kind = :global_variable
306 kind = :global_variable
282
307
283 elsif match = scan(/#{patterns::CLASS_VARIABLE}/o)
308 elsif match = scan(unicode ? /#{patterns::CLASS_VARIABLE}/uo :
309 /#{patterns::CLASS_VARIABLE}/o)
284 kind = :class_variable
310 kind = :class_variable
285
311
286 else
312 else
287 if !unicode
313 if !unicode && !string.respond_to?(:encoding)
288 # check for unicode
314 # check for unicode
289 debug, $DEBUG = $DEBUG, false
315 debug, $DEBUG = $DEBUG, false
290 begin
316 begin
@@ -300,7 +326,7 module Scanners
300 next if unicode
326 next if unicode
301 end
327 end
302 kind = :error
328 kind = :error
303 match = getch
329 match = scan(unicode ? /./mu : /./m)
304
330
305 end
331 end
306
332
@@ -322,7 +348,8 module Scanners
322 kind = :operator
348 kind = :operator
323 else
349 else
324 state = :initial
350 state = :initial
325 if match = scan(/ (?:#{patterns::IDENT}::)* #{patterns::IDENT} /ox)
351 if match = scan(unicode ? /(?:#{patterns::IDENT}::)*#{patterns::IDENT}/uo :
352 /(?:#{patterns::IDENT}::)*#{patterns::IDENT}/o)
326 kind = :class
353 kind = :class
327 else
354 else
328 next
355 next
@@ -331,9 +358,11 module Scanners
331
358
332 elsif state == :undef_expected
359 elsif state == :undef_expected
333 state = :undef_comma_expected
360 state = :undef_comma_expected
334 if match = scan(/#{patterns::METHOD_NAME_EX}/o)
361 if match = scan(unicode ? /#{patterns::METHOD_NAME_EX}/uo :
362 /#{patterns::METHOD_NAME_EX}/o)
335 kind = :method
363 kind = :method
336 elsif match = scan(/#{patterns::SYMBOL}/o)
364 elsif match = scan(unicode ? /#{patterns::SYMBOL}/uo :
365 /#{patterns::SYMBOL}/o)
337 case delim = match[1]
366 case delim = match[1]
338 when ?', ?"
367 when ?', ?"
339 tokens << [:open, :symbol]
368 tokens << [:open, :symbol]
@@ -375,7 +404,9 module Scanners
375 # }}}
404 # }}}
376
405
377 unless kind == :error
406 unless kind == :error
378 value_expected = value_expected == :set
407 if value_expected = value_expected == :set
408 value_expected = :expect_colon if match == '?' || match == 'when'
409 end
379 last_token_dot = last_token_dot == :set
410 last_token_dot = last_token_dot == :set
380 end
411 end
381
412
@@ -16,7 +16,7 module Scanners
16 DEF_KEYWORDS = %w[ def ]
16 DEF_KEYWORDS = %w[ def ]
17 UNDEF_KEYWORDS = %w[ undef ]
17 UNDEF_KEYWORDS = %w[ undef ]
18 ALIAS_KEYWORDS = %w[ alias ]
18 ALIAS_KEYWORDS = %w[ alias ]
19 MODULE_KEYWORDS = %w[class module]
19 MODULE_KEYWORDS = %w[ class module ]
20 DEF_NEW_STATE = WordList.new(:initial).
20 DEF_NEW_STATE = WordList.new(:initial).
21 add(DEF_KEYWORDS, :def_expected).
21 add(DEF_KEYWORDS, :def_expected).
22 add(UNDEF_KEYWORDS, :undef_expected).
22 add(UNDEF_KEYWORDS, :undef_expected).
@@ -25,14 +25,26 module Scanners
25
25
26 PREDEFINED_CONSTANTS = %w[
26 PREDEFINED_CONSTANTS = %w[
27 nil true false self
27 nil true false self
28 DATA ARGV ARGF __FILE__ __LINE__
28 DATA ARGV ARGF
29 __FILE__ __LINE__ __ENCODING__
29 ]
30 ]
30
31
31 IDENT_KIND = WordList.new(:ident).
32 IDENT_KIND = WordList.new(:ident).
32 add(RESERVED_WORDS, :reserved).
33 add(RESERVED_WORDS, :reserved).
33 add(PREDEFINED_CONSTANTS, :pre_constant)
34 add(PREDEFINED_CONSTANTS, :pre_constant)
34
35
35 IDENT = 'ä'[/[[:alpha:]]/] == 'ä' ? /[[:alpha:]_][[:alnum:]_]*/ : /[^\W\d]\w*/
36 if /\w/u === '∑'
37 # MRI 1.8.6, 1.8.7
38 IDENT = /[^\W\d]\w*/
39 else
40 if //.respond_to? :encoding
41 # MRI 1.9.1, 1.9.2
42 IDENT = Regexp.new '[\p{L}\p{M}\p{Pc}\p{Sm}&&[^\x00-\x40\x5b-\x5e\x60\x7b-\x7f]][\p{L}\p{M}\p{N}\p{Pc}\p{Sm}&&[^\x00-\x2f\x3a-\x40\x5b-\x5e\x60\x7b-\x7f]]*'
43 else
44 # JRuby, Rubinius
45 IDENT = /[^\x00-\x40\x5b-\x5e\x60\x7b-\x7f][^\x00-\x2f\x3a-\x40\x5b-\x5e\x60\x7b-\x7f]*/
46 end
47 end
36
48
37 METHOD_NAME = / #{IDENT} [?!]? /ox
49 METHOD_NAME = / #{IDENT} [?!]? /ox
38 METHOD_NAME_OPERATOR = /
50 METHOD_NAME_OPERATOR = /
@@ -109,10 +121,12 module Scanners
109
121
110 # NOTE: This is not completely correct, but
122 # NOTE: This is not completely correct, but
111 # nobody needs heredoc delimiters ending with \n.
123 # nobody needs heredoc delimiters ending with \n.
124 # Also, delimiters starting with numbers are allowed.
125 # but they are more often than not a false positive.
112 HEREDOC_OPEN = /
126 HEREDOC_OPEN = /
113 << (-)? # $1 = float
127 << (-)? # $1 = float
114 (?:
128 (?:
115 ( [A-Za-z_0-9]+ ) # $2 = delim
129 ( #{IDENT} ) # $2 = delim
116 |
130 |
117 ( ["'`\/] ) # $3 = quote, type
131 ( ["'`\/] ) # $3 = quote, type
118 ( [^\n]*? ) \3 # $4 = delim
132 ( [^\n]*? ) \3 # $4 = delim
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/scheme.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/scheme.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/scheme.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/scheme.rb
@@ -56,7 +56,7 module CodeRay module Scanners
56 if scan(/ \s+ | \\\n /x)
56 if scan(/ \s+ | \\\n /x)
57 kind = :space
57 kind = :space
58
58
59 elsif scan(/^(?:--\s?|#).*/)
59 elsif scan(/(?:--\s?|#).*/)
60 kind = :comment
60 kind = :comment
61
61
62 elsif scan(%r! /\* (?: .*? \*/ | .* ) !mx)
62 elsif scan(%r! /\* (?: .*? \*/ | .* ) !mx)
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/xml.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/xml.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/xml.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/xml.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/yaml.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/yaml.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/yaml.rb to vendor/gems/coderay-0.9.7/lib/coderay/scanners/yaml.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/style.rb to vendor/gems/coderay-0.9.7/lib/coderay/style.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/style.rb to vendor/gems/coderay-0.9.7/lib/coderay/style.rb
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/styles/_map.rb to vendor/gems/coderay-0.9.7/lib/coderay/styles/_map.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/styles/_map.rb to vendor/gems/coderay-0.9.7/lib/coderay/styles/_map.rb
@@ -33,6 +33,7 table.CodeRay td { padding: 2px 4px; vertical-align: top }
33 }
33 }
34 .CodeRay .line_numbers tt { font-weight: bold }
34 .CodeRay .line_numbers tt { font-weight: bold }
35 .CodeRay .line_numbers .highlighted { color: red }
35 .CodeRay .line_numbers .highlighted { color: red }
36 .CodeRay .line { display: block; float: left; width: 100%; }
36 .CodeRay .no { padding: 0px 4px }
37 .CodeRay .no { padding: 0px 4px }
37 .CodeRay .code { width: 100% }
38 .CodeRay .code { width: 100% }
38
39
@@ -32,6 +32,8 table.CodeRay td { padding: 2px 4px; vertical-align: top; }
32 text-align: right;
32 text-align: right;
33 }
33 }
34 .CodeRay .line_numbers tt { font-weight: bold; }
34 .CodeRay .line_numbers tt { font-weight: bold; }
35 .CodeRay .line_numbers .highlighted { color: red }
36 .CodeRay .line { display: block; float: left; width: 100%; }
35 .CodeRay .no { padding: 0px 4px; }
37 .CodeRay .no { padding: 0px 4px; }
36 .CodeRay .code { width: 100%; }
38 .CodeRay .code { width: 100%; }
37
39
1 NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/token_classes.rb to vendor/gems/coderay-0.9.7/lib/coderay/token_classes.rb
NO CONTENT: file renamed from vendor/plugins/coderay-0.9.2/lib/coderay/token_classes.rb to vendor/gems/coderay-0.9.7/lib/coderay/token_classes.rb
@@ -7,29 +7,30 module CodeRay
7 #
7 #
8 # A token is not a special object, just a two-element Array
8 # A token is not a special object, just a two-element Array
9 # consisting of
9 # consisting of
10 # * the _token_ _text_ (the original source of the token in a String) or
11 # a _token_ _action_ (:open, :close, :begin_line, :end_line)
10 # * the _token_ _kind_ (a Symbol representing the type of the token)
12 # * the _token_ _kind_ (a Symbol representing the type of the token)
11 # * the _token_ _text_ (the original source of the token in a String)
12 #
13 #
13 # A token looks like this:
14 # A token looks like this:
14 #
15 #
15 # [:comment, '# It looks like this']
16 # ['# It looks like this', :comment]
16 # [:float, '3.1415926']
17 # ['3.1415926', :float]
17 # [:error, '$^']
18 # ['$^', :error]
18 #
19 #
19 # Some scanners also yield some kind of sub-tokens, represented by special
20 # Some scanners also yield sub-tokens, represented by special
20 # token texts, namely :open and :close .
21 # token actions, namely :open and :close.
21 #
22 #
22 # The Ruby scanner, for example, splits "a string" into:
23 # The Ruby scanner, for example, splits "a string" into:
23 #
24 #
24 # [
25 # [
25 # [:open, :string],
26 # [:open, :string],
26 # [:delimiter, '"'],
27 # ['"', :delimiter],
27 # [:content, 'a string'],
28 # ['a string', :content],
28 # [:delimiter, '"'],
29 # ['"', :delimiter],
29 # [:close, :string]
30 # [:close, :string]
30 # ]
31 # ]
31 #
32 #
32 # Tokens is also the interface between Scanners and Encoders:
33 # Tokens is the interface between Scanners and Encoders:
33 # The input is split and saved into a Tokens object. The Encoder
34 # The input is split and saved into a Tokens object. The Encoder
34 # then builds the output from this object.
35 # then builds the output from this object.
35 #
36 #
@@ -43,6 +44,9 module CodeRay
43 # Tokens gives you the power to handle pre-scanned code very easily:
44 # Tokens gives you the power to handle pre-scanned code very easily:
44 # You can convert it to a webpage, a YAML file, or dump it into a gzip'ed string
45 # You can convert it to a webpage, a YAML file, or dump it into a gzip'ed string
45 # that you put in your DB.
46 # that you put in your DB.
47 #
48 # It also allows you to generate tokens directly (without using a scanner),
49 # to load them from a file, and still use any Encoder that CodeRay provides.
46 #
50 #
47 # Tokens' subclass TokenStream allows streaming to save memory.
51 # Tokens' subclass TokenStream allows streaming to save memory.
48 class Tokens < Array
52 class Tokens < Array
@@ -239,9 +243,7 module CodeRay
239 size
243 size
240 end
244 end
241
245
242 # The total size of the tokens.
246 # Return all text tokens joined into a single string.
243 # Should be equal to the input size before
244 # scanning.
245 def text
247 def text
246 map { |t, k| t if t.is_a? ::String }.join
248 map { |t, k| t if t.is_a? ::String }.join
247 end
249 end
@@ -301,11 +303,11 module CodeRay
301 #
303 #
302 # require 'coderay'
304 # require 'coderay'
303 #
305 #
304 # token_stream = CodeRay::TokenStream.new do |kind, text|
306 # token_stream = CodeRay::TokenStream.new do |text, kind|
305 # puts 'kind: %s, text size: %d.' % [kind, text.size]
307 # puts 'kind: %s, text size: %d.' % [kind, text.size]
306 # end
308 # end
307 #
309 #
308 # token_stream << [:regexp, '/\d+/']
310 # token_stream << ['/\d+/', :regexp]
309 # #-> kind: rexpexp, text size: 5.
311 # #-> kind: rexpexp, text size: 5.
310 #
312 #
311 def initialize &block
313 def initialize &block
General Comments 0
You need to be logged in to leave comments. Login now