coderay 0.9.8 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/{lib/README → README_INDEX.rdoc} +10 -21
  2. data/Rakefile +6 -6
  3. data/bin/coderay +193 -64
  4. data/lib/coderay.rb +61 -105
  5. data/lib/coderay/duo.rb +17 -21
  6. data/lib/coderay/encoder.rb +100 -112
  7. data/lib/coderay/encoders/_map.rb +12 -7
  8. data/lib/coderay/encoders/comment_filter.rb +12 -30
  9. data/lib/coderay/encoders/count.rb +29 -11
  10. data/lib/coderay/encoders/debug.rb +32 -20
  11. data/lib/coderay/encoders/div.rb +13 -9
  12. data/lib/coderay/encoders/filter.rb +34 -51
  13. data/lib/coderay/encoders/html.rb +155 -161
  14. data/lib/coderay/encoders/html/css.rb +4 -9
  15. data/lib/coderay/encoders/html/numbering.rb +115 -0
  16. data/lib/coderay/encoders/html/output.rb +22 -70
  17. data/lib/coderay/encoders/json.rb +59 -45
  18. data/lib/coderay/encoders/lines_of_code.rb +12 -57
  19. data/lib/coderay/encoders/null.rb +6 -14
  20. data/lib/coderay/encoders/page.rb +13 -9
  21. data/lib/coderay/encoders/span.rb +13 -9
  22. data/lib/coderay/encoders/statistic.rb +58 -39
  23. data/lib/coderay/encoders/terminal.rb +179 -0
  24. data/lib/coderay/encoders/text.rb +31 -17
  25. data/lib/coderay/encoders/token_kind_filter.rb +111 -0
  26. data/lib/coderay/encoders/xml.rb +19 -18
  27. data/lib/coderay/encoders/yaml.rb +37 -9
  28. data/lib/coderay/for_redcloth.rb +4 -4
  29. data/lib/coderay/helpers/file_type.rb +127 -246
  30. data/lib/coderay/helpers/gzip.rb +41 -0
  31. data/lib/coderay/helpers/plugin.rb +241 -306
  32. data/lib/coderay/helpers/word_list.rb +65 -126
  33. data/lib/coderay/scanner.rb +173 -156
  34. data/lib/coderay/scanners/_map.rb +18 -17
  35. data/lib/coderay/scanners/c.rb +63 -77
  36. data/lib/coderay/scanners/clojure.rb +217 -0
  37. data/lib/coderay/scanners/cpp.rb +71 -84
  38. data/lib/coderay/scanners/css.rb +103 -120
  39. data/lib/coderay/scanners/debug.rb +47 -44
  40. data/lib/coderay/scanners/delphi.rb +70 -76
  41. data/lib/coderay/scanners/diff.rb +141 -50
  42. data/lib/coderay/scanners/erb.rb +81 -0
  43. data/lib/coderay/scanners/groovy.rb +104 -113
  44. data/lib/coderay/scanners/haml.rb +168 -0
  45. data/lib/coderay/scanners/html.rb +181 -110
  46. data/lib/coderay/scanners/java.rb +73 -75
  47. data/lib/coderay/scanners/java/builtin_types.rb +2 -0
  48. data/lib/coderay/scanners/java_script.rb +90 -101
  49. data/lib/coderay/scanners/json.rb +40 -53
  50. data/lib/coderay/scanners/php.rb +123 -147
  51. data/lib/coderay/scanners/python.rb +93 -91
  52. data/lib/coderay/scanners/raydebug.rb +66 -0
  53. data/lib/coderay/scanners/ruby.rb +343 -326
  54. data/lib/coderay/scanners/ruby/patterns.rb +40 -106
  55. data/lib/coderay/scanners/ruby/string_state.rb +71 -0
  56. data/lib/coderay/scanners/sql.rb +80 -66
  57. data/lib/coderay/scanners/text.rb +26 -0
  58. data/lib/coderay/scanners/xml.rb +1 -1
  59. data/lib/coderay/scanners/yaml.rb +74 -73
  60. data/lib/coderay/style.rb +10 -7
  61. data/lib/coderay/styles/_map.rb +3 -3
  62. data/lib/coderay/styles/alpha.rb +143 -0
  63. data/lib/coderay/token_kinds.rb +90 -0
  64. data/lib/coderay/tokens.rb +102 -277
  65. data/lib/coderay/tokens_proxy.rb +55 -0
  66. data/lib/coderay/version.rb +3 -0
  67. data/test/functional/basic.rb +200 -18
  68. data/test/functional/examples.rb +130 -0
  69. data/test/functional/for_redcloth.rb +15 -8
  70. data/test/functional/suite.rb +9 -6
  71. metadata +103 -123
  72. data/FOLDERS +0 -53
  73. data/bin/coderay_stylesheet +0 -4
  74. data/lib/coderay/encoders/html/numerization.rb +0 -133
  75. data/lib/coderay/encoders/term.rb +0 -158
  76. data/lib/coderay/encoders/token_class_filter.rb +0 -84
  77. data/lib/coderay/helpers/gzip_simple.rb +0 -123
  78. data/lib/coderay/scanners/nitro_xhtml.rb +0 -136
  79. data/lib/coderay/scanners/plaintext.rb +0 -20
  80. data/lib/coderay/scanners/rhtml.rb +0 -78
  81. data/lib/coderay/scanners/scheme.rb +0 -145
  82. data/lib/coderay/styles/cycnus.rb +0 -152
  83. data/lib/coderay/styles/murphy.rb +0 -134
  84. data/lib/coderay/token_classes.rb +0 -86
  85. data/test/functional/load_plugin_scanner.rb +0 -11
  86. data/test/functional/vhdl.rb +0 -126
  87. data/test/functional/word_list.rb +0 -79
@@ -0,0 +1,26 @@
1
+ module CodeRay
2
+ module Scanners
3
+
4
+ # Scanner for plain text.
5
+ #
6
+ # Yields just one token of the kind :plain.
7
+ #
8
+ # Alias: +plaintext+, +plain+
9
+ class Text < Scanner
10
+
11
+ register_for :text
12
+ title 'Plain text'
13
+
14
+ KINDS_NOT_LOC = [:plain] # :nodoc:
15
+
16
+ protected
17
+
18
+ def scan_tokens encoder, options
19
+ encoder.text_token string, :plain
20
+ encoder
21
+ end
22
+
23
+ end
24
+
25
+ end
26
+ end
@@ -3,7 +3,7 @@ module Scanners
3
3
 
4
4
  load :html
5
5
 
6
- # XML Scanner
6
+ # Scanner for XML.
7
7
  #
8
8
  # Currently this is the same scanner as Scanners::HTML.
9
9
  class XML < HTML
@@ -1,7 +1,7 @@
1
1
  module CodeRay
2
2
  module Scanners
3
3
 
4
- # YAML Scanner
4
+ # Scanner for YAML.
5
5
  #
6
6
  # Based on the YAML scanner from Syntax by Jamis Buck.
7
7
  class YAML < Scanner
@@ -11,57 +11,59 @@ module Scanners
11
11
 
12
12
  KINDS_NOT_LOC = :all
13
13
 
14
- def scan_tokens tokens, options
14
+ protected
15
+
16
+ def scan_tokens encoder, options
15
17
 
16
18
  state = :initial
17
- key_indent = 0
19
+ key_indent = string_indent = 0
18
20
 
19
21
  until eos?
20
22
 
21
- kind = nil
22
- match = nil
23
23
  key_indent = nil if bol?
24
24
 
25
25
  if match = scan(/ +[\t ]*/)
26
- kind = :space
26
+ encoder.text_token match, :space
27
27
 
28
28
  elsif match = scan(/\n+/)
29
- kind = :space
29
+ encoder.text_token match, :space
30
30
  state = :initial if match.index(?\n)
31
31
 
32
32
  elsif match = scan(/#.*/)
33
- kind = :comment
33
+ encoder.text_token match, :comment
34
34
 
35
35
  elsif bol? and case
36
36
  when match = scan(/---|\.\.\./)
37
- tokens << [:open, :head]
38
- tokens << [match, :head]
39
- tokens << [:close, :head]
37
+ encoder.begin_group :head
38
+ encoder.text_token match, :head
39
+ encoder.end_group :head
40
40
  next
41
41
  when match = scan(/%.*/)
42
- tokens << [match, :doctype]
42
+ encoder.text_token match, :doctype
43
43
  next
44
44
  end
45
45
 
46
46
  elsif state == :value and case
47
- when !check(/(?:"[^"]*")(?=: |:$)/) && scan(/"/)
48
- tokens << [:open, :string]
49
- tokens << [matched, :delimiter]
50
- tokens << [matched, :content] if scan(/ [^"\\]* (?: \\. [^"\\]* )* /mx)
51
- tokens << [matched, :delimiter] if scan(/"/)
52
- tokens << [:close, :string]
47
+ when !check(/(?:"[^"]*")(?=: |:$)/) && match = scan(/"/)
48
+ encoder.begin_group :string
49
+ encoder.text_token match, :delimiter
50
+ encoder.text_token match, :content if match = scan(/ [^"\\]* (?: \\. [^"\\]* )* /mx)
51
+ encoder.text_token match, :delimiter if match = scan(/"/)
52
+ encoder.end_group :string
53
53
  next
54
54
  when match = scan(/[|>][-+]?/)
55
- tokens << [:open, :string]
56
- tokens << [match, :delimiter]
57
- string_indent = key_indent || column(pos - match.size - 1)
58
- tokens << [matched, :content] if scan(/(?:\n+ {#{string_indent + 1}}.*)+/)
59
- tokens << [:close, :string]
55
+ encoder.begin_group :string
56
+ encoder.text_token match, :delimiter
57
+ string_indent = key_indent || column(pos - match.size) - 1
58
+ encoder.text_token matched, :content if scan(/(?:\n+ {#{string_indent + 1}}.*)+/)
59
+ encoder.end_group :string
60
60
  next
61
61
  when match = scan(/(?![!"*&]).+?(?=$|\s+#)/)
62
- tokens << [match, :string]
63
- string_indent = key_indent || column(pos - match.size - 1)
64
- tokens << [matched, :string] if scan(/(?:\n+ {#{string_indent + 1}}.*)+/)
62
+ encoder.begin_group :string
63
+ encoder.text_token match, :content
64
+ string_indent = key_indent || column(pos - match.size) - 1
65
+ encoder.text_token matched, :content if scan(/(?:\n+ {#{string_indent + 1}}.*)+/)
66
+ encoder.end_group :string
65
67
  next
66
68
  end
67
69
 
@@ -69,68 +71,67 @@ module Scanners
69
71
  when match = scan(/[-:](?= |$)/)
70
72
  state = :value if state == :colon && (match == ':' || match == '-')
71
73
  state = :value if state == :initial && match == '-'
72
- kind = :operator
74
+ encoder.text_token match, :operator
75
+ next
73
76
  when match = scan(/[,{}\[\]]/)
74
- kind = :operator
75
- when state == :initial && match = scan(/[\w.() ]*\S(?=: |:$)/)
76
- kind = :key
77
- key_indent = column(pos - match.size - 1)
78
- # tokens << [key_indent.inspect, :debug]
77
+ encoder.text_token match, :operator
78
+ next
79
+ when state == :initial && match = scan(/[\w.() ]*\S(?= *:(?: |$))/)
80
+ encoder.text_token match, :key
81
+ key_indent = column(pos - match.size) - 1
79
82
  state = :colon
80
- when match = scan(/(?:"[^"\n]*"|'[^'\n]*')(?=: |:$)/)
81
- tokens << [:open, :key]
82
- tokens << [match[0,1], :delimiter]
83
- tokens << [match[1..-2], :content]
84
- tokens << [match[-1,1], :delimiter]
85
- tokens << [:close, :key]
86
- key_indent = column(pos - match.size - 1)
87
- # tokens << [key_indent.inspect, :debug]
83
+ next
84
+ when match = scan(/(?:"[^"\n]*"|'[^'\n]*')(?= *:(?: |$))/)
85
+ encoder.begin_group :key
86
+ encoder.text_token match[0,1], :delimiter
87
+ encoder.text_token match[1..-2], :content
88
+ encoder.text_token match[-1,1], :delimiter
89
+ encoder.end_group :key
90
+ key_indent = column(pos - match.size) - 1
88
91
  state = :colon
89
92
  next
90
- when scan(/(![\w\/]+)(:([\w:]+))?/)
91
- tokens << [self[1], :type]
93
+ when match = scan(/(![\w\/]+)(:([\w:]+))?/)
94
+ encoder.text_token self[1], :type
92
95
  if self[2]
93
- tokens << [':', :operator]
94
- tokens << [self[3], :class]
96
+ encoder.text_token ':', :operator
97
+ encoder.text_token self[3], :class
95
98
  end
96
99
  next
97
- when scan(/&\S+/)
98
- kind = :variable
99
- when scan(/\*\w+/)
100
- kind = :global_variable
101
- when scan(/<</)
102
- kind = :class_variable
103
- when scan(/\d\d:\d\d:\d\d/)
104
- kind = :oct
105
- when scan(/\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d(\.\d+)? [-+]\d\d:\d\d/)
106
- kind = :oct
107
- when scan(/:\w+/)
108
- kind = :symbol
109
- when scan(/[^:\s]+(:(?! |$)[^:\s]*)* .*/)
110
- kind = :error
111
- when scan(/[^:\s]+(:(?! |$)[^:\s]*)*/)
112
- kind = :error
100
+ when match = scan(/&\S+/)
101
+ encoder.text_token match, :variable
102
+ next
103
+ when match = scan(/\*\w+/)
104
+ encoder.text_token match, :global_variable
105
+ next
106
+ when match = scan(/<</)
107
+ encoder.text_token match, :class_variable
108
+ next
109
+ when match = scan(/\d\d:\d\d:\d\d/)
110
+ encoder.text_token match, :octal
111
+ next
112
+ when match = scan(/\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d(\.\d+)? [-+]\d\d:\d\d/)
113
+ encoder.text_token match, :octal
114
+ next
115
+ when match = scan(/:\w+/)
116
+ encoder.text_token match, :symbol
117
+ next
118
+ when match = scan(/[^:\s]+(:(?! |$)[^:\s]*)* .*/)
119
+ encoder.text_token match, :error
120
+ next
121
+ when match = scan(/[^:\s]+(:(?! |$)[^:\s]*)*/)
122
+ encoder.text_token match, :error
123
+ next
113
124
  end
114
125
 
115
126
  else
116
- getch
117
- kind = :error
127
+ raise if eos?
128
+ encoder.text_token getch, :error
118
129
 
119
130
  end
120
131
 
121
- match ||= matched
122
-
123
- if $CODERAY_DEBUG and not kind
124
- raise_inspect 'Error token %p in line %d' %
125
- [[match, kind], line], tokens, state
126
- end
127
- raise_inspect 'Empty token', tokens, state unless match
128
-
129
- tokens << [match, kind]
130
-
131
132
  end
132
133
 
133
- tokens
134
+ encoder
134
135
  end
135
136
 
136
137
  end
@@ -1,20 +1,23 @@
1
1
  module CodeRay
2
2
 
3
3
  # This module holds the Style class and its subclasses.
4
- #
4
+ #
5
5
  # See Plugin.
6
6
  module Styles
7
7
  extend PluginHost
8
8
  plugin_path File.dirname(__FILE__), 'styles'
9
-
9
+
10
+ # Base class for styles.
11
+ #
12
+ # Styles are used by Encoders::HTML to colorize tokens.
10
13
  class Style
11
14
  extend Plugin
12
15
  plugin_host Styles
13
-
14
- DEFAULT_OPTIONS = { }
15
-
16
+
17
+ DEFAULT_OPTIONS = { } # :nodoc:
18
+
16
19
  end
17
-
20
+
18
21
  end
19
-
22
+
20
23
  end
@@ -1,7 +1,7 @@
1
1
  module CodeRay
2
2
  module Styles
3
-
4
- default :cycnus
5
-
3
+
4
+ default :alpha
5
+
6
6
  end
7
7
  end
@@ -0,0 +1,143 @@
1
+ module CodeRay
2
+ module Styles
3
+
4
+ # A colorful theme using CSS 3 colors (with alpha channel).
5
+ class Alpha < Style
6
+
7
+ register_for :alpha
8
+
9
+ code_background = 'hsl(0,0%,95%)'
10
+ numbers_background = 'hsl(180,65%,90%)'
11
+ border_color = 'silver'
12
+ normal_color = 'black'
13
+
14
+ CSS_MAIN_STYLES = <<-MAIN # :nodoc:
15
+ .CodeRay {
16
+ background-color: #{code_background};
17
+ border: 1px solid #{border_color};
18
+ color: #{normal_color};
19
+ }
20
+ .CodeRay pre {
21
+ margin: 0px;
22
+ }
23
+
24
+ span.CodeRay { white-space: pre; border: 0px; padding: 2px; }
25
+
26
+ table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px; }
27
+ table.CodeRay td { padding: 2px 4px; vertical-align: top; }
28
+
29
+ .CodeRay .line-numbers {
30
+ background-color: #{numbers_background};
31
+ color: gray;
32
+ text-align: right;
33
+ -webkit-user-select: none;
34
+ -moz-user-select: none;
35
+ user-select: none;
36
+ }
37
+ .CodeRay .line-numbers a {
38
+ background-color: #{numbers_background} !important;
39
+ color: gray !important;
40
+ text-decoration: none !important;
41
+ }
42
+ .CodeRay .line-numbers a:target { color: blue !important; }
43
+ .CodeRay .line-numbers .highlighted { color: red !important; }
44
+ .CodeRay .line-numbers .highlighted a { color: red !important; }
45
+ .CodeRay span.line-numbers { padding: 0px 4px; }
46
+ .CodeRay .line { display: block; float: left; width: 100%; }
47
+ .CodeRay .code { width: 100%; }
48
+ .CodeRay .code pre { overflow: auto; }
49
+ MAIN
50
+
51
+ TOKEN_COLORS = <<-'TOKENS'
52
+ .debug { color: white !important; background: blue !important; }
53
+
54
+ .annotation { color:#007 }
55
+ .attribute-name { color:#b48 }
56
+ .attribute-value { color:#700 }
57
+ .binary { color:#509 }
58
+ .char .content { color:#D20 }
59
+ .char .delimiter { color:#710 }
60
+ .char { color:#D20 }
61
+ .class { color:#B06; font-weight:bold }
62
+ .class-variable { color:#369 }
63
+ .color { color:#0A0 }
64
+ .comment { color:#777 }
65
+ .comment .char { color:#444 }
66
+ .comment .delimiter { color:#444 }
67
+ .complex { color:#A08 }
68
+ .constant { color:#036; font-weight:bold }
69
+ .decorator { color:#B0B }
70
+ .definition { color:#099; font-weight:bold }
71
+ .delimiter { color:black }
72
+ .directive { color:#088; font-weight:bold }
73
+ .doc { color:#970 }
74
+ .doc-string { color:#D42; font-weight:bold }
75
+ .doctype { color:#34b }
76
+ .entity { color:#800; font-weight:bold }
77
+ .error { color:#F00; background-color:#FAA }
78
+ .escape { color:#666 }
79
+ .exception { color:#C00; font-weight:bold }
80
+ .float { color:#60E }
81
+ .function { color:#06B; font-weight:bold }
82
+ .global-variable { color:#d70 }
83
+ .hex { color:#02b }
84
+ .imaginary { color:#f00 }
85
+ .include { color:#B44; font-weight:bold }
86
+ .inline { background-color: hsla(0,0%,0%,0.07); color: black }
87
+ .inline-delimiter { font-weight: bold; color: #666 }
88
+ .instance-variable { color:#33B }
89
+ .integer { color:#00D }
90
+ .key .char { color: #60f }
91
+ .key .delimiter { color: #404 }
92
+ .key { color: #606 }
93
+ .keyword { color:#080; font-weight:bold }
94
+ .label { color:#970; font-weight:bold }
95
+ .local-variable { color:#963 }
96
+ .namespace { color:#707; font-weight:bold }
97
+ .octal { color:#40E }
98
+ .operator { }
99
+ .predefined { color:#369; font-weight:bold }
100
+ .predefined-constant { color:#069 }
101
+ .predefined-type { color:#0a5; font-weight:bold }
102
+ .preprocessor { color:#579 }
103
+ .pseudo-class { color:#00C; font-weight:bold }
104
+ .regexp .content { color:#808 }
105
+ .regexp .delimiter { color:#404 }
106
+ .regexp .modifier { color:#C2C }
107
+ .regexp { background-color:hsla(300,100%,50%,0.06); }
108
+ .reserved { color:#080; font-weight:bold }
109
+ .shell .content { color:#2B2 }
110
+ .shell .delimiter { color:#161 }
111
+ .shell { background-color:hsla(120,100%,50%,0.06); }
112
+ .string .char { color: #b0b }
113
+ .string .content { color: #D20 }
114
+ .string .delimiter { color: #710 }
115
+ .string .modifier { color: #E40 }
116
+ .string { background-color:hsla(0,100%,50%,0.05); }
117
+ .symbol .content { color:#A60 }
118
+ .symbol .delimiter { color:#630 }
119
+ .symbol { color:#A60 }
120
+ .tag { color:#070 }
121
+ .type { color:#339; font-weight:bold }
122
+ .value { color: #088; }
123
+ .variable { color:#037 }
124
+
125
+ .insert { background: hsla(120,100%,50%,0.12) }
126
+ .delete { background: hsla(0,100%,50%,0.12) }
127
+ .change { color: #bbf; background: #007; }
128
+ .head { color: #f8f; background: #505 }
129
+ .head .filename { color: white; }
130
+
131
+ .delete .eyecatcher { background-color: hsla(0,100%,50%,0.2); border: 1px solid hsla(0,100%,45%,0.5); margin: -1px; border-bottom: none; border-top-left-radius: 5px; border-top-right-radius: 5px; }
132
+ .insert .eyecatcher { background-color: hsla(120,100%,50%,0.2); border: 1px solid hsla(120,100%,25%,0.5); margin: -1px; border-top: none; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; }
133
+
134
+ .insert .insert { color: #0c0; background:transparent; font-weight:bold }
135
+ .delete .delete { color: #c00; background:transparent; font-weight:bold }
136
+ .change .change { color: #88f }
137
+ .head .head { color: #f4f }
138
+ TOKENS
139
+
140
+ end
141
+
142
+ end
143
+ end
@@ -0,0 +1,90 @@
1
+ module CodeRay
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
7
+ end
8
+
9
+ # speedup
10
+ TokenKinds.compare_by_identity if TokenKinds.respond_to? :compare_by_identity
11
+
12
+ TokenKinds.update( # :nodoc:
13
+ :annotation => 'annotation',
14
+ :attribute_name => 'attribute-name',
15
+ :attribute_value => 'attribute-value',
16
+ :binary => 'bin',
17
+ :char => 'char',
18
+ :class => 'class',
19
+ :class_variable => 'class-variable',
20
+ :color => 'color',
21
+ :comment => 'comment',
22
+ :complex => 'complex',
23
+ :constant => 'constant',
24
+ :content => 'content',
25
+ :debug => 'debug',
26
+ :decorator => 'decorator',
27
+ :definition => 'definition',
28
+ :delimiter => 'delimiter',
29
+ :directive => 'directive',
30
+ :doc => 'doc',
31
+ :doctype => 'doctype',
32
+ :doc_string => 'doc-string',
33
+ :entity => 'entity',
34
+ :error => 'error',
35
+ :escape => 'escape',
36
+ :exception => 'exception',
37
+ :filename => 'filename',
38
+ :float => 'float',
39
+ :function => 'function',
40
+ :global_variable => 'global-variable',
41
+ :hex => 'hex',
42
+ :imaginary => 'imaginary',
43
+ :important => 'important',
44
+ :include => 'include',
45
+ :inline => 'inline',
46
+ :inline_delimiter => 'inline-delimiter',
47
+ :instance_variable => 'instance-variable',
48
+ :integer => 'integer',
49
+ :key => 'key',
50
+ :keyword => 'keyword',
51
+ :label => 'label',
52
+ :local_variable => 'local-variable',
53
+ :modifier => 'modifier',
54
+ :namespace => 'namespace',
55
+ :octal => 'octal',
56
+ :predefined => 'predefined',
57
+ :predefined_constant => 'predefined-constant',
58
+ :predefined_type => 'predefined-type',
59
+ :preprocessor => 'preprocessor',
60
+ :pseudo_class => 'pseudo-class',
61
+ :regexp => 'regexp',
62
+ :reserved => 'reserved',
63
+ :shell => 'shell',
64
+ :string => 'string',
65
+ :symbol => 'symbol',
66
+ :tag => 'tag',
67
+ :type => 'type',
68
+ :value => 'value',
69
+ :variable => 'variable',
70
+
71
+ :change => 'change',
72
+ :delete => 'delete',
73
+ :head => 'head',
74
+ :insert => 'insert',
75
+
76
+ :eyecatcher => 'eyecatcher',
77
+
78
+ :ident => false,
79
+ :operator => false,
80
+
81
+ :space => false,
82
+ :plain => false
83
+ )
84
+
85
+ TokenKinds[:method] = TokenKinds[:function]
86
+ TokenKinds[:escape] = TokenKinds[:delimiter]
87
+ TokenKinds[:docstring] = TokenKinds[:comment]
88
+
89
+ TokenKinds.freeze
90
+ end