summaryrefslogtreecommitdiff
path: root/lib/coderay/token_kinds.rb
blob: 29bacb4a97f66743558a3cf15b84dc058070bd6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
module CodeRay
  class Tokens
    AbbreviationForKind = Hash.new do |h, k|  # :nodoc:
      if $CODERAY_DEBUG
        raise 'Undefined Token kind: %p' % [k]  # :nodoc:
      else
        :NO_HIGHLIGHT
      end
    end
    AbbreviationForKind.update with = {  # :nodoc:
      :annotation => 'at',
      :attribute_name => 'an',
      :attribute_value => 'av',
      :bin => 'bi',
      :char => 'ch',
      :class => 'cl',
      :class_variable => 'cv',
      :color => 'cr',
      :comment => 'c',
      :complex => 'cm',
      :constant => 'co',
      :content => 'k',
      :decorator => 'de',
      :definition => 'df',
      :delimiter => 'dl',
      :directive => 'di',
      :doc => 'do',
      :doctype => 'dt',
      :doc_string => 'ds',
      :entity => 'en',
      :error => 'er',
      :escape => 'e',
      :exception => 'ex',
      :filename => 'filename',
      :float => 'fl',
      :function => 'fu',
      :global_variable => 'gv',
      :hex => 'hx',
      :imaginary => 'cm',
      :important => 'im',
      :include => 'ic',
      :inline => 'il',
      :inline_delimiter => 'idl',
      :instance_variable => 'iv',
      :integer => 'i',
      :interpreted => 'in',
      :key => 'ke',
      :keyword => 'kw',
      :label => 'la',
      :local_variable => 'lv',
      :modifier => 'mod',
      :oct => 'oc',
      :predefined => 'pd',
      :preprocessor => 'pp',
      :pre_constant => 'pc',
      :pre_type => 'pt',
      :pseudo_class => 'ps',
      :regexp => 'rx',
      :reserved => 'r',
      :shell => 'sh',
      :string => 's',
      :symbol => 'sy',
      :tag => 'ta',
      :tag_special => 'ts',
      :type => 'ty',
      :value => 'vl',
      :variable => 'v',
      
      :insert => 'ins',
      :delete => 'del',
      :change => 'chg',
      :head => 'head',

      :ident => :NO_HIGHLIGHT, # 'id'
      #:operator => 'op',
      :operator => :NO_HIGHLIGHT,  # 'op'
      :space => :NO_HIGHLIGHT,  # 'sp'
      :plain => :NO_HIGHLIGHT,
    }
    AbbreviationForKind[:method] = AbbreviationForKind[:function]
    AbbreviationForKind[:open] = AbbreviationForKind[:close] = AbbreviationForKind[:delimiter]
    AbbreviationForKind[:nesting_delimiter] = AbbreviationForKind[:delimiter]
    AbbreviationForKind[:escape] = AbbreviationForKind[:delimiter]
    #AbbreviationForKind.default = AbbreviationForKind[:error] or raise 'no class found for :error!'
  end
end