rouge 2.0.5 → 2.0.6

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.
@@ -0,0 +1,72 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Lexers
5
+ class Turtle < RegexLexer
6
+ title "Turtle/TriG"
7
+ desc "Terse RDF Triple Language, TriG"
8
+ tag 'turtle'
9
+ filenames *%w(*.ttl *.trig)
10
+ mimetypes *%w(
11
+ text/turtle
12
+ application/trig
13
+ )
14
+
15
+ def self.analyze_text(text)
16
+ start = text[0..1000]
17
+ return 0.5 if start =~ %r(@prefix\b)
18
+ return 0.5 if start =~ %r(@base\b)
19
+ return 0.4 if start =~ %r(PREFIX\b)i
20
+ return 0.4 if start =~ %r(BASE\b)i
21
+ end
22
+
23
+ state :root do
24
+ rule /@base\b/, Keyword::Declaration
25
+ rule /@prefix\b/, Keyword::Declaration
26
+ rule /true\b/, Keyword::Constant
27
+ rule /false\b/, Keyword::Constant
28
+
29
+ rule /""".*?"""/m, Literal::String
30
+ rule /"([^"\\]|\\.)*"/, Literal::String
31
+ rule /'''.*?'''/m, Literal::String
32
+ rule /'([^'\\]|\\.)*'/, Literal::String
33
+
34
+ rule /#.*$/, Comment::Single
35
+
36
+ rule /@[^\s,.; ]+/, Name::Attribute
37
+
38
+ rule /[+-]?[0-9]+\.[0-9]*E[+-]?[0-9]+/, Literal::Number::Float
39
+ rule /[+-]?\.[0-9]+E[+-]?[0-9]+/, Literal::Number::Float
40
+ rule /[+-]?[0-9]+E[+-]?[0-9]+/, Literal::Number::Float
41
+
42
+ rule /[+-]?[0-9]*\.[0-9]+?/, Literal::Number::Float
43
+
44
+ rule /[+-]?[0-9]+/, Literal::Number::Integer
45
+
46
+ rule /\./, Punctuation
47
+ rule /,/, Punctuation
48
+ rule /;/, Punctuation
49
+ rule /\(/, Punctuation
50
+ rule /\)/, Punctuation
51
+ rule /\{/, Punctuation
52
+ rule /\}/, Punctuation
53
+ rule /\[/, Punctuation
54
+ rule /\]/, Punctuation
55
+ rule /\^\^/, Punctuation
56
+
57
+ rule /<[^>]*>/, Name::Label
58
+
59
+ rule /base\b/i, Keyword::Declaration
60
+ rule /prefix\b/i, Keyword::Declaration
61
+ rule /GRAPH\b/, Keyword
62
+ rule /a\b/, Keyword
63
+
64
+ rule /\s+/, Text::Whitespace
65
+
66
+ rule /[^:;<>#@"\(\).\[\]\{\} ]+:/, Name::Namespace
67
+ rule /[^:;<>#@"\(\).\[\]\{\} ]+/, Name
68
+
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,77 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Lexers
5
+ class Vala < RegexLexer
6
+ tag 'vala'
7
+ filenames '*.vala'
8
+ mimetypes 'text/x-vala'
9
+
10
+ title "Vala"
11
+ desc 'A programming language similar to csharp.'
12
+
13
+ id = /@?[_a-z]\w*/i
14
+
15
+ keywords = %w(
16
+ abstract as async base break case catch const construct continue
17
+ default delegate delete do dynamic else ensures enum errordomain
18
+ extern false finally for foreach get global if in inline interface
19
+ internal is lock new null out override owned private protected
20
+ public ref requires return set signal sizeof static switch this
21
+ throw throws true try typeof unowned var value virtual void weak
22
+ while yield
23
+ )
24
+
25
+ keywords_type = %w(
26
+ bool char double float int int8 int16 int32 int64 long short size_t
27
+ ssize_t string unichar uint uint8 uint16 uint32 uint64 ulong ushort
28
+ )
29
+
30
+ state :whitespace do
31
+ rule /\s+/m, Text
32
+ rule %r(//.*?$), Comment::Single
33
+ rule %r(/[*].*?[*]/)m, Comment::Multiline
34
+ end
35
+
36
+ state :root do
37
+ mixin :whitespace
38
+
39
+ rule /^\s*\[.*?\]/, Name::Attribute
40
+
41
+ rule /(<\[)\s*(#{id}:)?/, Keyword
42
+ rule /\]>/, Keyword
43
+
44
+ rule /[~!%^&*()+=|\[\]{}:;,.<>\/?-]/, Punctuation
45
+ rule /@"(\\.|.)*?"/, Str
46
+ rule /"(\\.|.)*?["\n]/, Str
47
+ rule /'(\\.|.)'/, Str::Char
48
+ rule /0x[0-9a-f]+[lu]?/i, Num
49
+ rule %r(
50
+ [0-9]
51
+ ([.][0-9]*)? # decimal
52
+ (e[+-][0-9]+)? # exponent
53
+ [fldu]? # type
54
+ )ix, Num
55
+ rule /\b(#{keywords.join('|')})\b/, Keyword
56
+ rule /\b(#{keywords_type.join('|')})\b/, Keyword::Type
57
+ rule /class|struct/, Keyword, :class
58
+ rule /namespace|using/, Keyword, :namespace
59
+ rule /#{id}(?=\s*[(])/, Name::Function
60
+ rule id, Name
61
+
62
+ rule /#.*/, Comment::Preproc
63
+ end
64
+
65
+ state :class do
66
+ mixin :whitespace
67
+ rule id, Name::Class, :pop!
68
+ end
69
+
70
+ state :namespace do
71
+ mixin :whitespace
72
+ rule /(?=[(])/, Text, :pop!
73
+ rule /(#{id}|[.])+/, Name::Namespace, :pop!
74
+ end
75
+ end
76
+ end
77
+ end
@@ -121,12 +121,12 @@ module Rouge
121
121
  state :statement do
122
122
  mixin :whitespace
123
123
  rule /L?"/, Str, :string
124
- rule /(\d+\.\d*|\d*\.\d+)(e[+-]?[0-9]+)?/i, Num::Float
125
- rule /\d+e[+-]?[0-9]+/i, Num::Float
126
- rule /[0-9]*'h[0-9a-fA-F]+/, Num::Hex
127
- rule /[0-9]*'b?[01xz]+/, Num::Bin
128
- rule /[0-9]*'d[0-9]+/, Num::Integer
129
- rule /\d+[lu]*/i, Num::Integer
124
+ rule /([0-9_]+\.[0-9_]*|[0-9_]*\.[0-9_]+)(e[+-]?[0-9_]+)?/i, Num::Float
125
+ rule /[0-9_]+e[+-]?[0-9_]+/i, Num::Float
126
+ rule /[0-9]*'h[0-9a-fA-F_?]+/, Num::Hex
127
+ rule /[0-9]*'b?[01xz_?]+/, Num::Bin
128
+ rule /[0-9]*'d[0-9_?]+/, Num::Integer
129
+ rule /[0-9_]+[lu]*/i, Num::Integer
130
130
  rule %r([~!%^&*+-=\|?:<>/@{}]), Operator
131
131
  rule /[()\[\],.$\#]/, Punctuation
132
132
  rule /`(\w+)/, Comment::Preproc
@@ -0,0 +1,97 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Lexers
5
+ class VHDL < RegexLexer
6
+ title "VHDL 2008"
7
+ desc "Very High Speed Integrated Circuit Hardware Description Language"
8
+ tag 'vhdl'
9
+
10
+ filenames '*.vhd', '*.vhdl', '*.vho'
11
+
12
+ mimetypes 'text/x-vhdl'
13
+ def self.keywords
14
+ @keywords ||= Set.new %w(
15
+ access after alias all architecture array assert assume assume_guarantee attribute
16
+ begin block body buffer bus case component configuration constant context cover
17
+ default disconnect downto else elsif end entity exit fairness file for force function
18
+ generate generic group guarded if impure in inertial inout is label library linkage
19
+ literal loop map new next null of on open others out package parameter port postponed
20
+ procedure process property protected pure range record register reject release report
21
+ return select sequence severity shared signal strong subtype then to transport type
22
+ unaffected units until use variable vmode vprop vunit wait when while with
23
+ )
24
+ end
25
+
26
+ def self.keywords_type
27
+ @keywords_type ||= Set.new %w(
28
+ bit bit_vector boolean boolean_vector character integer integer_vector natural positive
29
+ real real_vector severity_level signed std_logic std_logic_vector std_ulogic
30
+ std_ulogic_vector string unsigned time time__vector
31
+ )
32
+ end
33
+
34
+ def self.operator_words
35
+ @operator_words ||= Set.new %w(
36
+ abs and mod nand nor not or rem rol ror sla sll sra srl xnor xor
37
+ )
38
+ end
39
+
40
+ id = /[a-zA-Z][a-zA-Z0-9_]*/
41
+
42
+ state :whitespace do
43
+ rule /\s+/, Text
44
+ rule /\n/, Text
45
+ # Find Comments (VHDL doesn't support multiline comments)
46
+ rule /--.*$/, Comment::Single
47
+ end
48
+
49
+ state :statements do
50
+
51
+ # Find Numbers
52
+ rule /-?\d+/i, Num::Integer
53
+ rule /-?\d+[.]\d+/i, Num::Float
54
+
55
+ # Find Strings
56
+ rule /[box]?"[^"]*"/i, Str::Single
57
+ rule /'[^']?'/i, Str::Char
58
+
59
+ # Find Attributes
60
+ rule /'#{id}/i, Name::Attribute
61
+
62
+ # Punctuations
63
+ rule /[(),:;]/, Punctuation
64
+
65
+ # Boolean and NULL
66
+ rule /(?:true|false|null)\b/i, Name::Builtin
67
+
68
+ rule id do |m|
69
+ match = m[0].downcase #convert to lower case
70
+ if self.class.keywords.include? match
71
+ token Keyword
72
+ elsif self.class.keywords_type.include? match
73
+ token Keyword::Type
74
+ elsif self.class.operator_words.include? match
75
+ token Operator::Word
76
+ else
77
+ token Name
78
+ end
79
+ end
80
+
81
+ rule(
82
+ %r(=>|[*][*]|:=|\/=|>=|<=|<>|\?\?|\?=|\?\/=|\?>|\?<|\?>=|\?<=|<<|>>|[#&'*+-.\/:<=>\?@^]),
83
+ Operator
84
+ )
85
+
86
+ end
87
+
88
+ state :root do
89
+
90
+ mixin :whitespace
91
+ mixin :statements
92
+
93
+ end
94
+
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,69 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Themes
5
+ class Tulip < CSSTheme
6
+ name 'tulip'
7
+
8
+ palette :purple => '#766DAF'
9
+ palette :lpurple => '#9f93e6'
10
+ palette :orange => '#FAAF4C'
11
+ palette :green => '#3FB34F'
12
+ palette :lgreen => '#41ff5b'
13
+ palette :yellow => '#FFF02A'
14
+ palette :black => '#000000'
15
+ palette :gray => '#6D6E70'
16
+ palette :red => '#CC0000'
17
+ palette :dark_purple => '#231529'
18
+ palette :lunicorn => '#faf8ed'
19
+ palette :white => '#FFFFFF'
20
+ palette :earth => '#181a27'
21
+ palette :dune => '#fff0a6'
22
+
23
+ style Text, :fg => :white, :bg => :dark_purple
24
+
25
+ style Comment, :fg => :gray, :italic => true
26
+ style Comment::Preproc, :fg => :lgreen, :bold => true, :italic => true
27
+ style Error,
28
+ Generic::Error, :fg => :white, :bg => :red
29
+ style Keyword, :fg => :yellow, :bold => true
30
+ style Operator,
31
+ Punctuation, :fg => :lgreen
32
+ style Generic::Deleted, :fg => :red
33
+ style Generic::Inserted, :fg => :green
34
+ style Generic::Emph, :italic => true
35
+ style Generic::Strong, :bold => true
36
+ style Generic::Traceback,
37
+ Generic::Lineno, :fg => :white, :bg => :purple
38
+ style Keyword::Constant, :fg => :lpurple, :bold => true
39
+ style Keyword::Namespace,
40
+ Keyword::Pseudo,
41
+ Keyword::Reserved,
42
+ Generic::Heading,
43
+ Generic::Subheading, :fg => :white, :bold => true
44
+ style Keyword::Type,
45
+ Name::Constant,
46
+ Name::Class,
47
+ Name::Decorator,
48
+ Name::Namespace,
49
+ Name::Builtin::Pseudo,
50
+ Name::Exception, :fg => :orange, :bold => true
51
+ style Name::Label,
52
+ Name::Tag, :fg => :lpurple, :bold => true
53
+ style Literal::Number,
54
+ Literal::Date,
55
+ Literal::String::Symbol, :fg => :lpurple, :bold => true
56
+ style Literal::String, :fg => :dune, :bold => true
57
+ style Literal::String::Escape,
58
+ Literal::String::Char,
59
+ Literal::String::Interpol, :fg => :orange, :bold => true
60
+ style Name::Builtin, :bold => true
61
+ style Name::Entity, :fg => '#999999', :bold => true
62
+ style Text::Whitespace, :fg => '#BBBBBB'
63
+ style Name::Function,
64
+ Name::Property,
65
+ Name::Attribute, :fg => :lgreen
66
+ style Name::Variable, :fg => :lgreen, :bold => true
67
+ end
68
+ end
69
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rouge
4
4
  def self.version
5
- "2.0.5"
5
+ "2.0.6"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rouge
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeanine Adkisson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-19 00:00:00.000000000 Z
11
+ date: 2016-09-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rouge aims to a be a simple, easy-to-extend drop-in replacement for pygments.
14
14
  email:
@@ -28,6 +28,7 @@ files:
28
28
  - lib/rouge/demos/apiblueprint
29
29
  - lib/rouge/demos/applescript
30
30
  - lib/rouge/demos/biml
31
+ - lib/rouge/demos/bsl
31
32
  - lib/rouge/demos/c
32
33
  - lib/rouge/demos/ceylon
33
34
  - lib/rouge/demos/cfscript
@@ -70,6 +71,7 @@ files:
70
71
  - lib/rouge/demos/json
71
72
  - lib/rouge/demos/json-doc
72
73
  - lib/rouge/demos/jsonnet
74
+ - lib/rouge/demos/jsx
73
75
  - lib/rouge/demos/julia
74
76
  - lib/rouge/demos/kotlin
75
77
  - lib/rouge/demos/liquid
@@ -81,6 +83,7 @@ files:
81
83
  - lib/rouge/demos/markdown
82
84
  - lib/rouge/demos/matlab
83
85
  - lib/rouge/demos/moonscript
86
+ - lib/rouge/demos/mxml
84
87
  - lib/rouge/demos/nasm
85
88
  - lib/rouge/demos/nginx
86
89
  - lib/rouge/demos/nim
@@ -93,6 +96,7 @@ files:
93
96
  - lib/rouge/demos/powershell
94
97
  - lib/rouge/demos/praat
95
98
  - lib/rouge/demos/prolog
99
+ - lib/rouge/demos/prometheus
96
100
  - lib/rouge/demos/properties
97
101
  - lib/rouge/demos/protobuf
98
102
  - lib/rouge/demos/puppet
@@ -120,10 +124,13 @@ files:
120
124
  - lib/rouge/demos/tex
121
125
  - lib/rouge/demos/toml
122
126
  - lib/rouge/demos/tulip
127
+ - lib/rouge/demos/turtle
123
128
  - lib/rouge/demos/twig
124
129
  - lib/rouge/demos/typescript
130
+ - lib/rouge/demos/vala
125
131
  - lib/rouge/demos/vb
126
132
  - lib/rouge/demos/verilog
133
+ - lib/rouge/demos/vhdl
127
134
  - lib/rouge/demos/viml
128
135
  - lib/rouge/demos/xml
129
136
  - lib/rouge/demos/yaml
@@ -149,6 +156,7 @@ files:
149
156
  - lib/rouge/lexers/apiblueprint.rb
150
157
  - lib/rouge/lexers/apple_script.rb
151
158
  - lib/rouge/lexers/biml.rb
159
+ - lib/rouge/lexers/bsl.rb
152
160
  - lib/rouge/lexers/c.rb
153
161
  - lib/rouge/lexers/ceylon.rb
154
162
  - lib/rouge/lexers/cfscript.rb
@@ -190,6 +198,7 @@ files:
190
198
  - lib/rouge/lexers/javascript.rb
191
199
  - lib/rouge/lexers/jinja.rb
192
200
  - lib/rouge/lexers/jsonnet.rb
201
+ - lib/rouge/lexers/jsx.rb
193
202
  - lib/rouge/lexers/julia.rb
194
203
  - lib/rouge/lexers/kotlin.rb
195
204
  - lib/rouge/lexers/liquid.rb
@@ -203,6 +212,7 @@ files:
203
212
  - lib/rouge/lexers/matlab.rb
204
213
  - lib/rouge/lexers/matlab/builtins.rb
205
214
  - lib/rouge/lexers/moonscript.rb
215
+ - lib/rouge/lexers/mxml.rb
206
216
  - lib/rouge/lexers/nasm.rb
207
217
  - lib/rouge/lexers/nginx.rb
208
218
  - lib/rouge/lexers/nim.rb
@@ -216,6 +226,7 @@ files:
216
226
  - lib/rouge/lexers/powershell.rb
217
227
  - lib/rouge/lexers/praat.rb
218
228
  - lib/rouge/lexers/prolog.rb
229
+ - lib/rouge/lexers/prometheus.rb
219
230
  - lib/rouge/lexers/properties.rb
220
231
  - lib/rouge/lexers/protobuf.rb
221
232
  - lib/rouge/lexers/puppet.rb
@@ -244,10 +255,13 @@ files:
244
255
  - lib/rouge/lexers/tex.rb
245
256
  - lib/rouge/lexers/toml.rb
246
257
  - lib/rouge/lexers/tulip.rb
258
+ - lib/rouge/lexers/turtle.rb
247
259
  - lib/rouge/lexers/twig.rb
248
260
  - lib/rouge/lexers/typescript.rb
261
+ - lib/rouge/lexers/vala.rb
249
262
  - lib/rouge/lexers/vb.rb
250
263
  - lib/rouge/lexers/verilog.rb
264
+ - lib/rouge/lexers/vhdl.rb
251
265
  - lib/rouge/lexers/viml.rb
252
266
  - lib/rouge/lexers/viml/keywords.rb
253
267
  - lib/rouge/lexers/xml.rb
@@ -265,6 +279,7 @@ files:
265
279
  - lib/rouge/themes/monokai.rb
266
280
  - lib/rouge/themes/monokai_sublime.rb
267
281
  - lib/rouge/themes/thankful_eyes.rb
282
+ - lib/rouge/themes/tulip.rb
268
283
  - lib/rouge/token.rb
269
284
  - lib/rouge/util.rb
270
285
  - lib/rouge/version.rb