rouge 3.19.0 → 3.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rouge/demos/augeas +16 -0
- data/lib/rouge/demos/bibtex +12 -0
- data/lib/rouge/demos/brightscript +6 -0
- data/lib/rouge/demos/hlsl +20 -0
- data/lib/rouge/demos/janet +3 -0
- data/lib/rouge/demos/livescript +15 -0
- data/lib/rouge/demos/ssh +4 -0
- data/lib/rouge/demos/velocity +9 -0
- data/lib/rouge/demos/zig +6 -0
- data/lib/rouge/lexers/augeas.rb +93 -0
- data/lib/rouge/lexers/batchfile.rb +1 -1
- data/lib/rouge/lexers/bibtex.rb +115 -0
- data/lib/rouge/lexers/brightscript.rb +147 -0
- data/lib/rouge/lexers/cpp.rb +11 -4
- data/lib/rouge/lexers/css.rb +3 -1
- data/lib/rouge/lexers/diff.rb +1 -1
- data/lib/rouge/lexers/docker.rb +1 -1
- data/lib/rouge/lexers/haskell.rb +27 -19
- data/lib/rouge/lexers/hlsl.rb +166 -0
- data/lib/rouge/lexers/html.rb +7 -7
- data/lib/rouge/lexers/janet.rb +217 -0
- data/lib/rouge/lexers/javascript.rb +3 -3
- data/lib/rouge/lexers/jinja.rb +22 -7
- data/lib/rouge/lexers/jsx.rb +47 -59
- data/lib/rouge/lexers/julia.rb +4 -2
- data/lib/rouge/lexers/livescript.rb +310 -0
- data/lib/rouge/lexers/opentype_feature_file.rb +27 -42
- data/lib/rouge/lexers/perl.rb +21 -3
- data/lib/rouge/lexers/powershell.rb +5 -3
- data/lib/rouge/lexers/rego.rb +27 -12
- data/lib/rouge/lexers/sass/common.rb +1 -0
- data/lib/rouge/lexers/ssh.rb +33 -0
- data/lib/rouge/lexers/tsx.rb +10 -3
- data/lib/rouge/lexers/twig.rb +4 -4
- data/lib/rouge/lexers/typescript.rb +1 -12
- data/lib/rouge/lexers/typescript/common.rb +18 -4
- data/lib/rouge/lexers/velocity.rb +71 -0
- data/lib/rouge/lexers/xml.rb +5 -3
- data/lib/rouge/lexers/yaml.rb +5 -3
- data/lib/rouge/lexers/zig.rb +139 -0
- data/lib/rouge/version.rb +1 -1
- metadata +20 -2
data/lib/rouge/lexers/xml.rb
CHANGED
@@ -12,6 +12,8 @@ module Rouge
|
|
12
12
|
mimetypes 'text/xml', 'application/xml', 'image/svg+xml',
|
13
13
|
'application/rss+xml', 'application/atom+xml'
|
14
14
|
|
15
|
+
# Documentation: https://www.w3.org/TR/xml11/#charsets and https://www.w3.org/TR/xml11/#sec-suggested-names
|
16
|
+
|
15
17
|
def self.detect?(text)
|
16
18
|
return false if text.doctype?(/html/)
|
17
19
|
return true if text =~ /\A<\?xml\b/
|
@@ -27,10 +29,10 @@ module Rouge
|
|
27
29
|
rule %r/<![^>]*>/, Comment::Preproc
|
28
30
|
|
29
31
|
# open tags
|
30
|
-
rule %r(<\s*[\
|
32
|
+
rule %r(<\s*[\p{L}:_][\p{Word}\p{Cf}:.·-]*)m, Name::Tag, :tag
|
31
33
|
|
32
34
|
# self-closing tags
|
33
|
-
rule %r(<\s*/\s*[\
|
35
|
+
rule %r(<\s*/\s*[\p{L}:_][\p{Word}\p{Cf}:.·-]*\s*>)m, Name::Tag
|
34
36
|
end
|
35
37
|
|
36
38
|
state :comment do
|
@@ -41,7 +43,7 @@ module Rouge
|
|
41
43
|
|
42
44
|
state :tag do
|
43
45
|
rule %r/\s+/m, Text
|
44
|
-
rule %r/[\
|
46
|
+
rule %r/[\p{L}:_][\p{Word}\p{Cf}:.·-]*\s*=/m, Name::Attribute, :attr
|
45
47
|
rule %r(/?\s*>), Name::Tag, :pop!
|
46
48
|
end
|
47
49
|
|
data/lib/rouge/lexers/yaml.rb
CHANGED
@@ -11,6 +11,8 @@ module Rouge
|
|
11
11
|
aliases 'yml'
|
12
12
|
filenames '*.yaml', '*.yml'
|
13
13
|
|
14
|
+
# Documentation: https://yaml.org/spec/1.2/spec.html
|
15
|
+
|
14
16
|
def self.detect?(text)
|
15
17
|
# look for the %YAML directive
|
16
18
|
return true if text =~ /\A\s*%YAML/m
|
@@ -165,15 +167,15 @@ module Rouge
|
|
165
167
|
)x, Keyword::Type
|
166
168
|
|
167
169
|
# an anchor
|
168
|
-
rule %r/&[\
|
170
|
+
rule %r/&[\p{L}\p{Nl}\p{Nd}_-]+/, Name::Label
|
169
171
|
|
170
172
|
# an alias
|
171
|
-
rule %r/\*[\
|
173
|
+
rule %r/\*[\p{L}\p{Nl}\p{Nd}_-]+/, Name::Variable
|
172
174
|
end
|
173
175
|
|
174
176
|
state :block_nodes do
|
175
177
|
# implicit key
|
176
|
-
rule %r/((
|
178
|
+
rule %r/((?:[\p{L}\p{Nl}\p{Nd}_][\p{L}\p{Nl}\p{Nd}\p{Blank}_-]*)?)(:)(?=\s|$)/ do |m|
|
177
179
|
groups Name::Attribute, Punctuation::Indicator
|
178
180
|
set_indent m[0], :implicit => true
|
179
181
|
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
class Zig < RegexLexer
|
7
|
+
tag 'zig'
|
8
|
+
aliases 'zir'
|
9
|
+
filenames '*.zig'
|
10
|
+
mimetypes 'text/x-zig'
|
11
|
+
|
12
|
+
title 'Zig'
|
13
|
+
desc 'The Zig programming language (ziglang.org)'
|
14
|
+
|
15
|
+
def self.keywords
|
16
|
+
@keywords ||= %w(
|
17
|
+
align linksection threadlocal struct enum union error break return
|
18
|
+
anyframe fn c_longlong c_ulonglong c_longdouble c_void comptime_float
|
19
|
+
c_short c_ushort c_int c_uint c_long c_ulong continue asm defer
|
20
|
+
errdefer const var extern packed export pub if else switch and or
|
21
|
+
orelse while for bool unreachable try catch async suspend nosuspend
|
22
|
+
await resume undefined usingnamespace test void noreturn type
|
23
|
+
anyerror usize noalias inline noinline comptime callconv volatile
|
24
|
+
allowzero
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.builtins
|
29
|
+
@builtins ||= %w(
|
30
|
+
@addWithOverflow @as @atomicLoad @atomicStore @bitCast @breakpoint
|
31
|
+
@alignCast @alignOf @cDefine @cImport @cInclude @bitOffsetOf
|
32
|
+
@atomicRmw @bytesToSlice @byteOffsetOf @OpaqueType @panic @ptrCast
|
33
|
+
@bitReverse @Vector @sin @cUndef @canImplicitCast @clz @cmpxchgWeak
|
34
|
+
@cmpxchgStrong @compileError @compileLog @ctz @popCount @divExact
|
35
|
+
@divFloor @cos @divTrunc @embedFile @export @tagName @TagType
|
36
|
+
@errorName @call @errorReturnTrace @fence @fieldParentPtr @field
|
37
|
+
@unionInit @errorToInt @intToEnum @enumToInt @setAlignStack @frame
|
38
|
+
@Frame @exp @exp2 @log @log2 @log10 @fabs @floor @ceil @trunc @round
|
39
|
+
@floatCast @intToFloat @floatToInt @boolToInt @errSetCast @intToError
|
40
|
+
@frameAddress @import @newStackCall @asyncCall @intToPtr @intCast
|
41
|
+
@frameSize @memcpy @memset @mod @mulWithOverflow @splat @ptrToInt
|
42
|
+
@rem @returnAddress @setCold @Type @shuffle @setGlobalLinkage
|
43
|
+
@setGlobalSection @shlExact @This @hasDecl @hasField
|
44
|
+
@setRuntimeSafety @setEvalBranchQuota @setFloatMode @shlWithOverflow
|
45
|
+
@shrExact @sizeOf @bitSizeOf @sqrt @byteSwap @subWithOverflow
|
46
|
+
@sliceToBytes comptime_int @truncate @typeInfo @typeName @TypeOf
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
id = /[a-z_]\w*/i
|
51
|
+
escapes = /\\ ([nrt'"\\0] | x\h{2} | u\h{4} | U\h{8})/x
|
52
|
+
|
53
|
+
state :bol do
|
54
|
+
mixin :whitespace
|
55
|
+
rule %r/#\s[^\n]*/, Comment::Special
|
56
|
+
rule(//) { pop! }
|
57
|
+
end
|
58
|
+
|
59
|
+
state :attribute do
|
60
|
+
mixin :whitespace
|
61
|
+
mixin :literals
|
62
|
+
rule %r/[(,)=:]/, Name::Decorator
|
63
|
+
rule %r/\]/, Name::Decorator, :pop!
|
64
|
+
rule id, Name::Decorator
|
65
|
+
end
|
66
|
+
|
67
|
+
state :whitespace do
|
68
|
+
rule %r/\s+/, Text
|
69
|
+
rule %r(//[^\n]*), Comment
|
70
|
+
end
|
71
|
+
|
72
|
+
state :root do
|
73
|
+
rule %r/\n/, Text, :bol
|
74
|
+
|
75
|
+
mixin :whitespace
|
76
|
+
|
77
|
+
rule %r/\b(?:(i|u)[0-9]+)\b/, Keyword::Type
|
78
|
+
rule %r/\b(?:f(16|32|64|128))\b/, Keyword::Type
|
79
|
+
rule %r/\b(?:(isize|usize))\b/, Keyword::Type
|
80
|
+
|
81
|
+
mixin :literals
|
82
|
+
|
83
|
+
rule %r/'#{id}/, Name::Variable
|
84
|
+
rule %r/([.]?)(\s*)(@?#{id})(\s*)([(]?)/ do |m|
|
85
|
+
name = m[3]
|
86
|
+
t = if self.class.keywords.include? name
|
87
|
+
Keyword
|
88
|
+
elsif self.class.builtins.include? name
|
89
|
+
Name::Builtin
|
90
|
+
elsif !m[1].empty? && !m[5].empty?
|
91
|
+
Name::Function
|
92
|
+
elsif !m[1].empty?
|
93
|
+
Name::Property
|
94
|
+
else
|
95
|
+
Name
|
96
|
+
end
|
97
|
+
|
98
|
+
groups Punctuation, Text, t, Text, Punctuation
|
99
|
+
end
|
100
|
+
|
101
|
+
rule %r/[()\[\]{}|,:;]/, Punctuation
|
102
|
+
rule %r/[*\/!@~&+%^<>=\?-]|\.{1,3}/, Operator
|
103
|
+
end
|
104
|
+
|
105
|
+
state :literals do
|
106
|
+
rule %r/\b(?:true|false|null)\b/, Keyword::Constant
|
107
|
+
rule %r(
|
108
|
+
' (?: #{escapes} | [^\\] ) '
|
109
|
+
)x, Str::Char
|
110
|
+
|
111
|
+
rule %r/"/, Str, :string
|
112
|
+
rule %r/r(#*)".*?"\1/m, Str
|
113
|
+
|
114
|
+
dot = /[.][0-9_]+/
|
115
|
+
exp = /e[-+]?[0-9_]+/
|
116
|
+
|
117
|
+
rule %r(
|
118
|
+
[0-9]+
|
119
|
+
(#{dot} #{exp}?
|
120
|
+
|#{dot}? #{exp}
|
121
|
+
)
|
122
|
+
)x, Num::Float
|
123
|
+
|
124
|
+
rule %r(
|
125
|
+
( 0b[10_]+
|
126
|
+
| 0x[0-9a-fA-F_]+
|
127
|
+
| [0-9_]+
|
128
|
+
)
|
129
|
+
)x, Num::Integer
|
130
|
+
end
|
131
|
+
|
132
|
+
state :string do
|
133
|
+
rule %r/"/, Str, :pop!
|
134
|
+
rule escapes, Str::Escape
|
135
|
+
rule %r/[^"\\]+/m, Str
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
data/lib/rouge/version.rb
CHANGED
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.
|
4
|
+
version: 3.21.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-
|
11
|
+
date: 2020-07-14 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:
|
@@ -31,12 +31,15 @@ files:
|
|
31
31
|
- lib/rouge/demos/apiblueprint
|
32
32
|
- lib/rouge/demos/applescript
|
33
33
|
- lib/rouge/demos/armasm
|
34
|
+
- lib/rouge/demos/augeas
|
34
35
|
- lib/rouge/demos/awk
|
35
36
|
- lib/rouge/demos/batchfile
|
36
37
|
- lib/rouge/demos/bbcbasic
|
38
|
+
- lib/rouge/demos/bibtex
|
37
39
|
- lib/rouge/demos/biml
|
38
40
|
- lib/rouge/demos/bpf
|
39
41
|
- lib/rouge/demos/brainfuck
|
42
|
+
- lib/rouge/demos/brightscript
|
40
43
|
- lib/rouge/demos/bsl
|
41
44
|
- lib/rouge/demos/c
|
42
45
|
- lib/rouge/demos/ceylon
|
@@ -93,6 +96,7 @@ files:
|
|
93
96
|
- lib/rouge/demos/haskell
|
94
97
|
- lib/rouge/demos/haxe
|
95
98
|
- lib/rouge/demos/hcl
|
99
|
+
- lib/rouge/demos/hlsl
|
96
100
|
- lib/rouge/demos/hocon
|
97
101
|
- lib/rouge/demos/hql
|
98
102
|
- lib/rouge/demos/html
|
@@ -105,6 +109,7 @@ files:
|
|
105
109
|
- lib/rouge/demos/irb
|
106
110
|
- lib/rouge/demos/irb_output
|
107
111
|
- lib/rouge/demos/isbl
|
112
|
+
- lib/rouge/demos/janet
|
108
113
|
- lib/rouge/demos/java
|
109
114
|
- lib/rouge/demos/javascript
|
110
115
|
- lib/rouge/demos/jinja
|
@@ -120,6 +125,7 @@ files:
|
|
120
125
|
- lib/rouge/demos/liquid
|
121
126
|
- lib/rouge/demos/literate_coffeescript
|
122
127
|
- lib/rouge/demos/literate_haskell
|
128
|
+
- lib/rouge/demos/livescript
|
123
129
|
- lib/rouge/demos/llvm
|
124
130
|
- lib/rouge/demos/lua
|
125
131
|
- lib/rouge/demos/lustre
|
@@ -186,6 +192,7 @@ files:
|
|
186
192
|
- lib/rouge/demos/sparql
|
187
193
|
- lib/rouge/demos/sqf
|
188
194
|
- lib/rouge/demos/sql
|
195
|
+
- lib/rouge/demos/ssh
|
189
196
|
- lib/rouge/demos/supercollider
|
190
197
|
- lib/rouge/demos/swift
|
191
198
|
- lib/rouge/demos/tap
|
@@ -202,6 +209,7 @@ files:
|
|
202
209
|
- lib/rouge/demos/vala
|
203
210
|
- lib/rouge/demos/vb
|
204
211
|
- lib/rouge/demos/vcl
|
212
|
+
- lib/rouge/demos/velocity
|
205
213
|
- lib/rouge/demos/verilog
|
206
214
|
- lib/rouge/demos/vhdl
|
207
215
|
- lib/rouge/demos/viml
|
@@ -213,6 +221,7 @@ files:
|
|
213
221
|
- lib/rouge/demos/xquery
|
214
222
|
- lib/rouge/demos/yaml
|
215
223
|
- lib/rouge/demos/yang
|
224
|
+
- lib/rouge/demos/zig
|
216
225
|
- lib/rouge/formatter.rb
|
217
226
|
- lib/rouge/formatters/html.rb
|
218
227
|
- lib/rouge/formatters/html_inline.rb
|
@@ -243,12 +252,15 @@ files:
|
|
243
252
|
- lib/rouge/lexers/apiblueprint.rb
|
244
253
|
- lib/rouge/lexers/apple_script.rb
|
245
254
|
- lib/rouge/lexers/armasm.rb
|
255
|
+
- lib/rouge/lexers/augeas.rb
|
246
256
|
- lib/rouge/lexers/awk.rb
|
247
257
|
- lib/rouge/lexers/batchfile.rb
|
248
258
|
- lib/rouge/lexers/bbcbasic.rb
|
259
|
+
- lib/rouge/lexers/bibtex.rb
|
249
260
|
- lib/rouge/lexers/biml.rb
|
250
261
|
- lib/rouge/lexers/bpf.rb
|
251
262
|
- lib/rouge/lexers/brainfuck.rb
|
263
|
+
- lib/rouge/lexers/brightscript.rb
|
252
264
|
- lib/rouge/lexers/bsl.rb
|
253
265
|
- lib/rouge/lexers/c.rb
|
254
266
|
- lib/rouge/lexers/ceylon.rb
|
@@ -306,6 +318,7 @@ files:
|
|
306
318
|
- lib/rouge/lexers/haskell.rb
|
307
319
|
- lib/rouge/lexers/haxe.rb
|
308
320
|
- lib/rouge/lexers/hcl.rb
|
321
|
+
- lib/rouge/lexers/hlsl.rb
|
309
322
|
- lib/rouge/lexers/hocon.rb
|
310
323
|
- lib/rouge/lexers/hql.rb
|
311
324
|
- lib/rouge/lexers/html.rb
|
@@ -318,6 +331,7 @@ files:
|
|
318
331
|
- lib/rouge/lexers/irb.rb
|
319
332
|
- lib/rouge/lexers/isbl.rb
|
320
333
|
- lib/rouge/lexers/isbl/builtins.rb
|
334
|
+
- lib/rouge/lexers/janet.rb
|
321
335
|
- lib/rouge/lexers/java.rb
|
322
336
|
- lib/rouge/lexers/javascript.rb
|
323
337
|
- lib/rouge/lexers/jinja.rb
|
@@ -334,6 +348,7 @@ files:
|
|
334
348
|
- lib/rouge/lexers/liquid.rb
|
335
349
|
- lib/rouge/lexers/literate_coffeescript.rb
|
336
350
|
- lib/rouge/lexers/literate_haskell.rb
|
351
|
+
- lib/rouge/lexers/livescript.rb
|
337
352
|
- lib/rouge/lexers/llvm.rb
|
338
353
|
- lib/rouge/lexers/llvm/keywords.rb
|
339
354
|
- lib/rouge/lexers/lua.rb
|
@@ -410,6 +425,7 @@ files:
|
|
410
425
|
- lib/rouge/lexers/sqf.rb
|
411
426
|
- lib/rouge/lexers/sqf/keywords.rb
|
412
427
|
- lib/rouge/lexers/sql.rb
|
428
|
+
- lib/rouge/lexers/ssh.rb
|
413
429
|
- lib/rouge/lexers/supercollider.rb
|
414
430
|
- lib/rouge/lexers/swift.rb
|
415
431
|
- lib/rouge/lexers/tap.rb
|
@@ -427,6 +443,7 @@ files:
|
|
427
443
|
- lib/rouge/lexers/vala.rb
|
428
444
|
- lib/rouge/lexers/varnish.rb
|
429
445
|
- lib/rouge/lexers/vb.rb
|
446
|
+
- lib/rouge/lexers/velocity.rb
|
430
447
|
- lib/rouge/lexers/verilog.rb
|
431
448
|
- lib/rouge/lexers/vhdl.rb
|
432
449
|
- lib/rouge/lexers/viml.rb
|
@@ -439,6 +456,7 @@ files:
|
|
439
456
|
- lib/rouge/lexers/xquery.rb
|
440
457
|
- lib/rouge/lexers/yaml.rb
|
441
458
|
- lib/rouge/lexers/yang.rb
|
459
|
+
- lib/rouge/lexers/zig.rb
|
442
460
|
- lib/rouge/plugins/redcarpet.rb
|
443
461
|
- lib/rouge/regex_lexer.rb
|
444
462
|
- lib/rouge/template_lexer.rb
|