Skip to content

Commit

Permalink
Add missing tokens from Pygments 2.2.0 (#1034)
Browse files Browse the repository at this point in the history
This adds the following tokens that have been added to Pygments since
2.2.0:

* Escape
* Function.Magic
* Variable.Magic
* String.Affix
* String.Delimeter
* Number.Bin
* Comment.Hashbang
* Comment.PreprocFile
  • Loading branch information
leonidboykov authored and pyrmont committed May 28, 2019
1 parent 4e5e248 commit fddb314
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions lib/rouge/token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ def self.token(name, shortname, &b)
token :Whitespace, 'w'
end

token :Error, 'err'
token :Other, 'x'
token :Escape, 'esc'
token :Error, 'err'
token :Other, 'x'

token :Keyword, 'k' do
token :Constant, 'kc'
Expand All @@ -103,7 +104,9 @@ def self.token(name, shortname, &b)
token :Decorator, 'nd'
token :Entity, 'ni'
token :Exception, 'ne'
token :Function, 'nf'
token :Function, 'nf' do
token :Magic, 'fm'
end
token :Property, 'py'
token :Label, 'nl'
token :Namespace, 'nn'
Expand All @@ -113,34 +116,37 @@ def self.token(name, shortname, &b)
token :Class, 'vc'
token :Global, 'vg'
token :Instance, 'vi'
token :Magic, 'vm'
end
end

token :Literal, 'l' do
token :Date, 'ld'

token :String, 's' do
token :Backtick, 'sb'
token :Char, 'sc'
token :Doc, 'sd'
token :Double, 's2'
token :Escape, 'se'
token :Heredoc, 'sh'
token :Interpol, 'si'
token :Other, 'sx'
token :Regex, 'sr'
token :Single, 's1'
token :Symbol, 'ss'
token :String, 's' do
token :Affix, 'sa'
token :Backtick, 'sb'
token :Char, 'sc'
token :Delimiter, 'dl'
token :Doc, 'sd'
token :Double, 's2'
token :Escape, 'se'
token :Heredoc, 'sh'
token :Interpol, 'si'
token :Other, 'sx'
token :Regex, 'sr'
token :Single, 's1'
token :Symbol, 'ss'
end

token :Number, 'm' do
token :Bin, 'mb'
token :Float, 'mf'
token :Hex, 'mh'
token :Integer, 'mi' do
token :Long, 'il'
end
token :Oct, 'mo'
token :Bin, 'mb'
token :Other, 'mx'
end
end
Expand All @@ -153,12 +159,14 @@ def self.token(name, shortname, &b)
token :Indicator, 'pi'
end

token :Comment, 'c' do
token :Doc, 'cd'
token :Multiline, 'cm'
token :Preproc, 'cp'
token :Single, 'c1'
token :Special, 'cs'
token :Comment, 'c' do
token :Hashbang, 'ch'
token :Doc, 'cd'
token :Multiline, 'cm'
token :Preproc, 'cp'
token :PreprocFile, 'cpf'
token :Single, 'c1'
token :Special, 'cs'
end

token :Generic, 'g' do
Expand Down

0 comments on commit fddb314

Please sign in to comment.