diff options
author | murphy <murphy@rubychan.de> | 2010-03-30 01:10:25 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2010-03-30 01:10:25 +0000 |
commit | 476bc1bfe2f2000acc665f034e7da19bd3f0cc6b (patch) | |
tree | fee024aafe77603a11c8ada56a5165431b1a0789 /lib/coderay/token_kinds.rb | |
parent | 6e01dd000e62f03f9a8e2658bf57b7730677c3f0 (diff) | |
download | coderay-476bc1bfe2f2000acc665f034e7da19bd3f0cc6b.tar.gz |
Renamed token_classes to token_kinds (closes #122).
* *RENAMED* from ClassOfKind. The term "token class" is no longer used in CodeRay. Instead, tokens have _kinds_.
* *RENAMED* TokenKindFilter to TokenClassFilter.
* *ADDED* documentation on encoders affected by the term change.
* *REMOVED* token kinds :attribute_name_fat, :attribute_value_fat, :operator_fat, :tag_fat, and :xml_text.
* *ADDED* token kind :filename.
Diffstat (limited to 'lib/coderay/token_kinds.rb')
-rwxr-xr-x | lib/coderay/token_kinds.rb | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/lib/coderay/token_kinds.rb b/lib/coderay/token_kinds.rb new file mode 100755 index 0000000..c8e370c --- /dev/null +++ b/lib/coderay/token_kinds.rb @@ -0,0 +1,82 @@ +module CodeRay + class Tokens + AbbreviationForKind = Hash.new do |h, k| # :nodoc: + raise 'Undefined Token kind: %p' % [k] # :nodoc: + 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 |