coderay 1.0.0.598.pre → 1.0.0.738.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. data/bin/coderay +1 -1
  2. data/lib/coderay.rb +38 -32
  3. data/lib/coderay/duo.rb +1 -54
  4. data/lib/coderay/encoder.rb +31 -33
  5. data/lib/coderay/encoders/_map.rb +4 -2
  6. data/lib/coderay/encoders/comment_filter.rb +0 -61
  7. data/lib/coderay/encoders/count.rb +2 -23
  8. data/lib/coderay/encoders/debug.rb +11 -60
  9. data/lib/coderay/encoders/filter.rb +0 -46
  10. data/lib/coderay/encoders/html.rb +83 -91
  11. data/lib/coderay/encoders/html/css.rb +1 -6
  12. data/lib/coderay/encoders/html/numbering.rb +18 -21
  13. data/lib/coderay/encoders/html/output.rb +10 -52
  14. data/lib/coderay/encoders/json.rb +19 -39
  15. data/lib/coderay/encoders/lines_of_code.rb +7 -52
  16. data/lib/coderay/encoders/null.rb +6 -13
  17. data/lib/coderay/encoders/statistic.rb +30 -93
  18. data/lib/coderay/encoders/terminal.rb +3 -4
  19. data/lib/coderay/encoders/text.rb +1 -23
  20. data/lib/coderay/encoders/token_kind_filter.rb +0 -58
  21. data/lib/coderay/helpers/file_type.rb +119 -240
  22. data/lib/coderay/helpers/gzip.rb +41 -0
  23. data/lib/coderay/helpers/plugin.rb +237 -307
  24. data/lib/coderay/scanner.rb +112 -88
  25. data/lib/coderay/scanners/_map.rb +3 -3
  26. data/lib/coderay/scanners/c.rb +7 -7
  27. data/lib/coderay/scanners/clojure.rb +204 -0
  28. data/lib/coderay/scanners/css.rb +10 -20
  29. data/lib/coderay/scanners/debug.rb +9 -55
  30. data/lib/coderay/scanners/diff.rb +21 -4
  31. data/lib/coderay/scanners/html.rb +65 -18
  32. data/lib/coderay/scanners/java.rb +3 -2
  33. data/lib/coderay/scanners/java_script.rb +3 -3
  34. data/lib/coderay/scanners/json.rb +7 -6
  35. data/lib/coderay/scanners/php.rb +2 -1
  36. data/lib/coderay/scanners/rhtml.rb +6 -2
  37. data/lib/coderay/scanners/ruby.rb +193 -193
  38. data/lib/coderay/scanners/ruby/patterns.rb +15 -82
  39. data/lib/coderay/scanners/ruby/string_state.rb +71 -0
  40. data/lib/coderay/scanners/sql.rb +1 -1
  41. data/lib/coderay/scanners/yaml.rb +4 -2
  42. data/lib/coderay/styles/_map.rb +2 -2
  43. data/lib/coderay/styles/alpha.rb +48 -38
  44. data/lib/coderay/styles/cycnus.rb +2 -1
  45. data/lib/coderay/token_kinds.rb +88 -86
  46. data/lib/coderay/tokens.rb +88 -112
  47. data/test/functional/basic.rb +184 -5
  48. data/test/functional/examples.rb +4 -4
  49. data/test/functional/for_redcloth.rb +3 -2
  50. data/test/functional/suite.rb +7 -6
  51. metadata +11 -24
  52. data/lib/coderay/helpers/gzip_simple.rb +0 -123
  53. data/test/functional/load_plugin_scanner.rb +0 -11
  54. data/test/functional/vhdl.rb +0 -126
  55. data/test/functional/word_list.rb +0 -79
@@ -65,7 +65,6 @@ module Scanners
65
65
  QUOTE_TO_TYPE.default = :string
66
66
 
67
67
  REGEXP_MODIFIERS = /[mousenix]*/
68
- REGEXP_SYMBOLS = /[|?*+(){}\[\].^$]/
69
68
 
70
69
  DECIMAL = /\d+(?:_\d+)*/
71
70
  OCTAL = /0_?[0-7]+(?:_[0-7]+)*/
@@ -91,7 +90,7 @@ module Scanners
91
90
  [abefnrstv]
92
91
  | [0-7]{1,3}
93
92
  | x[0-9A-Fa-f]{1,2}
94
- | .?
93
+ | .
95
94
  /mx
96
95
 
97
96
  CONTROL_META_ESCAPE = /
@@ -157,86 +156,20 @@ module Scanners
157
156
  while elsif if not return
158
157
  yield
159
158
  ])
160
-
161
- FANCY_START = / % ( [qQwWxsr] | (?![a-zA-Z0-9]) ) ([^a-zA-Z0-9]) /mx
162
-
163
- FancyStringType = {
164
- 'q' => [:string, false],
165
- 'Q' => [:string, true],
166
- 'r' => [:regexp, true],
167
- 's' => [:symbol, false],
168
- 'x' => [:shell, true]
169
- }
170
- FancyStringType['w'] = FancyStringType['q']
171
- FancyStringType['W'] = FancyStringType[''] = FancyStringType['Q']
172
-
173
- class StringState < Struct.new :type, :interpreted, :delim, :heredoc,
174
- :opening_paren, :paren_depth, :pattern, :next_state
175
-
176
- CLOSING_PAREN = Hash[ *%w[
177
- ( )
178
- [ ]
179
- < >
180
- { }
181
- ] ]
182
-
183
- CLOSING_PAREN.each { |k,v| k.freeze; v.freeze } # debug, if I try to change it with <<
184
- OPENING_PAREN = CLOSING_PAREN.invert
185
-
186
- STRING_PATTERN = Hash.new do |h, k|
187
- delim, interpreted = *k
188
- delim_pattern = Regexp.escape(delim.dup) # dup: workaround for old Ruby
189
- if closing_paren = CLOSING_PAREN[delim]
190
- delim_pattern = delim_pattern[0..-1] if defined? JRUBY_VERSION # JRuby fix
191
- delim_pattern << Regexp.escape(closing_paren)
192
- end
193
- delim_pattern << '\\\\' unless delim == '\\'
194
-
195
- special_escapes =
196
- case interpreted
197
- when :regexp_symbols
198
- '| ' + REGEXP_SYMBOLS.source
199
- when :words
200
- '| \s'
201
- end
202
-
203
- h[k] =
204
- if interpreted and not delim == '#'
205
- / (?= [#{delim_pattern}] | \# [{$@] #{special_escapes} ) /mx
206
- else
207
- / (?= [#{delim_pattern}] #{special_escapes} ) /mx
208
- end
209
- end
210
-
211
- HEREDOC_PATTERN = Hash.new do |h, k|
212
- delim, interpreted, indented = *k
213
- delim_pattern = Regexp.escape(delim.dup) # dup: workaround for old Ruby
214
- delim_pattern = / \n #{ '(?>[\ \t]*)' if indented } #{ Regexp.new delim_pattern } $ /x
215
- h[k] =
216
- if interpreted
217
- / (?= #{delim_pattern}() | \\ | \# [{$@] ) /mx # $1 set == end of heredoc
218
- else
219
- / (?= #{delim_pattern}() | \\ ) /mx
220
- end
221
- end
222
-
223
- def initialize kind, interpreted, delim, heredoc = false
224
- if heredoc
225
- pattern = HEREDOC_PATTERN[ [delim, interpreted, heredoc == :indented] ]
226
- delim = nil
227
- else
228
- pattern = STRING_PATTERN[ [delim, interpreted] ]
229
- if closing_paren = CLOSING_PAREN[delim]
230
- opening_paren = delim
231
- delim = closing_paren
232
- paren_depth = 1
233
- end
234
- end
235
- super kind, interpreted, delim, heredoc, opening_paren, paren_depth, pattern, :initial
236
- end
237
- end unless defined? StringState
238
-
159
+
160
+ FANCY_STRING_START = / % ( [QqrsWwx] | (?![a-zA-Z0-9]) ) ([^a-zA-Z0-9]) /x
161
+ FANCY_STRING_KIND = Hash.new(:string).merge({
162
+ 'r' => :regexp,
163
+ 's' => :symbol,
164
+ 'x' => :shell,
165
+ })
166
+ FANCY_STRING_INTERPRETED = Hash.new(true).merge({
167
+ 'q' => false,
168
+ 's' => false,
169
+ 'w' => false,
170
+ })
171
+
239
172
  end
240
-
173
+
241
174
  end
242
175
  end
@@ -0,0 +1,71 @@
1
+ # encoding: utf-8
2
+ module CodeRay
3
+ module Scanners
4
+
5
+ class Ruby
6
+
7
+ class StringState < Struct.new :type, :interpreted, :delim, :heredoc,
8
+ :opening_paren, :paren_depth, :pattern, :next_state # :nodoc: all
9
+
10
+ CLOSING_PAREN = Hash[ *%w[
11
+ ( )
12
+ [ ]
13
+ < >
14
+ { }
15
+ ] ].each { |k,v| k.freeze; v.freeze } # debug, if I try to change it with <<
16
+
17
+ STRING_PATTERN = Hash.new do |h, k|
18
+ delim, interpreted = *k
19
+ # delim = delim.dup # workaround for old Ruby
20
+ delim_pattern = Regexp.escape(delim)
21
+ if closing_paren = CLOSING_PAREN[delim]
22
+ delim_pattern << Regexp.escape(closing_paren)
23
+ end
24
+ delim_pattern << '\\\\' unless delim == '\\'
25
+
26
+ # special_escapes =
27
+ # case interpreted
28
+ # when :regexp_symbols
29
+ # '| [|?*+(){}\[\].^$]'
30
+ # end
31
+
32
+ h[k] =
33
+ if interpreted && delim != '#'
34
+ / (?= [#{delim_pattern}] | \# [{$@] ) /mx
35
+ else
36
+ / (?= [#{delim_pattern}] ) /mx
37
+ end
38
+ end
39
+
40
+ def initialize kind, interpreted, delim, heredoc = false
41
+ if heredoc
42
+ pattern = heredoc_pattern delim, interpreted, heredoc == :indented
43
+ delim = nil
44
+ else
45
+ pattern = STRING_PATTERN[ [delim, interpreted] ]
46
+ if closing_paren = CLOSING_PAREN[delim]
47
+ opening_paren = delim
48
+ delim = closing_paren
49
+ paren_depth = 1
50
+ end
51
+ end
52
+ super kind, interpreted, delim, heredoc, opening_paren, paren_depth, pattern, :initial
53
+ end
54
+
55
+ def heredoc_pattern delim, interpreted, indented
56
+ # delim = delim.dup # workaround for old Ruby
57
+ delim_pattern = Regexp.escape(delim)
58
+ delim_pattern = / \n #{ '(?>[ \t]*)' if indented } #{ Regexp.new delim_pattern } $ /x
59
+ if interpreted
60
+ / (?= #{delim_pattern}() | \\ | \# [{$@] ) /mx # $1 set == end of heredoc
61
+ else
62
+ / (?= #{delim_pattern}() | \\ ) /mx
63
+ end
64
+ end
65
+
66
+ end
67
+
68
+ end
69
+
70
+ end
71
+ end
@@ -64,7 +64,7 @@ module CodeRay module Scanners
64
64
  if match = scan(/ \s+ | \\\n /x)
65
65
  encoder.text_token match, :space
66
66
 
67
- elsif match = scan(/^(?:--\s?|#).*/)
67
+ elsif match = scan(/(?:--\s?|#).*/)
68
68
  encoder.text_token match, :comment
69
69
 
70
70
  elsif match = scan(%r( /\* (!)? (?: .*? \*/ | .* ) )mx)
@@ -60,9 +60,11 @@ module Scanners
60
60
  encoder.end_group :string
61
61
  next
62
62
  when match = scan(/(?![!"*&]).+?(?=$|\s+#)/)
63
- encoder.text_token match, :string
63
+ encoder.begin_group :string
64
+ encoder.text_token match, :content
64
65
  string_indent = key_indent || column(pos - match.size - 1)
65
- encoder.text_token matched, :string if scan(/(?:\n+ {#{string_indent + 1}}.*)+/)
66
+ encoder.text_token matched, :content if scan(/(?:\n+ {#{string_indent + 1}}.*)+/)
67
+ encoder.end_group :string
66
68
  next
67
69
  end
68
70
 
@@ -1,7 +1,7 @@
1
1
  module CodeRay
2
2
  module Styles
3
-
3
+
4
4
  default :alpha
5
-
5
+
6
6
  end
7
7
  end
@@ -6,19 +6,20 @@ module Styles
6
6
 
7
7
  register_for :alpha
8
8
 
9
- code_background = '#f8f8f8'
10
- numbers_background = '#def'
9
+ code_background = 'hsl(0,0%,95%)'
10
+ numbers_background = 'hsl(180,65%,90%)'
11
11
  border_color = 'silver'
12
- normal_color = '#000'
12
+ normal_color = 'black'
13
13
 
14
14
  CSS_MAIN_STYLES = <<-MAIN # :nodoc:
15
15
  .CodeRay {
16
16
  background-color: #{code_background};
17
17
  border: 1px solid #{border_color};
18
- font-family: 'Courier New', 'Terminal', monospace;
19
18
  color: #{normal_color};
20
19
  }
21
- .CodeRay pre { margin: 0px; }
20
+ .CodeRay pre {
21
+ margin: 0px;
22
+ }
22
23
 
23
24
  span.CodeRay { white-space: pre; border: 0px; padding: 2px; }
24
25
 
@@ -29,88 +30,97 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; }
29
30
  background-color: #{numbers_background};
30
31
  color: gray;
31
32
  text-align: right;
33
+ -moz-user-select: none;
34
+ -webkit-user-select: none;
35
+ }
36
+ .CodeRay .line_numbers a, .CodeRay .no a {
37
+ background-color: #{numbers_background} !important;
38
+ color: gray !important;
39
+ text-decoration: none !important;
32
40
  }
33
- .CodeRay .line_numbers a:target, .CodeRay .no a:target { color: blue; }
34
- .CodeRay .line_numbers .highlighted, .CodeRay .no .highlighted { color: red; }
41
+ .CodeRay .line_numbers a:target, .CodeRay .no a:target { color: blue !important; }
42
+ .CodeRay .line_numbers .highlighted, .CodeRay .no .highlighted { color: red !important; }
43
+ .CodeRay .line_numbers .highlighted a, .CodeRay .no .highlighted a { color: red !important; }
35
44
  .CodeRay .no { padding: 0px 4px; }
45
+ .CodeRay .line { display: block; float: left; width: 100%; }
36
46
  .CodeRay .code { width: 100%; }
37
47
  .CodeRay .code pre { overflow: auto; }
38
48
  MAIN
39
49
 
40
50
  TOKEN_COLORS = <<-'TOKENS'
41
- .debug { color:white ! important; background:blue ! important; }
51
+ .debug { color: white !important; background: blue !important; }
42
52
 
43
53
  .an { color:#007 }
44
54
  .at { color:#f08 }
45
55
  .av { color:#700 }
46
- .bi { color:#509; font-weight:bold }
47
- .c { color:#888; }
48
- .c .dl { color:#444; }
49
- .c .ch { color:#444; }
56
+ .bi { color:#509 }
57
+ .c { color:#888 }
58
+ .c .dl { color:#444 }
59
+ .c .ch { color:#444 }
50
60
 
51
61
  .ch { color:#04D }
52
62
  .ch .k { color:#04D }
53
63
  .ch .dl { color:#039 }
54
64
 
55
65
  .cl { color:#B06; font-weight:bold }
56
- .cm { color:#A08; font-weight:bold }
66
+ .cm { color:#A08 }
57
67
  .co { color:#036; font-weight:bold }
58
68
  .cr { color:#0A0 }
59
69
  .cv { color:#369 }
60
- .de { color:#B0B; }
70
+ .de { color:#B0B }
61
71
  .df { color:#099; font-weight:bold }
62
72
  .di { color:#088; font-weight:bold }
63
73
  .dl { color:black }
64
74
  .do { color:#970 }
65
75
  .dt { color:#34b }
66
76
  .ds { color:#D42; font-weight:bold }
67
- .e { color:#666; font-weight:bold }
77
+ .e { color:#666 }
68
78
  .en { color:#800; font-weight:bold }
69
79
  .er { color:#F00; background-color:#FAA }
70
80
  .ex { color:#C00; font-weight:bold }
71
- .fl { color:#60E; font-weight:bold }
81
+ .fl { color:#60E }
72
82
  .fu { color:#06B; font-weight:bold }
73
- .gv { color:#d70; font-weight:bold }
74
- .hx { color:#058; font-weight:bold }
75
- .i { color:#00D; font-weight:bold }
83
+ .gv { color:#d70 }
84
+ .hx { color:#02b }
85
+ .i { color:#00D }
76
86
  .ic { color:#B44; font-weight:bold }
77
87
 
78
88
  .il { background-color: hsla(0,0%,0%,0.1); color: black }
79
- .il .idl { font-weight: bold; color: #666 }
80
- .idl { font-weight: bold; background-color: hsla(0,0%,0%,0.1); color: #666; }
89
+ .idl { font-weight: bold; color: #666 }
81
90
 
82
- .im { color:#f00; }
91
+ .im { color:#f00 }
83
92
  .in { color:#B2B; font-weight:bold }
84
93
  .iv { color:#33B }
85
94
  .la { color:#970; font-weight:bold }
86
95
  .lv { color:#963 }
87
96
  .ns { color:#707; font-weight:bold }
88
- .oc { color:#40E; font-weight:bold }
97
+ .oc { color:#40E }
89
98
  .op { }
90
- .pc { color:#058; font-weight:bold }
99
+ .pc { color:#069 }
91
100
  .pd { color:#369; font-weight:bold }
92
- .pp { color:#579; }
101
+ .pp { color:#579 }
93
102
  .ps { color:#00C; font-weight:bold }
94
103
  .pt { color:#074; font-weight:bold }
95
- .r, .kw { color:#080; font-weight:bold }
104
+ .r { color:#080; font-weight:bold }
105
+ .kw { color:#080; font-weight:bold }
96
106
 
97
- .ke { color: #808; }
98
- .ke .dl { color: #606; }
99
- .ke .ch { color: #80f; }
107
+ .ke { color: #606 }
108
+ .ke .dl { color: #404 }
109
+ .ke .ch { color: #60f }
100
110
  .vl { color: #088; }
101
111
 
102
- .rx { background-color:hsla(300,100%,50%,0.1); }
112
+ .rx { background-color:hsla(300,100%,50%,0.09); }
103
113
  .rx .k { color:#808 }
104
114
  .rx .dl { color:#404 }
105
115
  .rx .mod { color:#C2C }
106
- .rx .fu { color:#404; font-weight: bold }
107
116
 
108
- .s { background-color:hsla(0,100%,50%,0.1); }
109
- .s .k { color: #D20; }
110
- .s .ch { color: #b0b; }
111
- .s .dl { color: #710; }
117
+ .s { background-color:hsla(0,100%,50%,0.08); }
118
+ .s .k { color: #D20 }
119
+ .s .ch { color: #b0b }
120
+ .s .dl { color: #710 }
121
+ .s .mod { color: #E40 }
112
122
 
113
- .sh { background-color:hsla(120,100%,50%,0.1); }
123
+ .sh { background-color:hsla(120,100%,50%,0.09); }
114
124
  .sh .k { color:#2B2 }
115
125
  .sh .dl { color:#161 }
116
126
 
@@ -135,8 +145,8 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; }
135
145
 
136
146
  .ins .ins { color: #080; background:transparent; font-weight:bold }
137
147
  .del .del { color: #800; background:transparent; font-weight:bold }
138
- .chg .chg { color: #66f; }
139
- .head .head { color: #f4f; }
148
+ .chg .chg { color: #66f }
149
+ .head .head { color: #f4f }
140
150
  TOKENS
141
151
 
142
152
  end
@@ -32,12 +32,13 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; }
32
32
  }
33
33
  .CodeRay .line_numbers .highlighted, .CodeRay .no .highlighted { color: red; }
34
34
  .CodeRay .no { padding: 0px 4px; }
35
+ .CodeRay .line { display: block; float: left; width: 100%; }
35
36
  .CodeRay .code { width: 100%; }
36
37
  .CodeRay .code pre { overflow: auto; }
37
38
  MAIN
38
39
 
39
40
  TOKEN_COLORS = <<-'TOKENS'
40
- .debug { color:white ! important; background:blue ! important; }
41
+ .debug { color: white !important; background: blue !important; }
41
42
 
42
43
  .an { color:#007 }
43
44
  .at { color:#f08 }
@@ -1,89 +1,91 @@
1
1
  module CodeRay
2
- class Tokens
3
- AbbreviationForKind = Hash.new do |h, k| # :nodoc:
4
- if $CODERAY_DEBUG
5
- raise 'Undefined Token kind: %p' % [k] # :nodoc:
6
- else
7
- :NO_HIGHLIGHT
8
- end
9
- end
10
- AbbreviationForKind.update with = { # :nodoc:
11
- :annotation => 'at',
12
- :attribute_name => 'an',
13
- :attribute_value => 'av',
14
- :bin => 'bi',
15
- :char => 'ch',
16
- :class => 'cl',
17
- :class_variable => 'cv',
18
- :color => 'cr',
19
- :comment => 'c',
20
- :complex => 'cm',
21
- :constant => 'co',
22
- :content => 'k',
23
- :decorator => 'de',
24
- :definition => 'df',
25
- :delimiter => 'dl',
26
- :directive => 'di',
27
- :doc => 'do',
28
- :doctype => 'dt',
29
- :doc_string => 'ds',
30
- :entity => 'en',
31
- :error => 'er',
32
- :escape => 'e',
33
- :exception => 'ex',
34
- :filename => 'filename',
35
- :float => 'fl',
36
- :function => 'fu',
37
- :global_variable => 'gv',
38
- :hex => 'hx',
39
- :imaginary => 'cm',
40
- :important => 'im',
41
- :include => 'ic',
42
- :inline => 'il',
43
- :inline_delimiter => 'idl',
44
- :instance_variable => 'iv',
45
- :integer => 'i',
46
- :interpreted => 'in',
47
- :key => 'ke',
48
- :keyword => 'kw',
49
- :label => 'la',
50
- :local_variable => 'lv',
51
- :modifier => 'mod',
52
- :namespace => 'ns',
53
- :oct => 'oc',
54
- :predefined => 'pd',
55
- :preprocessor => 'pp',
56
- :pre_constant => 'pc',
57
- :pre_type => 'pt',
58
- :pseudo_class => 'ps',
59
- :regexp => 'rx',
60
- :reserved => 'r',
61
- :shell => 'sh',
62
- :string => 's',
63
- :symbol => 'sy',
64
- :tag => 'ta',
65
- :tag_special => 'ts',
66
- :type => 'ty',
67
- :value => 'vl',
68
- :variable => 'v',
69
-
70
- :insert => 'ins',
71
- :delete => 'del',
72
- :change => 'chg',
73
- :head => 'head',
74
-
75
- :eyecatcher => 'eye',
76
-
77
- :ident => :NO_HIGHLIGHT, # 'id'
78
- #:operator => 'op',
79
- :operator => :NO_HIGHLIGHT, # 'op'
80
- :space => :NO_HIGHLIGHT, # 'sp'
81
- :plain => :NO_HIGHLIGHT,
82
- }
83
- AbbreviationForKind[:method] = AbbreviationForKind[:function]
84
- AbbreviationForKind[:nesting_delimiter] = AbbreviationForKind[:delimiter]
85
- AbbreviationForKind[:escape] = AbbreviationForKind[:delimiter]
86
- AbbreviationForKind[:docstring] = AbbreviationForKind[:comment]
87
- #AbbreviationForKind.default = AbbreviationForKind[:error] or raise 'no class found for :error!'
2
+
3
+ # A Hash of all known token kinds and their associated CSS classes.
4
+ TokenKinds = Hash.new do |h, k|
5
+ warn 'Undefined Token kind: %p' % [k] if $CODERAY_DEBUG
6
+ false
88
7
  end
8
+
9
+ # speedup
10
+ TokenKinds.compare_by_identity if TokenKinds.respond_to? :compare_by_identity
11
+
12
+ TokenKinds.update with = { # :nodoc:
13
+ :annotation => 'at',
14
+ :attribute_name => 'an',
15
+ :attribute_value => 'av',
16
+ :bin => 'bi',
17
+ :char => 'ch',
18
+ :class => 'cl',
19
+ :class_variable => 'cv',
20
+ :color => 'cr',
21
+ :comment => 'c',
22
+ :complex => 'cm',
23
+ :constant => 'co',
24
+ :content => 'k',
25
+ :decorator => 'de',
26
+ :definition => 'df',
27
+ :delimiter => 'dl',
28
+ :directive => 'di',
29
+ :doc => 'do',
30
+ :doctype => 'dt',
31
+ :doc_string => 'ds',
32
+ :entity => 'en',
33
+ :error => 'er',
34
+ :escape => 'e',
35
+ :exception => 'ex',
36
+ :filename => 'filename',
37
+ :float => 'fl',
38
+ :function => 'fu',
39
+ :global_variable => 'gv',
40
+ :hex => 'hx',
41
+ :imaginary => 'cm',
42
+ :important => 'im',
43
+ :include => 'ic',
44
+ :inline => 'il',
45
+ :inline_delimiter => 'idl',
46
+ :instance_variable => 'iv',
47
+ :integer => 'i',
48
+ :interpreted => 'in',
49
+ :key => 'ke',
50
+ :keyword => 'kw',
51
+ :label => 'la',
52
+ :local_variable => 'lv',
53
+ :modifier => 'mod',
54
+ :namespace => 'ns',
55
+ :oct => 'oc',
56
+ :predefined => 'pd',
57
+ :preprocessor => 'pp',
58
+ :pre_constant => 'pc', # FIXME: rename to :predefined_constant
59
+ :pre_type => 'pt', # FIXME: rename to :predefined_type
60
+ :pseudo_class => 'ps',
61
+ :regexp => 'rx',
62
+ :reserved => 'r',
63
+ :shell => 'sh',
64
+ :string => 's',
65
+ :symbol => 'sy',
66
+ :tag => 'ta',
67
+ :tag_special => 'ts',
68
+ :type => 'ty',
69
+ :value => 'vl',
70
+ :variable => 'v',
71
+
72
+ :insert => 'ins',
73
+ :delete => 'del',
74
+ :change => 'chg',
75
+ :head => 'head',
76
+
77
+ :eyecatcher => 'eye',
78
+
79
+ :ident => false, # 'id'
80
+ :operator => false, # 'op'
81
+
82
+ :space => false, # 'sp'
83
+ :plain => false,
84
+ }
85
+
86
+ TokenKinds[:method] = TokenKinds[:function]
87
+ TokenKinds[:escape] = TokenKinds[:delimiter]
88
+ TokenKinds[:docstring] = TokenKinds[:comment]
89
+
90
+ TokenKinds.freeze
89
91
  end