rouge 3.24.0 → 3.25.0

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff5fdf4ccf2083c09f6ce1c899d36f7ef50b2f4bb70e5fa04dc18ce239422f8a
4
- data.tar.gz: e40152f9290403580be90d096219bf81a92750e8c02be04f05d6929b1fb186ba
3
+ metadata.gz: 35d2eb9627935d1f4e510d66263bddb55773667d8a441677019a377abaf3784e
4
+ data.tar.gz: 04370e4428e5f4c30a552d455bbf5655beeae8bf3ddc68db09ba0fbf76fee3e9
5
5
  SHA512:
6
- metadata.gz: e9c0bcf9114cb6b260d611777dbeaa7649bc20ad298ddc73fa2b606ca871615051c7f46abfbed3d8121ec08b505e1c3c4c86c2140d5c30a6c6104dae12d15b11
7
- data.tar.gz: 061b7d77b9162d45ff5416fefa9a2052199745b31e3897170c79e46311a6b36de959b1f030a903130dda3941c0ca217c13012f27a5c840f0c07b0912b02a93c7
6
+ metadata.gz: fc847dd05c6d47cdbcc4296b60594faf8477b1c143e8f303c84a09bfbd88345baa5dbe19e4238ef6a37c79e59809616f649679070faf17f556838ce874cb95b9
7
+ data.tar.gz: 272f4948d1935e9e9c1eaae8e5230e5db42933dcf1e2130dad009d6d3e4c57fee656b4aead64d6933cadf836bd7d82287fbc8193032c1af7ebf21e53fc7fb403
@@ -13,10 +13,8 @@ module Rouge
13
13
  end
14
14
 
15
15
  def stream(tokens)
16
- lineno = 0
17
- token_lines(tokens) do |tokens_in_line|
18
- lineno += 1
19
- line = %(#{@delegate.format(tokens_in_line)}\n)
16
+ token_lines(tokens).with_index(1) do |line_tokens, lineno|
17
+ line = %(#{@delegate.format(line_tokens)}\n)
20
18
  line = %(<span class="#{@highlight_line_class}">#{line}</span>) if @highlight_lines.include? lineno
21
19
  yield line
22
20
  end
@@ -32,10 +32,8 @@ module Rouge
32
32
  end
33
33
 
34
34
  def stream(tokens, &b)
35
- lineno = @start_line - 1
36
35
  buffer = [%(<table class="#@table_class"><tbody>)]
37
- token_lines(tokens) do |line_tokens|
38
- lineno += 1
36
+ token_lines(tokens).with_index(@start_line) do |line_tokens, lineno|
39
37
  buffer << %(<tr id="#{sprintf @line_id, lineno}" class="#@line_class">)
40
38
  buffer << %(<td class="#@gutter_class gl" )
41
39
  buffer << %(style="-moz-user-select: none;-ms-user-select: none;)
@@ -11,9 +11,8 @@ module Rouge
11
11
  end
12
12
 
13
13
  def stream(tokens, &b)
14
- lineno = 0
15
- token_lines(tokens) do |line_tokens|
16
- yield %(<#{@tag_name} class="#{sprintf @class_format, lineno += 1}">)
14
+ token_lines(tokens).with_index(1) do |line_tokens, lineno|
15
+ yield %(<#{@tag_name} class="#{sprintf @class_format, lineno}">)
17
16
  @formatter.stream(line_tokens) {|formatted| yield formatted }
18
17
  yield %(\n</#{@tag_name}>)
19
18
  end
@@ -79,6 +79,7 @@ module Rouge
79
79
  state :basic do
80
80
  # Comments
81
81
  rule %r/@?\brem\b.*$/i, Comment
82
+
82
83
  # Empty Labels
83
84
  rule %r/^::.*$/, Comment
84
85
 
@@ -105,7 +106,7 @@ module Rouge
105
106
  end
106
107
  end
107
108
 
108
- rule %r/([\/\-+][a-z]+)\s*/i, Name::Attribute
109
+ rule %r/((?:[\/\+]|--?)[a-z]+)\s*/i, Name::Attribute
109
110
 
110
111
  mixin :expansions
111
112
 
@@ -63,7 +63,7 @@ module Rouge
63
63
  rule %r((#{dq}[.]#{dq}?|[.]#{dq})(e[+-]?#{dq}[lu]*)?)i, Num::Float
64
64
  rule %r(#{dq}e[+-]?#{dq}[lu]*)i, Num::Float
65
65
  rule %r/0x\h('?\h)*[lu]*/i, Num::Hex
66
- rule %r/0b[01]+(?:_[01]+)*/, Num::Bin
66
+ rule %r/0b[01]+('[01]+)*/, Num::Bin
67
67
  rule %r/0[0-7]('?[0-7])*[lu]*/i, Num::Oct
68
68
  rule %r/#{dq}[lu]*/i, Num::Integer
69
69
  rule %r/\bnullptr\b/, Name::Builtin
@@ -7,7 +7,7 @@ module Rouge
7
7
  title "Docker"
8
8
  desc "Dockerfile syntax"
9
9
  tag 'docker'
10
- aliases 'dockerfile'
10
+ aliases 'dockerfile', 'Dockerfile'
11
11
  filenames 'Dockerfile', '*.Dockerfile', '*.docker'
12
12
  mimetypes 'text/x-dockerfile-config'
13
13
 
@@ -272,7 +272,8 @@ module Rouge
272
272
  rule %r/[$]{/, Punctuation, :template_string_expr
273
273
  rule %r/`/, Str::Double, :pop!
274
274
  rule %r/\\[$`]/, Str::Escape
275
- rule %r/[$]/, Str::Double
275
+ rule %r/[^$`\\]+/, Str::Double
276
+ rule %r/[\\$]/, Str::Double
276
277
  end
277
278
 
278
279
  state :template_string_expr do
@@ -53,7 +53,7 @@ module Rouge
53
53
  groups Keyword::Declaration, Text
54
54
  push :property
55
55
  end
56
- rule %r'(return|continue|break|this|super)(@#{name})?' do
56
+ rule %r'(return|continue|break|this|super)(@#{name})?\b' do
57
57
  groups Keyword, Name::Decorator
58
58
  end
59
59
  rule %r'\bfun\b', Keyword
@@ -110,9 +110,10 @@ module Rouge
110
110
 
111
111
  rule %r/(__(END|DATA)__)\b/, Comment::Preproc, :end_part
112
112
  rule %r/\$\^[ADEFHILMOPSTWX]/, Name::Variable::Global
113
- rule %r/\$[\\"'\[\]&`+*.,;=%~?@$!<>(^\|\/-](?!\w)/, Name::Variable::Global
113
+ rule %r/\$[\\"'\[\]&`+*.,;=%~?@$!<>(^\|\/_-](?!\w)/, Name::Variable::Global
114
+ rule %r/[$@%&*][$@%&*#_]*(?=[a-z{\[;])/i, Name::Variable, :varname
115
+
114
116
  rule %r/[-+\/*%=<>&^\|!\\~]=?/, Operator
115
- rule %r/[$@%#]+/, Name::Variable, :varname
116
117
 
117
118
  rule %r/0_?[0-7]+(_[0-7]+)*/, Num::Oct
118
119
  rule %r/0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*/, Num::Hex
@@ -159,8 +160,9 @@ module Rouge
159
160
 
160
161
  state :varname do
161
162
  rule %r/\s+/, Text
162
- rule %r/\{/, Punctuation, :pop! # hash syntax
163
- rule %r/\)|,/, Punctuation, :pop! # arg specifier
163
+ rule %r/[{\[]/, Punctuation, :pop! # hash syntax
164
+ rule %r/[),]/, Punctuation, :pop! # arg specifier
165
+ rule %r/[;]/, Punctuation, :pop! # postfix
164
166
  mixin :name_common
165
167
  end
166
168
 
@@ -131,34 +131,50 @@ module Rouge
131
131
  rule %r/[:,]/, Punctuation
132
132
  end
133
133
 
134
- state :hasht do
135
- rule %r/\s+/, Text::Whitespace
136
- rule %r/\}/, Punctuation, :pop!
134
+ state :expr do
135
+ mixin :comments
137
136
  rule %r/"/, Str::Double, :dq
138
137
  rule %r/'/, Str::Single, :sq
139
- rule %r/\w+/, Name::Other
138
+ rule %r/@"/, Str::Heredoc, :heredoc
139
+ rule %r/@'.*?'@/m, Str::Heredoc
140
+ rule %r/\d*\.\d+/, Num::Float
141
+ rule %r/\d+/, Num::Integer
142
+ rule %r/@\{/, Punctuation, :hasht
143
+ rule %r/@\(/, Punctuation, :array
144
+ rule %r/{/, Punctuation, :brace
145
+ rule %r/\[/, Punctuation, :bracket
146
+ end
147
+
148
+ state :hasht do
149
+ rule %r/\}/, Punctuation, :pop!
140
150
  rule %r/=/, Operator
141
- rule %r/,/, Punctuation
151
+ rule %r/[,;]/, Punctuation
152
+ mixin :expr
153
+ rule %r/\w+/, Name::Other
142
154
  mixin :variable
143
155
  end
144
156
 
145
157
  state :array do
146
158
  rule %r/\s+/, Text::Whitespace
147
159
  rule %r/\)/, Punctuation, :pop!
148
- rule %r/"/, Str::Double, :dq
149
- rule %r/'/, Str::Single, :sq
150
- rule %r/,/, Punctuation
160
+ rule %r/[,;]/, Punctuation
161
+ mixin :expr
151
162
  mixin :variable
152
163
  end
153
164
 
165
+ state :brace do
166
+ rule %r/[}]/, Punctuation, :pop!
167
+ mixin :root
168
+ end
169
+
154
170
  state :bracket do
155
171
  rule %r/\]/, Punctuation, :pop!
156
- rule %r/[A-Za-z]\w+\./, Name::Constant
172
+ rule %r/[A-Za-z]\w+\./, Name
157
173
  rule %r/([A-Za-z]\w+)/ do |m|
158
174
  if ATTRIBUTES.include? m[0]
159
175
  token Name::Builtin::Pseudo
160
176
  else
161
- token Keyword::Type
177
+ token Name
162
178
  end
163
179
  end
164
180
  mixin :root
@@ -174,20 +190,15 @@ module Rouge
174
190
  mixin :root
175
191
  end
176
192
 
177
- state :root do
193
+ state :comments do
178
194
  rule %r/\s+/, Text::Whitespace
179
-
180
- rule %r/#requires\s-version \d(?:\.\d+)?/, Comment::Preproc
181
195
  rule %r/#.*/, Comment
182
196
  rule %r/<#/, Comment::Multiline, :multiline
197
+ end
183
198
 
184
- rule %r/"/, Str::Double, :dq
185
- rule %r/'/, Str::Single, :sq
186
- rule %r/@"/, Str::Heredoc, :heredoc
187
- rule %r/@'.*?'@/m, Str::Heredoc
188
-
189
- rule %r/\d*\.\d+/, Num::Float
190
- rule %r/\d+/, Num::Integer
199
+ state :root do
200
+ mixin :comments
201
+ rule %r/#requires\s-version \d(?:\.\d+)?/, Comment::Preproc
191
202
 
192
203
  rule %r/\.\.(?=\.?\d)/, Operator
193
204
  rule %r/(?:#{OPERATORS})\b/i, Operator
@@ -204,28 +215,27 @@ module Rouge
204
215
  rule %r/-{1,2}\w+/, Name::Tag
205
216
 
206
217
  rule %r/(\.)?([-\w]+)(\[)/ do |m|
207
- groups Operator, Name::Function, Punctuation
218
+ groups Operator, Name, Punctuation
208
219
  push :bracket
209
220
  end
210
221
 
211
- rule %r/([\/\\~\w][-.:\/\\~\w]*)(\n)?/ do |m|
212
- groups Name::Function, Text::Whitespace
222
+ rule %r/([\/\\~[a-z]][-.:\/\\~\w]*)(\n)?/i do |m|
223
+ groups Name, Text::Whitespace
213
224
  push :parameters
214
225
  end
215
226
 
216
- rule %r/(\.)?([-\w]+)(?:(\()|(\n))?/ do |m|
227
+ rule %r/(\.)([-\w]+)(?:(\()|(\n))?/ do |m|
217
228
  groups Operator, Name::Function, Punctuation, Text::Whitespace
218
229
  push :parameters unless m[3].nil?
219
230
  end
220
231
 
221
232
  rule %r/\?/, Name::Function, :parameters
222
- rule %r/[-+*\/%=!.&|]/, Operator
223
- rule %r/@\{/, Punctuation, :hasht
224
- rule %r/@\(/, Punctuation, :array
225
- rule %r/\[/, Punctuation, :bracket
226
- rule %r/[{}(),:;]/, Punctuation
227
233
 
234
+ mixin :expr
228
235
  mixin :variable
236
+
237
+ rule %r/[-+*\/%=!.&|]/, Operator
238
+ rule %r/[{}(),:;]/, Punctuation
229
239
  end
230
240
  end
231
241
  end
@@ -90,7 +90,7 @@ module Rouge
90
90
  end
91
91
 
92
92
  state :regex_flags do
93
- rule %r/[mixounse]+/, Str::Regex, :pop!
93
+ rule %r/[mixounse]*/, Str::Regex, :pop!
94
94
  end
95
95
 
96
96
  # double-quoted string and symbol
@@ -267,7 +267,7 @@ module Rouge
267
267
  end
268
268
 
269
269
  state :test_heredoc do
270
- rule %r/[^#\\\n]+$/ do |m|
270
+ rule %r/[^#\\\n]*$/ do |m|
271
271
  tolerant, heredoc_name = @heredoc_queue.first
272
272
  check = tolerant ? m[0].strip : m[0].rstrip
273
273
 
@@ -22,8 +22,8 @@ module Rouge
22
22
 
23
23
  def self.keywords
24
24
  @keywords ||= %w(
25
- as assert async await break const copy do drop else enum extern fail false
26
- fn for if impl let log loop match mod move mut priv pub pure
25
+ as assert async await break const continue copy do drop else enum extern
26
+ fail false fn for if impl let log loop match mod move mut priv pub pure
27
27
  ref return self static struct true trait type unsafe use where
28
28
  while box
29
29
  )
@@ -63,7 +63,7 @@ module Rouge
63
63
  rule %r/0[xX][0-9a-fA-F]+[Ll]?/, Num::Hex
64
64
  rule %r/\b[0-9]+\b/, Num::Integer
65
65
  rule %r/(true|false|null)\b/, Keyword::Constant
66
- rule %r/[(\[]/, Punctuation, :push!
66
+ rule %r/[(\[]/, Punctuation, :push
67
67
  rule %r/[)\]}]/, Punctuation, :pop!
68
68
  end
69
69
  end
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Rouge
5
5
  def self.version
6
- "3.24.0"
6
+ "3.25.0"
7
7
  end
8
8
  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: 3.24.0
4
+ version: 3.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeanine Adkisson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-13 00:00:00.000000000 Z
11
+ date: 2020-11-10 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: