rouge 4.1.0 → 4.1.3
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.
- checksums.yaml +4 -4
- data/lib/rouge/guessers/disambiguation.rb +7 -0
- data/lib/rouge/lexers/dart.rb +6 -6
- data/lib/rouge/lexers/dot.rb +1 -0
- data/lib/rouge/lexers/hcl.rb +3 -2
- data/lib/rouge/lexers/irb.rb +7 -1
- data/lib/rouge/lexers/javascript.rb +8 -1
- data/lib/rouge/lexers/jinja.rb +10 -10
- data/lib/rouge/lexers/liquid.rb +164 -164
- data/lib/rouge/lexers/mosel.rb +0 -4
- data/lib/rouge/lexers/openedge.rb +581 -376
- data/lib/rouge/lexers/php.rb +2 -2
- data/lib/rouge/lexers/python.rb +17 -3
- data/lib/rouge/lexers/ruby.rb +2 -1
- data/lib/rouge/lexers/rust.rb +7 -6
- data/lib/rouge/lexers/shell.rb +6 -2
- data/lib/rouge/lexers/swift.rb +32 -16
- data/lib/rouge/lexers/terraform.rb +0 -8
- data/lib/rouge/lexers/twig.rb +9 -9
- data/lib/rouge/lexers/typescript.rb +2 -2
- data/lib/rouge/lexers/wollok.rb +6 -2
- data/lib/rouge/lexers/xquery.rb +1 -1
- data/lib/rouge/version.rb +1 -1
- metadata +3 -3
data/lib/rouge/lexers/php.rb
CHANGED
|
@@ -66,7 +66,7 @@ module Rouge
|
|
|
66
66
|
|
|
67
67
|
id = /[\p{L}_][\p{L}\p{N}_]*/
|
|
68
68
|
ns = /(?:#{id}\\)+/
|
|
69
|
-
id_with_ns =
|
|
69
|
+
id_with_ns = /\\?(?:#{ns})?#{id}/
|
|
70
70
|
|
|
71
71
|
start do
|
|
72
72
|
case @start_inline
|
|
@@ -273,7 +273,7 @@ module Rouge
|
|
|
273
273
|
state :in_catch do
|
|
274
274
|
rule %r/\(/, Punctuation
|
|
275
275
|
rule %r/\|/, Operator
|
|
276
|
-
rule
|
|
276
|
+
rule id_with_ns, Name::Class
|
|
277
277
|
mixin :escape
|
|
278
278
|
mixin :whitespace
|
|
279
279
|
mixin :return
|
data/lib/rouge/lexers/python.rb
CHANGED
|
@@ -80,6 +80,8 @@ module Rouge
|
|
|
80
80
|
groups Punctuation, Text, Str::Doc
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
+
rule %r/\.\.\.\B$/, Name::Builtin::Pseudo
|
|
84
|
+
|
|
83
85
|
rule %r/[^\S\n]+/, Text
|
|
84
86
|
rule %r(#(.*)?\n?), Comment::Single
|
|
85
87
|
rule %r/[\[\]{}:(),;.]/, Punctuation
|
|
@@ -120,7 +122,7 @@ module Rouge
|
|
|
120
122
|
# TODO: not in python 3
|
|
121
123
|
rule %r/`.*?`/, Str::Backtick
|
|
122
124
|
rule %r/([rfbu]{0,2})('''|"""|['"])/i do |m|
|
|
123
|
-
groups Str::Affix, Str
|
|
125
|
+
groups Str::Affix, Str::Heredoc
|
|
124
126
|
current_string.register type: m[1].downcase, delim: m[2]
|
|
125
127
|
push :generic_string
|
|
126
128
|
end
|
|
@@ -178,11 +180,12 @@ module Rouge
|
|
|
178
180
|
end
|
|
179
181
|
|
|
180
182
|
state :generic_string do
|
|
181
|
-
rule %r
|
|
183
|
+
rule %r/^\s*(>>>|\.\.\.)\B/, Generic::Prompt, :doctest
|
|
184
|
+
rule %r/[^'"\\{]+?/, Str
|
|
182
185
|
rule %r/{{/, Str
|
|
183
186
|
|
|
184
187
|
rule %r/'''|"""|['"]/ do |m|
|
|
185
|
-
token Str
|
|
188
|
+
token Str::Heredoc
|
|
186
189
|
if current_string.delim? m[0]
|
|
187
190
|
current_string.remove
|
|
188
191
|
pop!
|
|
@@ -220,6 +223,17 @@ module Rouge
|
|
|
220
223
|
rule %r/\\./, Str, :pop!
|
|
221
224
|
end
|
|
222
225
|
|
|
226
|
+
state :doctest do
|
|
227
|
+
rule %r/\n\n/, Text, :pop!
|
|
228
|
+
|
|
229
|
+
rule %r/'''|"""/ do
|
|
230
|
+
token Str::Heredoc
|
|
231
|
+
pop!(2) if in_state?(:generic_string) # pop :doctest and :generic_string
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
mixin :root
|
|
235
|
+
end
|
|
236
|
+
|
|
223
237
|
state :generic_interpol do
|
|
224
238
|
rule %r/[^{}!:]+/ do |m|
|
|
225
239
|
recurse m[0]
|
data/lib/rouge/lexers/ruby.rb
CHANGED
|
@@ -42,7 +42,7 @@ module Rouge
|
|
|
42
42
|
rule %r/%([rqswQWxiI])?([^\w\s])/ do |m|
|
|
43
43
|
open = Regexp.escape(m[2])
|
|
44
44
|
close = Regexp.escape(delimiter_map[m[2]] || m[2])
|
|
45
|
-
interp = /[rQWxI]/ === m[1]
|
|
45
|
+
interp = /[rQWxI]/ === m[1] || !m[1]
|
|
46
46
|
toktype = Str::Other
|
|
47
47
|
|
|
48
48
|
puts " open: #{open.inspect}" if @debug
|
|
@@ -188,6 +188,7 @@ module Rouge
|
|
|
188
188
|
|
|
189
189
|
rule %r/(?:#{keywords.join('|')})(?=\W|$)/, Keyword, :expr_start
|
|
190
190
|
rule %r/(?:#{keywords_pseudo.join('|')})\b/, Keyword::Pseudo, :expr_start
|
|
191
|
+
rule %r/(not|and|or)\b/, Operator::Word, :expr_start
|
|
191
192
|
|
|
192
193
|
rule %r(
|
|
193
194
|
(module)
|
data/lib/rouge/lexers/rust.rb
CHANGED
|
@@ -35,17 +35,18 @@ module Rouge
|
|
|
35
35
|
def self.builtins
|
|
36
36
|
@builtins ||= Set.new %w(
|
|
37
37
|
Add BitAnd BitOr BitXor bool c_char c_double c_float char
|
|
38
|
-
c_int clock_t c_long c_longlong
|
|
38
|
+
c_int clock_t c_long c_longlong Copy c_schar c_short
|
|
39
39
|
c_uchar c_uint c_ulong c_ulonglong c_ushort c_void dev_t DIR
|
|
40
|
-
dirent Div
|
|
41
|
-
i16 i32 i64 i8 isize Index ino_t int intptr_t
|
|
42
|
-
Neg
|
|
43
|
-
|
|
40
|
+
dirent Div Eq Err f32 f64 FILE float fpos_t
|
|
41
|
+
i16 i32 i64 i8 isize Index ino_t int intptr_t mode_t Mul
|
|
42
|
+
Neg None off_t Ok Option Ord Owned pid_t ptrdiff_t
|
|
43
|
+
Send Shl Shr size_t Some ssize_t str Sub time_t
|
|
44
44
|
u16 u32 u64 u8 usize uint uintptr_t
|
|
45
|
-
Box Vec String
|
|
45
|
+
Box Vec String Rc Arc
|
|
46
46
|
u128 i128 Result Sync Pin Unpin Sized Drop drop Fn FnMut FnOnce
|
|
47
47
|
Clone PartialEq PartialOrd AsMut AsRef From Into Default
|
|
48
48
|
DoubleEndedIterator ExactSizeIterator Extend IntoIterator Iterator
|
|
49
|
+
FromIterator ToOwned ToString TryFrom TryInto
|
|
49
50
|
)
|
|
50
51
|
end
|
|
51
52
|
|
data/lib/rouge/lexers/shell.rb
CHANGED
|
@@ -9,8 +9,11 @@ module Rouge
|
|
|
9
9
|
|
|
10
10
|
tag 'shell'
|
|
11
11
|
aliases 'bash', 'zsh', 'ksh', 'sh'
|
|
12
|
-
filenames '*.sh', '*.bash', '*.zsh', '*.ksh', '.bashrc',
|
|
13
|
-
'.kshrc', '.profile',
|
|
12
|
+
filenames '*.sh', '*.bash', '*.zsh', '*.ksh', '.bashrc',
|
|
13
|
+
'.kshrc', '.profile',
|
|
14
|
+
'.zshenv', '.zprofile', '.zshrc', '.zlogin', '.zlogout',
|
|
15
|
+
'zshenv', 'zprofile', 'zshrc', 'zlogin', 'zlogout',
|
|
16
|
+
'APKBUILD', 'PKGBUILD', '*.ebuild',
|
|
14
17
|
'*.eclass', '*.exheres-0', '*.exlib'
|
|
15
18
|
|
|
16
19
|
mimetypes 'application/x-sh', 'application/x-shellscript', 'text/x-sh',
|
|
@@ -18,6 +21,7 @@ module Rouge
|
|
|
18
21
|
|
|
19
22
|
def self.detect?(text)
|
|
20
23
|
return true if text.shebang?(/(ba|z|k)?sh/)
|
|
24
|
+
return true if text.start_with?('#compdef', '#autoload')
|
|
21
25
|
end
|
|
22
26
|
|
|
23
27
|
KEYWORDS = %w(
|
data/lib/rouge/lexers/swift.rb
CHANGED
|
@@ -15,28 +15,29 @@ module Rouge
|
|
|
15
15
|
id = /#{id_head}#{id_rest}*/
|
|
16
16
|
|
|
17
17
|
keywords = Set.new %w(
|
|
18
|
-
await break case continue default do else fallthrough if in for return switch
|
|
18
|
+
autoreleasepool await break case catch consume continue default defer discard do each else fallthrough guard if in for repeat return switch throw try where while
|
|
19
19
|
|
|
20
|
-
as dynamicType is new super self Self Type
|
|
20
|
+
as dynamicType is new super self Self Type
|
|
21
21
|
|
|
22
|
-
associativity async didSet get infix inout isolated mutating none nonmutating operator override postfix precedence prefix set unowned weak willSet
|
|
23
|
-
|
|
24
|
-
#available #colorLiteral #column #else #elseif #endif #error #file #fileLiteral #function #if #imageLiteral #line #selector #sourceLocation #warning
|
|
22
|
+
associativity async didSet get infix inout isolated left mutating none nonmutating operator override postfix precedence precedencegroup prefix rethrows right set throws unowned weak willSet
|
|
25
23
|
)
|
|
26
24
|
|
|
27
25
|
declarations = Set.new %w(
|
|
28
|
-
actor class deinit enum convenience extension final func import init internal lazy let nonisolated optional private protocol public required static struct subscript typealias var
|
|
26
|
+
actor any associatedtype borrowing class consuming deinit distributed dynamic enum convenience extension fileprivate final func import indirect init internal lazy let macro nonisolated open optional package private protocol public required some static struct subscript typealias var
|
|
29
27
|
)
|
|
30
28
|
|
|
31
29
|
constants = Set.new %w(
|
|
32
30
|
true false nil
|
|
33
31
|
)
|
|
34
32
|
|
|
35
|
-
start
|
|
33
|
+
start do
|
|
34
|
+
push :bol
|
|
35
|
+
@re_delim = "" # multi-line regex delimiter
|
|
36
|
+
end
|
|
36
37
|
|
|
37
38
|
# beginning of line
|
|
38
39
|
state :bol do
|
|
39
|
-
rule %r
|
|
40
|
+
rule %r/#(?![#"\/]).*/, Comment::Preproc
|
|
40
41
|
|
|
41
42
|
mixin :inline_whitespace
|
|
42
43
|
|
|
@@ -69,8 +70,11 @@ module Rouge
|
|
|
69
70
|
mixin :whitespace
|
|
70
71
|
|
|
71
72
|
rule %r/\$(([1-9]\d*)?\d)/, Name::Variable
|
|
73
|
+
rule %r/\$#{id}/, Name
|
|
74
|
+
rule %r/~Copyable\b/, Keyword::Type
|
|
72
75
|
|
|
73
76
|
rule %r{[()\[\]{}:;,?\\]}, Punctuation
|
|
77
|
+
rule %r{(#*)/(?!\s).*(?<![\s\\])/\1}, Str::Regex
|
|
74
78
|
rule %r([-/=+*%<>!&|^.~]+), Operator
|
|
75
79
|
rule %r/@?"/, Str, :dq
|
|
76
80
|
rule %r/'(\\.|.)'/, Str::Char
|
|
@@ -82,6 +86,7 @@ module Rouge
|
|
|
82
86
|
rule %r{[\d]+(?:_\d+)*}, Num::Integer
|
|
83
87
|
|
|
84
88
|
rule %r/@#{id}/, Keyword::Declaration
|
|
89
|
+
rule %r/##{id}/, Keyword
|
|
85
90
|
|
|
86
91
|
rule %r/(private|internal)(\([ ]*)(\w+)([ ]*\))/ do |m|
|
|
87
92
|
if m[3] == 'set'
|
|
@@ -99,14 +104,6 @@ module Rouge
|
|
|
99
104
|
end
|
|
100
105
|
end
|
|
101
106
|
|
|
102
|
-
rule %r/#available\([^)]+\)/, Keyword::Declaration
|
|
103
|
-
|
|
104
|
-
rule %r/(#(?:selector|keyPath)\()([^)]+?(?:[(].*?[)])?)(\))/ do
|
|
105
|
-
groups Keyword::Declaration, Name::Function, Keyword::Declaration
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
rule %r/#(line|file|column|function|dsohandle)/, Keyword::Declaration
|
|
109
|
-
|
|
110
107
|
rule %r/(let|var)\b(\s*)(#{id})/ do
|
|
111
108
|
groups Keyword, Text, Name::Variable
|
|
112
109
|
end
|
|
@@ -148,6 +145,12 @@ module Rouge
|
|
|
148
145
|
rule %r/(`)(#{id})(`)/ do
|
|
149
146
|
groups Punctuation, Name::Variable, Punctuation
|
|
150
147
|
end
|
|
148
|
+
|
|
149
|
+
rule %r{(#+)/\n} do |m|
|
|
150
|
+
@re_delim = m[1]
|
|
151
|
+
token Str::Regex
|
|
152
|
+
push :re_multi
|
|
153
|
+
end
|
|
151
154
|
end
|
|
152
155
|
|
|
153
156
|
state :tuple do
|
|
@@ -181,6 +184,19 @@ module Rouge
|
|
|
181
184
|
rule %r/[)]/, Punctuation, :pop!
|
|
182
185
|
mixin :root
|
|
183
186
|
end
|
|
187
|
+
|
|
188
|
+
state :re_multi do
|
|
189
|
+
rule %r{^\s*/#+} do |m|
|
|
190
|
+
token Str::Regex
|
|
191
|
+
if m[0].end_with?("/#{@re_delim}")
|
|
192
|
+
@re_delim = ""
|
|
193
|
+
pop!
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
rule %r/#.*/, Comment::Single
|
|
198
|
+
rule %r/./m, Str::Regex
|
|
199
|
+
end
|
|
184
200
|
end
|
|
185
201
|
end
|
|
186
202
|
end
|
data/lib/rouge/lexers/twig.rb
CHANGED
|
@@ -16,24 +16,24 @@ module Rouge
|
|
|
16
16
|
mimetypes 'application/x-twig', 'text/html+twig'
|
|
17
17
|
|
|
18
18
|
def self.keywords
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
@keywords ||= %w(as do extends flush from import include use else starts
|
|
20
|
+
ends with without autoescape endautoescape block
|
|
21
|
+
endblock embed endembed filter endfilter for endfor
|
|
22
|
+
if endif macro endmacro sandbox endsandbox set endset
|
|
23
|
+
spaceless endspaceless)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def self.tests
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
@tests ||= %w(constant defined divisibleby empty even iterable null odd
|
|
28
|
+
sameas)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def self.pseudo_keywords
|
|
32
|
-
|
|
32
|
+
@pseudo_keywords ||= %w(true false none)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def self.word_operators
|
|
36
|
-
|
|
36
|
+
@word_operators ||= %w(b-and b-or b-xor is in and or not)
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -10,12 +10,12 @@ module Rouge
|
|
|
10
10
|
extend TypescriptCommon
|
|
11
11
|
|
|
12
12
|
title "TypeScript"
|
|
13
|
-
desc "TypeScript, a superset of JavaScript"
|
|
13
|
+
desc "TypeScript, a superset of JavaScript (https://www.typescriptlang.org/)"
|
|
14
14
|
|
|
15
15
|
tag 'typescript'
|
|
16
16
|
aliases 'ts'
|
|
17
17
|
|
|
18
|
-
filenames '*.ts', '*.d.ts'
|
|
18
|
+
filenames '*.ts', '*.d.ts', '*.cts', '*.mts'
|
|
19
19
|
|
|
20
20
|
mimetypes 'text/typescript'
|
|
21
21
|
end
|
data/lib/rouge/lexers/wollok.rb
CHANGED
|
@@ -14,8 +14,6 @@ module Rouge
|
|
|
14
14
|
entity_name = /[a-zA-Z][a-zA-Z0-9]*/
|
|
15
15
|
variable_naming = /_?#{entity_name}/
|
|
16
16
|
|
|
17
|
-
entities = []
|
|
18
|
-
|
|
19
17
|
state :whitespaces_and_comments do
|
|
20
18
|
rule %r/\s+/m, Text::Whitespace
|
|
21
19
|
rule %r(//.*$), Comment::Single
|
|
@@ -98,6 +96,12 @@ module Rouge
|
|
|
98
96
|
rule %r/\(|\)|=/, Text
|
|
99
97
|
rule %r/,/, Punctuation
|
|
100
98
|
end
|
|
99
|
+
|
|
100
|
+
private
|
|
101
|
+
|
|
102
|
+
def entities
|
|
103
|
+
@entities ||= []
|
|
104
|
+
end
|
|
101
105
|
end
|
|
102
106
|
end
|
|
103
107
|
end
|
data/lib/rouge/lexers/xquery.rb
CHANGED
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: 4.1.
|
|
4
|
+
version: 4.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeanine Adkisson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-07-31 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:
|
|
@@ -543,7 +543,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
543
543
|
- !ruby/object:Gem::Version
|
|
544
544
|
version: '0'
|
|
545
545
|
requirements: []
|
|
546
|
-
rubygems_version: 3.
|
|
546
|
+
rubygems_version: 3.4.13
|
|
547
547
|
signing_key:
|
|
548
548
|
specification_version: 4
|
|
549
549
|
summary: A pure-ruby colorizer based on pygments
|