rouge 3.24.0 → 3.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/lib/rouge/demos/dafny +16 -0
- data/lib/rouge/demos/ocl +4 -0
- data/lib/rouge/demos/rescript +26 -0
- data/lib/rouge/formatter.rb +2 -2
- data/lib/rouge/formatters/html_line_highlighter.rb +2 -4
- data/lib/rouge/formatters/html_line_table.rb +1 -3
- data/lib/rouge/formatters/html_linewise.rb +2 -3
- data/lib/rouge/lexers/batchfile.rb +2 -1
- data/lib/rouge/lexers/ceylon.rb +2 -2
- data/lib/rouge/lexers/cmake.rb +10 -0
- data/lib/rouge/lexers/cpp.rb +2 -2
- data/lib/rouge/lexers/crystal.rb +14 -9
- data/lib/rouge/lexers/dafny.rb +128 -0
- data/lib/rouge/lexers/docker.rb +1 -1
- data/lib/rouge/lexers/eex.rb +2 -2
- data/lib/rouge/lexers/factor.rb +2 -2
- data/lib/rouge/lexers/ghc_core.rb +1 -1
- data/lib/rouge/lexers/javascript.rb +2 -1
- data/lib/rouge/lexers/jsl.rb +24 -13
- data/lib/rouge/lexers/kotlin.rb +1 -1
- data/lib/rouge/lexers/ocaml/common.rb +1 -1
- data/lib/rouge/lexers/ocl.rb +85 -0
- data/lib/rouge/lexers/perl.rb +6 -4
- data/lib/rouge/lexers/powershell.rb +39 -29
- data/lib/rouge/lexers/python.rb +1 -1
- data/lib/rouge/lexers/reasonml.rb +6 -5
- data/lib/rouge/lexers/rescript.rb +119 -0
- data/lib/rouge/lexers/ruby.rb +2 -2
- data/lib/rouge/lexers/rust.rb +77 -17
- data/lib/rouge/lexers/sql.rb +7 -7
- data/lib/rouge/lexers/swift.rb +3 -3
- data/lib/rouge/lexers/velocity.rb +1 -1
- data/lib/rouge/lexers/yaml.rb +1 -1
- data/lib/rouge/themes/base16.rb +1 -0
- data/lib/rouge/themes/bw.rb +1 -0
- data/lib/rouge/themes/colorful.rb +1 -0
- data/lib/rouge/themes/github.rb +1 -0
- data/lib/rouge/themes/gruvbox.rb +2 -0
- data/lib/rouge/themes/igor_pro.rb +1 -0
- data/lib/rouge/themes/magritte.rb +1 -0
- data/lib/rouge/themes/monokai.rb +1 -0
- data/lib/rouge/themes/pastie.rb +1 -0
- data/lib/rouge/themes/thankful_eyes.rb +1 -0
- data/lib/rouge/themes/tulip.rb +1 -0
- data/lib/rouge/version.rb +1 -1
- metadata +9 -3
data/lib/rouge/lexers/perl.rb
CHANGED
@@ -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/\$[\\"'\[\]&`+*.,;=%~?@$!<>(
|
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
|
163
|
-
rule %r
|
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 :
|
135
|
-
|
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
|
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
|
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/
|
149
|
-
|
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
|
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
|
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 :
|
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
|
-
|
185
|
-
|
186
|
-
rule %r
|
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
|
218
|
+
groups Operator, Name, Punctuation
|
208
219
|
push :bracket
|
209
220
|
end
|
210
221
|
|
211
|
-
rule %r/([
|
212
|
-
groups Name
|
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/(\.)
|
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
|
data/lib/rouge/lexers/python.rb
CHANGED
@@ -115,7 +115,7 @@ module Rouge
|
|
115
115
|
# TODO: not in python 3
|
116
116
|
rule %r/`.*?`/, Str::Backtick
|
117
117
|
rule %r/([rfbu]{0,2})('''|"""|['"])/i do |m|
|
118
|
-
|
118
|
+
groups Str::Affix, Str
|
119
119
|
current_string.register type: m[1].downcase, delim: m[2]
|
120
120
|
push :generic_string
|
121
121
|
end
|
@@ -24,7 +24,8 @@ module Rouge
|
|
24
24
|
rule %r/#{@@upper_id}(?=\s*[.])/, Name::Namespace, :dotted
|
25
25
|
rule %r/`#{@@id}/, Name::Tag
|
26
26
|
rule @@upper_id, Name::Class
|
27
|
-
rule %r
|
27
|
+
rule %r(//.*), Comment::Single
|
28
|
+
rule %r(/\*), Comment::Multiline, :comment
|
28
29
|
rule @@id do |m|
|
29
30
|
match = m[0]
|
30
31
|
if self.class.keywords.include? match
|
@@ -55,10 +56,10 @@ module Rouge
|
|
55
56
|
end
|
56
57
|
|
57
58
|
state :comment do
|
58
|
-
rule %r
|
59
|
-
rule %r
|
60
|
-
rule %r
|
61
|
-
rule %r
|
59
|
+
rule %r([^/*]+), Comment::Multiline
|
60
|
+
rule %r(/\*), Comment::Multiline, :comment
|
61
|
+
rule %r(\*/), Comment::Multiline, :pop!
|
62
|
+
rule %r([*/]), Comment::Multiline
|
62
63
|
end
|
63
64
|
end
|
64
65
|
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
load_lexer 'ocaml/common.rb'
|
7
|
+
|
8
|
+
class ReScript < OCamlCommon
|
9
|
+
title "ReScript"
|
10
|
+
desc "The ReScript programming language (rescript-lang.org)"
|
11
|
+
tag 'rescript'
|
12
|
+
filenames '*.res', '*.resi'
|
13
|
+
mimetypes 'text/x-rescript'
|
14
|
+
|
15
|
+
def self.keywords
|
16
|
+
@keywords ||= Set.new(%w(
|
17
|
+
open let rec and as exception assert lazy if else
|
18
|
+
for in to downto while switch when external type private
|
19
|
+
mutable constraint include module of with try import export
|
20
|
+
))
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.types
|
24
|
+
@types ||= Set.new(%w(
|
25
|
+
bool int float char string
|
26
|
+
unit list array option ref exn format
|
27
|
+
))
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.word_operators
|
31
|
+
@word_operators ||= Set.new(%w(mod land lor lxor lsl lsr asr or))
|
32
|
+
end
|
33
|
+
|
34
|
+
state :root do
|
35
|
+
rule %r/\s+/m, Text
|
36
|
+
rule %r([,.:?~\\]), Text
|
37
|
+
|
38
|
+
# Boolean Literal
|
39
|
+
rule %r/\btrue|false\b/, Keyword::Constant
|
40
|
+
|
41
|
+
# Module chain
|
42
|
+
rule %r/#{@@upper_id}(?=\s*[.])/, Name::Namespace, :dotted
|
43
|
+
|
44
|
+
# Decorator
|
45
|
+
rule %r/@#{@@id}(\.#{@@id})*/, Name::Decorator
|
46
|
+
|
47
|
+
# Poly variant
|
48
|
+
rule %r/\##{@@id}/, Name::Class
|
49
|
+
|
50
|
+
# Variant or Module
|
51
|
+
rule @@upper_id, Name::Class
|
52
|
+
|
53
|
+
# Comments
|
54
|
+
rule %r(//.*), Comment::Single
|
55
|
+
rule %r(/\*), Comment::Multiline, :comment
|
56
|
+
|
57
|
+
# Keywords and identifiers
|
58
|
+
rule @@id do |m|
|
59
|
+
match = m[0]
|
60
|
+
if self.class.keywords.include? match
|
61
|
+
token Keyword
|
62
|
+
elsif self.class.word_operators.include? match
|
63
|
+
token Operator::Word
|
64
|
+
elsif self.class.types.include? match
|
65
|
+
token Keyword::Type
|
66
|
+
else
|
67
|
+
token Name
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Braces
|
72
|
+
rule %r/[(){}\[\];]+/, Punctuation
|
73
|
+
|
74
|
+
# Operators
|
75
|
+
rule %r([;_!$%&*+/<=>@^|-]+), Operator
|
76
|
+
|
77
|
+
# Numbers
|
78
|
+
rule %r/-?\d[\d_]*(.[\d_]*)?(e[+-]?\d[\d_]*)/i, Num::Float
|
79
|
+
rule %r/0x\h[\h_]*/i, Num::Hex
|
80
|
+
rule %r/0o[0-7][0-7_]*/i, Num::Oct
|
81
|
+
rule %r/0b[01][01_]*/i, Num::Bin
|
82
|
+
rule %r/\d[\d_]*/, Num::Integer
|
83
|
+
|
84
|
+
# String and Char
|
85
|
+
rule %r/'(?:(\\[\\"'ntbr ])|(\\[0-9]{3})|(\\x\h{2}))'/, Str::Char
|
86
|
+
rule %r/'[^'\/]'/, Str::Char
|
87
|
+
rule %r/'/, Keyword
|
88
|
+
rule %r/"/, Str::Double, :string
|
89
|
+
|
90
|
+
# Interpolated string
|
91
|
+
rule %r/`/ do
|
92
|
+
token Str::Double
|
93
|
+
push :interpolated_string
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
state :comment do
|
98
|
+
rule %r([^/\*]+), Comment::Multiline
|
99
|
+
rule %r(/\*), Comment::Multiline, :comment
|
100
|
+
rule %r(\*/), Comment::Multiline, :pop!
|
101
|
+
rule %r([*/]), Comment::Multiline
|
102
|
+
end
|
103
|
+
|
104
|
+
state :interpolated_string do
|
105
|
+
rule %r/[$]{/, Punctuation, :interpolated_expression
|
106
|
+
rule %r/`/, Str::Double, :pop!
|
107
|
+
rule %r/\\[$`]/, Str::Escape
|
108
|
+
rule %r/[^$`\\]+/, Str::Double
|
109
|
+
rule %r/[\\$]/, Str::Double
|
110
|
+
end
|
111
|
+
|
112
|
+
state :interpolated_expression do
|
113
|
+
rule %r/}/, Punctuation, :pop!
|
114
|
+
mixin :root
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
data/lib/rouge/lexers/ruby.rb
CHANGED
@@ -90,7 +90,7 @@ module Rouge
|
|
90
90
|
end
|
91
91
|
|
92
92
|
state :regex_flags do
|
93
|
-
rule %r/[mixounse]
|
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]
|
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
|
|
data/lib/rouge/lexers/rust.rb
CHANGED
@@ -22,10 +22,10 @@ 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
|
26
|
-
fn for if impl let log loop match mod move mut priv pub pure
|
27
|
-
ref return self static struct true trait type unsafe use
|
28
|
-
while box
|
25
|
+
as assert async await break crate const continue copy do drop dyn else enum extern
|
26
|
+
fail false fn for if impl let log loop macro match mod move mut priv pub pure
|
27
|
+
ref return self Self static struct super true try trait type union unsafe use
|
28
|
+
where while yield box
|
29
29
|
)
|
30
30
|
end
|
31
31
|
|
@@ -40,6 +40,9 @@ module Rouge
|
|
40
40
|
Right Send Shl Shr size_t Some ssize_t str Sub Success time_t
|
41
41
|
u16 u32 u64 u8 usize uint uintptr_t
|
42
42
|
Box Vec String Gc Rc Arc
|
43
|
+
u128 i128 Result Sync Pin Unpin Sized Drop drop Fn FnMut FnOnce
|
44
|
+
Clone PartialEq PartialOrd AsMut AsRef From Into Default
|
45
|
+
DoubleEndedIterator ExactSizeIterator Extend IntoIterator Iterator
|
43
46
|
)
|
44
47
|
end
|
45
48
|
|
@@ -54,12 +57,12 @@ module Rouge
|
|
54
57
|
|
55
58
|
delim_map = { '[' => ']', '(' => ')', '{' => '}' }
|
56
59
|
|
57
|
-
id = /[
|
60
|
+
id = /[\p{XID_Start}_]\p{XID_Continue}*/
|
58
61
|
hex = /[0-9a-f]/i
|
59
62
|
escapes = %r(
|
60
|
-
\\ ([nrt'"\\0] | x#{hex}{2} | u#{hex}{
|
63
|
+
\\ ([nrt'"\\0] | x#{hex}{2} | u\{(#{hex}_*){1,6}\})
|
61
64
|
)x
|
62
|
-
size = /8|16|32|64/
|
65
|
+
size = /8|16|32|64|128|size/
|
63
66
|
|
64
67
|
# Although not officially part of Rust, the rustdoc tool allows code in
|
65
68
|
# comments to begin with `#`. Code like this will be evaluated but not
|
@@ -82,8 +85,62 @@ module Rouge
|
|
82
85
|
|
83
86
|
state :whitespace do
|
84
87
|
rule %r/\s+/, Text
|
85
|
-
|
86
|
-
|
88
|
+
mixin :comments
|
89
|
+
end
|
90
|
+
|
91
|
+
state :comments do
|
92
|
+
# Only 3 slashes are doc comments, `////` and beyond become normal
|
93
|
+
# comments again (for some reason), so match this before the
|
94
|
+
# doc line comments rather than figure out a
|
95
|
+
rule %r(////+[^\n]*), Comment::Single
|
96
|
+
# doc line comments — either inner (`//!`), or outer (`///`).
|
97
|
+
rule %r(//[/!][^\n]*), Comment::Doc
|
98
|
+
# otherwise, `//` is just a plain line comme
|
99
|
+
rule %r(//[^\n]*), Comment::Single
|
100
|
+
# /**/ and /***/ are self-closing block comments, not doc. Because this
|
101
|
+
# is self-closing, it doesn't enter the states for nested comments
|
102
|
+
rule %r(/\*\*\*?/), Comment::Multiline
|
103
|
+
# 3+ stars and it's a normal non-doc block comment.
|
104
|
+
rule %r(/\*\*\*+), Comment::Multiline, :nested_plain_block
|
105
|
+
# `/*!` and `/**` begin doc comments. These nest and can have internal
|
106
|
+
# block/doc comments, but they're still part of the documentation
|
107
|
+
# inside.
|
108
|
+
rule %r(/[*][*!]), Comment::Doc, :nested_doc_block
|
109
|
+
# any other /* is a plain multiline comment
|
110
|
+
rule %r(/[*]), Comment::Multiline, :nested_plain_block
|
111
|
+
end
|
112
|
+
|
113
|
+
# Multiline/block comments fully nest. This is true for ones that are
|
114
|
+
# marked as documentation too. The behavior here is:
|
115
|
+
#
|
116
|
+
# - Anything inside a block doc comment is still included in the
|
117
|
+
# documentation, even if it's a nested non-doc block comment. For
|
118
|
+
# example: `/** /* still docs */ */`
|
119
|
+
# - Anything inside of a block non-doc comment is still just a normal
|
120
|
+
# comment, even if it's a nested block documentation comment. For
|
121
|
+
# example: `/* /** not docs */ */`
|
122
|
+
#
|
123
|
+
# This basically means: if (on the outermost level) the comment starts as
|
124
|
+
# one kind of block comment (either doc/non-doc), then everything inside
|
125
|
+
# of it, including nested block comments of the opposite type, needs to
|
126
|
+
# stay that type.
|
127
|
+
#
|
128
|
+
# Also note that single line comments do nothing anywhere inside of block
|
129
|
+
# comments, thankfully.
|
130
|
+
#
|
131
|
+
# We just define this as two states, because this seems easier than
|
132
|
+
# tracking it with instance vars.
|
133
|
+
[
|
134
|
+
[:nested_plain_block, Comment::Multiline],
|
135
|
+
[:nested_doc_block, Comment::Doc]
|
136
|
+
].each do |state_name, comment_token|
|
137
|
+
state state_name do
|
138
|
+
rule %r(\*/), comment_token, :pop!
|
139
|
+
rule %r(/\*), comment_token, state_name
|
140
|
+
# We only want to eat at most one `[*/]` at a time,
|
141
|
+
# but we can skip past non-`[*/]` in bulk.
|
142
|
+
rule %r([^*/]+|[*/]), comment_token
|
143
|
+
end
|
87
144
|
end
|
88
145
|
|
89
146
|
state :root do
|
@@ -110,6 +167,7 @@ module Rouge
|
|
110
167
|
rule %r/\bmacro_rules!/, Name::Decorator, :macro_rules
|
111
168
|
rule %r/#{id}!/, Name::Decorator, :macro
|
112
169
|
|
170
|
+
rule %r/'static\b/, Keyword
|
113
171
|
rule %r/'#{id}/, Name::Variable
|
114
172
|
rule %r/#{id}/ do |m|
|
115
173
|
name = m[0]
|
@@ -155,31 +213,33 @@ module Rouge
|
|
155
213
|
state :has_literals do
|
156
214
|
# constants
|
157
215
|
rule %r/\b(?:true|false|nil)\b/, Keyword::Constant
|
158
|
-
# characters
|
216
|
+
# characters/bytes
|
159
217
|
rule %r(
|
160
|
-
' (?: #{escapes} | [^\\] ) '
|
218
|
+
b?' (?: #{escapes} | [^\\] ) '
|
161
219
|
)x, Str::Char
|
162
220
|
|
163
|
-
rule %r/"/, Str, :string
|
164
|
-
rule %r/r(#*)".*?"\1/m, Str
|
221
|
+
rule %r/b?"/, Str, :string
|
222
|
+
rule %r/b?r(#*)".*?"\1/m, Str
|
165
223
|
|
166
224
|
# numbers
|
167
|
-
dot = /[.][0-9_]
|
168
|
-
exp = /
|
225
|
+
dot = /[.][0-9][0-9_]*/
|
226
|
+
exp = /[eE][-+]?[0-9_]+/
|
169
227
|
flt = /f32|f64/
|
170
228
|
|
171
229
|
rule %r(
|
172
|
-
[0-9_]
|
230
|
+
[0-9][0-9_]*
|
173
231
|
(#{dot} #{exp}? #{flt}?
|
174
232
|
|#{dot}? #{exp} #{flt}?
|
175
233
|
|#{dot}? #{exp}? #{flt}
|
234
|
+
|[.](?![._\p{XID_Start}])
|
176
235
|
)
|
177
236
|
)x, Num::Float
|
178
237
|
|
179
238
|
rule %r(
|
180
239
|
( 0b[10_]+
|
181
240
|
| 0x[0-9a-fA-F_]+
|
182
|
-
| [0-
|
241
|
+
| 0o[0-7_]+
|
242
|
+
| [0-9][0-9_]*
|
183
243
|
) (u#{size}?|i#{size})?
|
184
244
|
)x, Num::Integer
|
185
245
|
|
data/lib/rouge/lexers/sql.rb
CHANGED
@@ -38,8 +38,8 @@ module Rouge
|
|
38
38
|
DYNAMIC DYNAMIC_FUNCTION DYNAMIC_FUNCTION_CODE EACH ELSE
|
39
39
|
ENCODING ENCRYPTED END END-EXEC EQUALS ESCAPE EVERY EXCEPT
|
40
40
|
ESCEPTION EXCLUDING EXCLUSIVE EXEC EXECUTE EXISTING EXISTS
|
41
|
-
EXPLAIN EXTERNAL EXTRACT FALSE FETCH FINAL FIRST FOR
|
42
|
-
FOREIGN FORTRAN FORWARD FOUND FREE FREEZE FROM FULL FUNCTION
|
41
|
+
EXPLAIN EXTERNAL EXTRACT FALSE FETCH FINAL FIRST FOLLOWING FOR
|
42
|
+
FORCE FOREIGN FORTRAN FORWARD FOUND FREE FREEZE FROM FULL FUNCTION
|
43
43
|
G GENERAL GENERATED GET GLOBAL GO GOTO GRANT GRANTED GROUP
|
44
44
|
GROUPING HANDLER HAVING HIERARCHY HOLD HOST IDENTITY IGNORE
|
45
45
|
ILIKE IMMEDIATE IMMUTABLE IMPLEMENTATION IMPLICIT IN INCLUDING
|
@@ -58,10 +58,10 @@ module Rouge
|
|
58
58
|
ORDINALITY OUT OUTER OUTPUT OVERLAPS OVERLAY OVERRIDING
|
59
59
|
OWNER PAD PARAMETER PARAMETERS PARAMETER_MODE PARAMATER_NAME
|
60
60
|
PARAMATER_ORDINAL_POSITION PARAMETER_SPECIFIC_CATALOG
|
61
|
-
PARAMETER_SPECIFIC_NAME PARAMATER_SPECIFIC_SCHEMA PARTIAL
|
62
|
-
PENDANT PLACING PLI POSITION POSTFIX PREFIX PREORDER
|
61
|
+
PARAMETER_SPECIFIC_NAME PARAMATER_SPECIFIC_SCHEMA PARTIAL PARTITION
|
62
|
+
PASCAL PENDANT PLACING PLI POSITION POSTFIX PREFIX PRECEDING PREORDER
|
63
63
|
PREPARE PRESERVE PRIMARY PRIOR PRIVILEGES PROCEDURAL PROCEDURE
|
64
|
-
PUBLIC READ READS RECHECK RECURSIVE REF REFERENCES REFERENCING
|
64
|
+
PUBLIC RANGE READ READS RECHECK RECURSIVE REF REFERENCES REFERENCING
|
65
65
|
REINDEX RELATIVE RENAME REPEATABLE REPLACE RESET RESTART
|
66
66
|
RESTRICT RESULT RETURN RETURNED_LENGTH RETURNED_OCTET_LENGTH
|
67
67
|
RETURNED_SQLSTATE RETURNS REVOKE RIGHT ROLE ROLLBACK ROLLUP
|
@@ -84,7 +84,7 @@ module Rouge
|
|
84
84
|
USAGE USER USER_DEFINED_TYPE_CATALOG USER_DEFINED_TYPE_NAME
|
85
85
|
USER_DEFINED_TYPE_SCHEMA USING VACUUM VALID VALIDATOR VALUES
|
86
86
|
VARIABLE VERBOSE VERSION VIEW VOLATILE WHEN WHENEVER WHERE
|
87
|
-
WITH WITHOUT WORK WRITE ZONE
|
87
|
+
WINDOW WITH WITHOUT WORK WRITE ZONE
|
88
88
|
)
|
89
89
|
end
|
90
90
|
|
@@ -126,7 +126,7 @@ module Rouge
|
|
126
126
|
end
|
127
127
|
|
128
128
|
rule %r([+*/<>=~!@#%&|?^-]), Operator
|
129
|
-
rule %r/[;:()\[\],.]/, Punctuation
|
129
|
+
rule %r/[;:()\[\]\{\},.]/, Punctuation
|
130
130
|
end
|
131
131
|
|
132
132
|
state :multiline_comments do
|
data/lib/rouge/lexers/swift.rb
CHANGED
@@ -15,17 +15,17 @@ module Rouge
|
|
15
15
|
id = /#{id_head}#{id_rest}*/
|
16
16
|
|
17
17
|
keywords = Set.new %w(
|
18
|
-
break case continue default do else fallthrough if in for return switch where while try catch throw guard defer repeat
|
18
|
+
await break case continue default do else fallthrough if in for return switch where while try catch throw guard defer repeat
|
19
19
|
|
20
20
|
as dynamicType is new super self Self Type __COLUMN__ __FILE__ __FUNCTION__ __LINE__
|
21
21
|
|
22
|
-
associativity didSet get infix inout mutating none nonmutating operator override postfix precedence prefix set unowned weak willSet throws rethrows precedencegroup
|
22
|
+
associativity async didSet get infix inout isolated mutating none nonmutating operator override postfix precedence prefix set unowned weak willSet throws rethrows precedencegroup
|
23
23
|
|
24
24
|
#available #colorLiteral #column #else #elseif #endif #error #file #fileLiteral #function #if #imageLiteral #line #selector #sourceLocation #warning
|
25
25
|
)
|
26
26
|
|
27
27
|
declarations = Set.new %w(
|
28
|
-
class deinit enum convenience extension final func import init internal lazy let optional private protocol public required static struct subscript typealias var dynamic indirect associatedtype open fileprivate some
|
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 dynamic indirect associatedtype open fileprivate some
|
29
29
|
)
|
30
30
|
|
31
31
|
constants = Set.new %w(
|
@@ -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
|
data/lib/rouge/lexers/yaml.rb
CHANGED
@@ -175,7 +175,7 @@ module Rouge
|
|
175
175
|
|
176
176
|
state :block_nodes do
|
177
177
|
# implicit key
|
178
|
-
rule %r/(
|
178
|
+
rule %r/([^#,:?\[\]{}"'\n]+)(:)(?=\s|$)/ do |m|
|
179
179
|
groups Name::Attribute, Punctuation::Indicator
|
180
180
|
set_indent m[0], :implicit => true
|
181
181
|
end
|
data/lib/rouge/themes/base16.rb
CHANGED
data/lib/rouge/themes/bw.rb
CHANGED
@@ -37,6 +37,7 @@ module Rouge
|
|
37
37
|
style Name::Decorator, :fg => "#555", :bold => true
|
38
38
|
|
39
39
|
style Literal::String, :bg => "#fff0f0"
|
40
|
+
style Literal::String::Affix, :fg => "#080", :bold => true
|
40
41
|
style Literal::String::Char, :fg => "#04D"
|
41
42
|
style Literal::String::Doc, :fg => "#D42"
|
42
43
|
style Literal::String::Interpol, :bg => "#eee"
|
data/lib/rouge/themes/github.rb
CHANGED
@@ -35,6 +35,7 @@ module Rouge
|
|
35
35
|
style Literal::Number::Integer, :fg => '#009999'
|
36
36
|
style Literal::Number::Oct, :fg => '#009999'
|
37
37
|
style Literal::Number, :fg => '#009999'
|
38
|
+
style Literal::String::Affix, :fg => '#000000', :bold => true
|
38
39
|
style Literal::String::Backtick, :fg => '#d14'
|
39
40
|
style Literal::String::Char, :fg => '#d14'
|
40
41
|
style Literal::String::Doc, :fg => '#d14'
|
data/lib/rouge/themes/gruvbox.rb
CHANGED
@@ -62,6 +62,7 @@ module Rouge
|
|
62
62
|
Literal::Date, :fg => :forest, :bold => true
|
63
63
|
style Literal::String::Symbol, :fg => :forest
|
64
64
|
style Literal::String, :fg => :wine, :bold => true
|
65
|
+
style Literal::String::Affix, :fg => :royal, :bold => true
|
65
66
|
style Literal::String::Escape,
|
66
67
|
Literal::String::Char,
|
67
68
|
Literal::String::Interpol, :fg => :purple, :bold => true
|
data/lib/rouge/themes/monokai.rb
CHANGED
data/lib/rouge/themes/pastie.rb
CHANGED
@@ -36,6 +36,7 @@ module Rouge
|
|
36
36
|
style Num, :fg => '#0000dd', :bold => true
|
37
37
|
|
38
38
|
style Str, :fg => '#dd2200', :bg => '#fff0f0'
|
39
|
+
style Str::Affix, :fg => '#008800', :bold => true
|
39
40
|
style Str::Escape, :fg => '#0044dd', :bg => '#fff0f0'
|
40
41
|
style Str::Interpol, :fg => '#3333bb', :bg => '#fff0f0'
|
41
42
|
style Str::Other, :fg => '#22bb22', :bg => '#f0fff0'
|
@@ -59,6 +59,7 @@ module Rouge
|
|
59
59
|
Literal::Date,
|
60
60
|
Literal::String::Symbol, :fg => :pink_merengue, :bold => true
|
61
61
|
style Literal::String, :fg => :dune, :bold => true
|
62
|
+
style Literal::String::Affix, :fg => :sandy, :bold => true
|
62
63
|
style Literal::String::Escape,
|
63
64
|
Literal::String::Char,
|
64
65
|
Literal::String::Interpol, :fg => :backlit, :bold => true
|
data/lib/rouge/themes/tulip.rb
CHANGED
@@ -55,6 +55,7 @@ module Rouge
|
|
55
55
|
Literal::Date,
|
56
56
|
Literal::String::Symbol, :fg => :lpurple, :bold => true
|
57
57
|
style Literal::String, :fg => :dune, :bold => true
|
58
|
+
style Literal::String::Affix, :fg => :yellow, :bold => true
|
58
59
|
style Literal::String::Escape,
|
59
60
|
Literal::String::Char,
|
60
61
|
Literal::String::Interpol, :fg => :orange, :bold => true
|