rouge 4.2.1 → 4.3.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/iecst +21 -0
- data/lib/rouge/guessers/disambiguation.rb +6 -1
- data/lib/rouge/lexers/brainfuck.rb +1 -0
- data/lib/rouge/lexers/crystal.rb +17 -17
- data/lib/rouge/lexers/eiffel.rb +1 -1
- data/lib/rouge/lexers/hcl.rb +1 -0
- data/lib/rouge/lexers/iecst.rb +92 -0
- data/lib/rouge/lexers/javascript.rb +1 -1
- data/lib/rouge/lexers/markdown.rb +2 -1
- data/lib/rouge/lexers/mathematica.rb +1 -1
- data/lib/rouge/lexers/objective_c.rb +1 -1
- data/lib/rouge/lexers/ruby.rb +18 -18
- data/lib/rouge/lexers/tcl.rb +7 -2
- data/lib/rouge/lexers/toml.rb +2 -1
- data/lib/rouge/lexers/typescript/common.rb +9 -0
- data/lib/rouge/themes/base16.rb +23 -18
- 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 +4 -1
- data/lib/rouge/themes/igor_pro.rb +3 -0
- data/lib/rouge/themes/magritte.rb +1 -0
- data/lib/rouge/themes/molokai.rb +2 -1
- data/lib/rouge/themes/monokai.rb +2 -1
- data/lib/rouge/themes/monokai_sublime.rb +4 -3
- 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/token.rb +2 -1
- data/lib/rouge/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de3a38233be791cfb87fbcee4e092afc1731ed4c2ac0bd9f4e8eb8d889a262c4
|
4
|
+
data.tar.gz: 81d1cf226f514155b861b1f127e55ffdf7cf9d40e2a8c8fa1ee5cd211052aeb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ba279624b6990706218bced834a373cd4d5a15a487c862b07cc7042a924b429cad7518bea407f8ca85bda087395f1fa15abb231f0dd9ff0faa3b2b5e7cb108a
|
7
|
+
data.tar.gz: 93021b4af8761ddc54e22038b6926b7522f67c70c1ba0e7ebdb76ccb21375760f23efe4ebc9c4000bf3bba73499476fb9832596ac3f8eeca5f6f6f626e15069d
|
@@ -0,0 +1,21 @@
|
|
1
|
+
// first-order lag derivative term
|
2
|
+
(*
|
3
|
+
Parameter K must be set to T / (T + T1)
|
4
|
+
*)
|
5
|
+
FUNCTION_BLOCK DT2
|
6
|
+
|
7
|
+
VAR_INPUT
|
8
|
+
IN : REAL;
|
9
|
+
K : REAL;
|
10
|
+
END_VAR
|
11
|
+
VAR_OUTPUT
|
12
|
+
Q : REAL;
|
13
|
+
END_VAR
|
14
|
+
VAR
|
15
|
+
H : REAL := 0.0;
|
16
|
+
END_VAR
|
17
|
+
|
18
|
+
BEGIN
|
19
|
+
Q := IN - H;
|
20
|
+
H := H + K * Q;
|
21
|
+
END_FUNCTION_BLOCK
|
@@ -140,12 +140,17 @@ module Rouge
|
|
140
140
|
|
141
141
|
Puppet
|
142
142
|
end
|
143
|
-
|
143
|
+
|
144
144
|
disambiguate '*.p' do
|
145
145
|
next Prolog if contains?(':-')
|
146
146
|
next Prolog if matches?(/\A\w+(\(\w+\,\s*\w+\))*\./)
|
147
147
|
next OpenEdge
|
148
148
|
end
|
149
|
+
|
150
|
+
disambiguate '*.st' do
|
151
|
+
next IecST if matches?(/^\s*END_/i)
|
152
|
+
next Smalltalk
|
153
|
+
end
|
149
154
|
end
|
150
155
|
end
|
151
156
|
end
|
data/lib/rouge/lexers/crystal.rb
CHANGED
@@ -21,7 +21,7 @@ module Rouge
|
|
21
21
|
rule %r(
|
22
22
|
: # initial :
|
23
23
|
@{0,2} # optional ivar, for :@foo and :@@foo
|
24
|
-
[
|
24
|
+
[\p{Ll}_]\p{Word}*[!?]? # the symbol
|
25
25
|
)xi, Str::Symbol
|
26
26
|
|
27
27
|
# special symbols
|
@@ -35,7 +35,7 @@ module Rouge
|
|
35
35
|
# %-sigiled strings
|
36
36
|
# %(abc), %[abc], %<abc>, %.abc., %r.abc., etc
|
37
37
|
delimiter_map = { '{' => '}', '[' => ']', '(' => ')', '<' => '>' }
|
38
|
-
rule %r/%([rqswQWxiI])?([^\
|
38
|
+
rule %r/%([rqswQWxiI])?([^\p{Word}\s}])/ do |m|
|
39
39
|
open = Regexp.escape(m[2])
|
40
40
|
close = Regexp.escape(delimiter_map[m[2]] || m[2])
|
41
41
|
interp = /[rQWxI]/ === m[1]
|
@@ -77,7 +77,7 @@ module Rouge
|
|
77
77
|
|
78
78
|
state :strings do
|
79
79
|
mixin :symbols
|
80
|
-
rule %r/\b[
|
80
|
+
rule %r/\b[\p{Ll}_]\p{Word}*?[?!]?:\s+/, Str::Symbol, :expr_start
|
81
81
|
rule %r/"/, Str::Double, :simple_string
|
82
82
|
rule %r/(?<!\.)`/, Str::Backtick, :simple_backtick
|
83
83
|
rule %r/(')(\\u[a-fA-F0-9]{4}|\\u\{[a-fA-F0-9]{1,6}\}|\\[abefnrtv])?(\\\\|\\'|[^'])*(')/ do
|
@@ -166,9 +166,9 @@ module Rouge
|
|
166
166
|
rule %r/@\[([^\]]+)\]/, Name::Decorator
|
167
167
|
|
168
168
|
# names
|
169
|
-
rule %r/@@[
|
170
|
-
rule %r/@[
|
171
|
-
rule %r/\$\
|
169
|
+
rule %r/@@[\p{Ll}_]\p{Word}*/i, Name::Variable::Class
|
170
|
+
rule %r/@[\p{Ll}_]\p{Word}*/i, Name::Variable::Instance
|
171
|
+
rule %r/\$\p{Word}+/, Name::Variable::Global
|
172
172
|
rule %r(\$[!@&`'+~=/\\,;.<>_*\$?:"]), Name::Variable::Global
|
173
173
|
rule %r/\$-[0adFiIlpvw]/, Name::Variable::Global
|
174
174
|
rule %r/::/, Operator
|
@@ -181,7 +181,7 @@ module Rouge
|
|
181
181
|
rule %r(
|
182
182
|
(module)
|
183
183
|
(\s+)
|
184
|
-
([
|
184
|
+
([\p{L}_][\p{L}0-9_]*(::[\p{L}_][\p{L}0-9_]*)*)
|
185
185
|
)x do
|
186
186
|
groups Keyword, Text, Name::Namespace
|
187
187
|
end
|
@@ -207,14 +207,14 @@ module Rouge
|
|
207
207
|
# Otherwise, they will be parsed as :method_call
|
208
208
|
rule %r/\.{2,3}/, Operator, :expr_start
|
209
209
|
|
210
|
-
rule %r/[
|
211
|
-
rule %r/(\.|::)(\s*)([
|
210
|
+
rule %r/[\p{Lu}][\p{L}0-9_]*/, Name::Constant, :method_call
|
211
|
+
rule %r/(\.|::)(\s*)([\p{Ll}_]\p{Word}*[!?]?|[*%&^`~+-\/\[<>=])/ do
|
212
212
|
groups Punctuation, Text, Name::Function
|
213
213
|
push :method_call
|
214
214
|
end
|
215
215
|
|
216
|
-
rule %r/[
|
217
|
-
rule %r/[
|
216
|
+
rule %r/[\p{L}_]\p{Word}*[?!]/, Name, :expr_start
|
217
|
+
rule %r/[\p{L}_]\p{Word}*/, Name, :method_call
|
218
218
|
rule %r/\*\*|\/\/|>=|<=|<=>|<<?|>>?|=~|={3}|!~|&&?|\|\||\./,
|
219
219
|
Operator, :expr_start
|
220
220
|
rule %r/{%|%}/, Punctuation
|
@@ -225,7 +225,7 @@ module Rouge
|
|
225
225
|
end
|
226
226
|
|
227
227
|
state :has_heredocs do
|
228
|
-
rule %r/(?<!\
|
228
|
+
rule %r/(?<!\p{Word})(<<[-~]?)(["`']?)([\p{L}_]\p{Word}*)(\2)/ do |m|
|
229
229
|
token Operator, m[1]
|
230
230
|
token Name::Constant, "#{m[2]}#{m[3]}#{m[4]}"
|
231
231
|
@heredoc_queue << [['<<-', '<<~'].include?(m[1]), m[3]]
|
@@ -282,9 +282,9 @@ module Rouge
|
|
282
282
|
rule %r/\s+/, Text
|
283
283
|
rule %r/\(/, Punctuation, :defexpr
|
284
284
|
rule %r(
|
285
|
-
(?:([
|
285
|
+
(?:([\p{L}_]\p{Word}*)(\.))?
|
286
286
|
(
|
287
|
-
[
|
287
|
+
[\p{L}_]\p{Word}*[!?]? |
|
288
288
|
\*\*? | [-+]@? | [/%&\|^`~] | \[\]=? |
|
289
289
|
<<? | >>? | <=>? | >= | ===?
|
290
290
|
)
|
@@ -311,7 +311,7 @@ module Rouge
|
|
311
311
|
goto :expr_start
|
312
312
|
end
|
313
313
|
|
314
|
-
rule %r/[
|
314
|
+
rule %r/[\p{Lu}_]\p{Word}*/, Name::Class, :pop!
|
315
315
|
|
316
316
|
rule(//) { pop! }
|
317
317
|
end
|
@@ -343,7 +343,7 @@ module Rouge
|
|
343
343
|
|
344
344
|
state :string_intp do
|
345
345
|
rule %r/[#][{]/, Str::Interpol, :in_interp
|
346
|
-
rule %r/#(@@?|\$)[
|
346
|
+
rule %r/#(@@?|\$)[\p{Ll}_]\p{Word}*/i, Str::Interpol
|
347
347
|
end
|
348
348
|
|
349
349
|
state :string_intp_escaped do
|
@@ -399,7 +399,7 @@ module Rouge
|
|
399
399
|
rule %r(
|
400
400
|
[?](\\[MC]-)* # modifiers
|
401
401
|
(\\([\\abefnrstv\#"']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})|\S)
|
402
|
-
(?!\
|
402
|
+
(?!\p{Word})
|
403
403
|
)x, Str::Char, :pop!
|
404
404
|
|
405
405
|
# special case for using a single space. Ruby demands that
|
data/lib/rouge/lexers/eiffel.rb
CHANGED
@@ -44,7 +44,7 @@ module Rouge
|
|
44
44
|
rule %r/(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/, Num::Float
|
45
45
|
|
46
46
|
rule %r/:=|<<|>>|\(\||\|\)|->|\.|[{}\[\];(),:?]/, Punctuation::Indicator
|
47
|
-
rule %r/\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[
|
47
|
+
rule %r/\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~≤≥−∀∃¦⟳⟲]/, Operator
|
48
48
|
|
49
49
|
rule %r/[A-Z][\dA-Z_]*/, Name::Class
|
50
50
|
rule %r/[A-Za-z][\dA-Za-z_]*/, Name
|
data/lib/rouge/lexers/hcl.rb
CHANGED
@@ -26,6 +26,7 @@ module Rouge
|
|
26
26
|
state :primitives do
|
27
27
|
rule %r/[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?([kKmMgG]b?)?/, Num::Float
|
28
28
|
rule %r/[0-9]+([kKmMgG]b?)?/, Num::Integer
|
29
|
+
rule %r/[-+*\/!%&<>|=:?]/, Operator
|
29
30
|
|
30
31
|
rule %r/"/, Str::Double, :dq
|
31
32
|
rule %r/'/, Str::Single, :sq
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
class IecST < RegexLexer
|
7
|
+
tag 'iecst'
|
8
|
+
title "IEC 61131-3 Structured Text"
|
9
|
+
desc 'Structured text is a programming language for PLCs (programmable logic controllers).'
|
10
|
+
filenames '*.awl', '*.scl', '*.st'
|
11
|
+
|
12
|
+
mimetypes 'text/x-iecst'
|
13
|
+
|
14
|
+
def self.keywords
|
15
|
+
blocks = %w(
|
16
|
+
PROGRAM CONFIGURATION INITIAL_STEP INTERFACE FUNCTION_BLOCK FUNCTION ACTION TRANSITION
|
17
|
+
TYPE STRUCT STEP NAMESPACE LIBRARY CHANNEL FOLDER RESOURCE
|
18
|
+
VAR_ACCESS VAR_CONFIG VAR_EXTERNAL VAR_GLOBAL VAR_INPUT VAR_IN_OUT VAR_OUTPUT VAR_TEMP VAR
|
19
|
+
CONST METHOD PROPERTY
|
20
|
+
CASE FOR IF REPEAT WHILE
|
21
|
+
)
|
22
|
+
@keywords ||= Set.new %w(
|
23
|
+
AT BEGIN BY CONSTANT CONTINUE DO ELSE ELSIF EXIT EXTENDS FROM GET GOTO IMPLEMENTS JMP
|
24
|
+
NON_RETAIN OF PRIVATE PROTECTED PUBLIC RETAIN RETURN SET TASK THEN TO UNTIL USING WITH
|
25
|
+
__CATCH __ENDTRY __FINALLY __TRY
|
26
|
+
) + blocks + blocks.map {|kw| "END_" + kw}
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.types
|
30
|
+
@types ||= Set.new %w(
|
31
|
+
ANY ARRAY BOOL BYTE POINTER STRING
|
32
|
+
DATE DATE_AND_TIME DT TIME TIME_OF_DAY TOD
|
33
|
+
INT DINT LINT SINT UINT UDINT ULINT USINT
|
34
|
+
WORD DWORD LWORD
|
35
|
+
REAL LREAL
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.literals
|
40
|
+
@literals ||= Set.new %w(TRUE FALSE NULL)
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.operators
|
44
|
+
@operators ||= Set.new %w(AND EQ EXPT GE GT LE LT MOD NE NOT OR XOR)
|
45
|
+
end
|
46
|
+
|
47
|
+
state :whitespace do
|
48
|
+
# Spaces
|
49
|
+
rule %r/\s+/m, Text
|
50
|
+
# // Comments
|
51
|
+
rule %r((//).*$\n?), Comment::Single
|
52
|
+
# (* Comments *)
|
53
|
+
rule %r(\(\*.*?\*\))m, Comment::Multiline
|
54
|
+
# { Comments }
|
55
|
+
rule %r(\{.*?\})m, Comment::Special
|
56
|
+
end
|
57
|
+
|
58
|
+
state :root do
|
59
|
+
mixin :whitespace
|
60
|
+
|
61
|
+
rule %r/'[^']+'/, Literal::String::Single
|
62
|
+
rule %r/"[^"]+"/, Literal::String::Symbol
|
63
|
+
rule %r/%[IQM][XBWDL][\d.]*|%[IQ][\d.]*/, Name::Variable::Magic
|
64
|
+
rule %r/\b(?:D|DT|T|TOD)#[\d_shmd:]*/i, Literal::Date
|
65
|
+
rule %r/\b(?:16#[\d_a-f]+|0x[\d_a-f]+)\b/i, Literal::Number::Hex
|
66
|
+
rule %r/\b2#[01_]+/, Literal::Number::Bin
|
67
|
+
rule %r/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i, Literal::Number::Float
|
68
|
+
rule %r/\b[\d.,_]+/, Literal::Number
|
69
|
+
|
70
|
+
rule %r/\b[A-Z_]+\b/i do |m|
|
71
|
+
name = m[0].upcase
|
72
|
+
if self.class.keywords.include?(name)
|
73
|
+
token Keyword
|
74
|
+
elsif self.class.types.include?(name)
|
75
|
+
token Keyword::Type
|
76
|
+
elsif self.class.literals.include?(name)
|
77
|
+
token Literal
|
78
|
+
elsif self.class.operators.include?(name)
|
79
|
+
token Operator
|
80
|
+
else
|
81
|
+
token Name
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
rule %r/S?R?:?=>?|&&?|\*\*?|<[=>]?|>=?|[-:^\/+#]/, Operator
|
86
|
+
rule %r/\b[a-z_]\w*(?=\s*\()/i, Name::Function
|
87
|
+
rule %r/\b[a-z_]\w*\b/i, Name
|
88
|
+
rule %r/[()\[\].,;]/, Punctuation
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -100,7 +100,7 @@ module Rouge
|
|
100
100
|
|
101
101
|
def self.keywords
|
102
102
|
@keywords ||= Set.new %w(
|
103
|
-
|
103
|
+
async await break case catch continue debugger default delete
|
104
104
|
do else export finally from for if import in instanceof new of
|
105
105
|
return super switch this throw try typeof void while yield
|
106
106
|
)
|
@@ -107,7 +107,8 @@ module Rouge
|
|
107
107
|
push :link
|
108
108
|
end
|
109
109
|
|
110
|
-
rule %r/[*]
|
110
|
+
rule %r/[*]{2}[^* \n][^*\n]*[*]{2}/, Generic::Strong
|
111
|
+
rule %r/[*]{3}[^* \n][^*\n]*[*]{3}/, Generic::EmphStrong
|
111
112
|
rule %r/__#{edot}*?__/, Generic::Strong
|
112
113
|
|
113
114
|
rule %r/[*]#{edot}*?[*]/, Generic::Emph
|
@@ -7,7 +7,7 @@ module Rouge
|
|
7
7
|
title "Mathematica"
|
8
8
|
desc "Wolfram Mathematica, the world's definitive system for modern technical computing."
|
9
9
|
tag 'mathematica'
|
10
|
-
aliases 'wl'
|
10
|
+
aliases 'wl', 'wolfram'
|
11
11
|
filenames '*.m', '*.wl'
|
12
12
|
mimetypes 'application/vnd.wolfram.mathematica.package', 'application/vnd.wolfram.wl'
|
13
13
|
|
@@ -12,7 +12,7 @@ module Rouge
|
|
12
12
|
tag 'objective_c'
|
13
13
|
title "Objective-C"
|
14
14
|
desc 'an extension of C commonly used to write Apple software'
|
15
|
-
aliases 'objc', 'obj-c', 'obj_c', 'objectivec'
|
15
|
+
aliases 'objc', 'obj-c', 'obj_c', 'objectivec', 'objective-c'
|
16
16
|
filenames '*.m', '*.h'
|
17
17
|
|
18
18
|
mimetypes 'text/x-objective_c', 'application/x-objective_c'
|
data/lib/rouge/lexers/ruby.rb
CHANGED
@@ -24,7 +24,7 @@ module Rouge
|
|
24
24
|
rule %r(
|
25
25
|
: # initial :
|
26
26
|
@{0,2} # optional ivar, for :@foo and :@@foo
|
27
|
-
[
|
27
|
+
[\p{Ll}_]\p{Word}*[!?]? # the symbol
|
28
28
|
)xi, Str::Symbol
|
29
29
|
|
30
30
|
# special symbols
|
@@ -39,7 +39,7 @@ module Rouge
|
|
39
39
|
# %-sigiled strings
|
40
40
|
# %(abc), %[abc], %<abc>, %.abc., %r.abc., etc
|
41
41
|
delimiter_map = { '{' => '}', '[' => ']', '(' => ')', '<' => '>' }
|
42
|
-
rule %r/%([rqswQWxiI])?([^\
|
42
|
+
rule %r/%([rqswQWxiI])?([^\p{Word}\s])/ do |m|
|
43
43
|
open = Regexp.escape(m[2])
|
44
44
|
close = Regexp.escape(delimiter_map[m[2]] || m[2])
|
45
45
|
interp = /[rQWxI]/ === m[1] || !m[1]
|
@@ -83,7 +83,7 @@ module Rouge
|
|
83
83
|
|
84
84
|
state :strings do
|
85
85
|
mixin :symbols
|
86
|
-
rule %r/\b[
|
86
|
+
rule %r/\b[\p{Ll}_]\p{Word}*?[?!]?:\s+/, Str::Symbol, :expr_start
|
87
87
|
rule %r/'(\\\\|\\'|[^'])*'/, Str::Single
|
88
88
|
rule %r/"/, Str::Double, :simple_string
|
89
89
|
rule %r/(?<!\.)`/, Str::Backtick, :simple_backtick
|
@@ -177,9 +177,9 @@ module Rouge
|
|
177
177
|
rule decimal, Num::Integer
|
178
178
|
|
179
179
|
# names
|
180
|
-
rule %r/@@[
|
181
|
-
rule %r/@[
|
182
|
-
rule %r/\$\
|
180
|
+
rule %r/@@[\p{Ll}_]\p{Word}*/i, Name::Variable::Class
|
181
|
+
rule %r/@[\p{Ll}_]\p{Word}*/i, Name::Variable::Instance
|
182
|
+
rule %r/\$\p{Word}+/, Name::Variable::Global
|
183
183
|
rule %r(\$[!@&`'+~=/\\,;.<>_*\$?:"]), Name::Variable::Global
|
184
184
|
rule %r/\$-[0adFiIlpvw]/, Name::Variable::Global
|
185
185
|
rule %r/::/, Operator
|
@@ -193,7 +193,7 @@ module Rouge
|
|
193
193
|
rule %r(
|
194
194
|
(module)
|
195
195
|
(\s+)
|
196
|
-
([
|
196
|
+
([\p{L}_][\p{L}0-9_]*(::[\p{L}_][\p{L}0-9_]*)*)
|
197
197
|
)x do
|
198
198
|
groups Keyword, Text, Name::Namespace
|
199
199
|
end
|
@@ -219,14 +219,14 @@ module Rouge
|
|
219
219
|
# Otherwise, they will be parsed as :method_call
|
220
220
|
rule %r/\.{2,3}/, Operator, :expr_start
|
221
221
|
|
222
|
-
rule %r/[
|
223
|
-
rule %r/(\.|::)(\s*)([
|
222
|
+
rule %r/[\p{Lu}][\p{L}0-9_]*/, Name::Constant, :method_call
|
223
|
+
rule %r/(\.|::)(\s*)([\p{Ll}_]\p{Word}*[!?]?|[*%&^`~+-\/\[<>=])/ do
|
224
224
|
groups Punctuation, Text, Name::Function
|
225
225
|
push :method_call
|
226
226
|
end
|
227
227
|
|
228
|
-
rule %r/[
|
229
|
-
rule %r/[
|
228
|
+
rule %r/[\p{L}_]\p{Word}*[?!]/, Name, :expr_start
|
229
|
+
rule %r/[\p{L}_]\p{Word}*/, Name, :method_call
|
230
230
|
rule %r/\*\*|<<?|>>?|>=|<=|<=>|=~|={3}|!~|&&?|\|\||\./,
|
231
231
|
Operator, :expr_start
|
232
232
|
rule %r/[-+\/*%=<>&!^|~]=?/, Operator, :expr_start
|
@@ -236,7 +236,7 @@ module Rouge
|
|
236
236
|
end
|
237
237
|
|
238
238
|
state :has_heredocs do
|
239
|
-
rule %r/(?<!\
|
239
|
+
rule %r/(?<!\p{Word})(<<[-~]?)(["`']?)([\p{L}_]\p{Word}*)(\2)/ do |m|
|
240
240
|
token Operator, m[1]
|
241
241
|
token Name::Constant, "#{m[2]}#{m[3]}#{m[4]}"
|
242
242
|
@heredoc_queue << [['<<-', '<<~'].include?(m[1]), m[3]]
|
@@ -293,9 +293,9 @@ module Rouge
|
|
293
293
|
rule %r/\s+/, Text
|
294
294
|
rule %r/\(/, Punctuation, :defexpr
|
295
295
|
rule %r(
|
296
|
-
(?:([
|
296
|
+
(?:([\p{L}_]\p{Word}*)(\.))?
|
297
297
|
(
|
298
|
-
[
|
298
|
+
[\p{L}_]\p{Word}*[!?]? |
|
299
299
|
\*\*? | [-+]@? | [/%&\|^`~] | \[\]=? |
|
300
300
|
<<? | >>? | <=>? | >= | ===?
|
301
301
|
)
|
@@ -310,7 +310,7 @@ module Rouge
|
|
310
310
|
|
311
311
|
state :classname do
|
312
312
|
rule %r/\s+/, Text
|
313
|
-
rule %r/\
|
313
|
+
rule %r/\p{Word}+(::\p{Word}+)+/, Name::Class
|
314
314
|
|
315
315
|
rule %r/\(/ do
|
316
316
|
token Punctuation
|
@@ -324,7 +324,7 @@ module Rouge
|
|
324
324
|
goto :expr_start
|
325
325
|
end
|
326
326
|
|
327
|
-
rule %r/[
|
327
|
+
rule %r/[\p{Lu}_]\p{Word}*/, Name::Class, :pop!
|
328
328
|
|
329
329
|
rule(//) { pop! }
|
330
330
|
end
|
@@ -364,7 +364,7 @@ module Rouge
|
|
364
364
|
|
365
365
|
state :string_intp do
|
366
366
|
rule %r/[#][{]/, Str::Interpol, :in_interp
|
367
|
-
rule %r/#(@@?|\$)[
|
367
|
+
rule %r/#(@@?|\$)[\p{Ll}_]\p{Word}*/i, Str::Interpol
|
368
368
|
end
|
369
369
|
|
370
370
|
state :string_intp_escaped do
|
@@ -419,7 +419,7 @@ module Rouge
|
|
419
419
|
rule %r(
|
420
420
|
[?](\\[MC]-)* # modifiers
|
421
421
|
(\\([\\abefnrstv\#"']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})|\S)
|
422
|
-
(?!\
|
422
|
+
(?!\p{Word})
|
423
423
|
)x, Str::Char, :pop!
|
424
424
|
|
425
425
|
# special case for using a single space. Ruby demands that
|
data/lib/rouge/lexers/tcl.rb
CHANGED
@@ -57,9 +57,9 @@ module Rouge
|
|
57
57
|
|
58
58
|
def self.gen_command_state(name='')
|
59
59
|
state(:"command#{name}") do
|
60
|
-
|
60
|
+
rule %r/#/, Comment, :comment
|
61
61
|
|
62
|
-
|
62
|
+
mixin :word
|
63
63
|
|
64
64
|
rule %r/(?=#{CHARS[END_WORD]})/ do
|
65
65
|
push :"params#{name}"
|
@@ -163,6 +163,11 @@ module Rouge
|
|
163
163
|
rule %r/\\./m, Str::Escape
|
164
164
|
end
|
165
165
|
|
166
|
+
state :comment do
|
167
|
+
rule %r/.*[^\\]\n/, Comment, :pop!
|
168
|
+
rule %r/.*\\\n/, Comment
|
169
|
+
end
|
170
|
+
|
166
171
|
state :string do
|
167
172
|
rule %r/"/, Str::Double, :pop!
|
168
173
|
mixin :interp
|
data/lib/rouge/lexers/toml.rb
CHANGED
@@ -48,7 +48,8 @@ module Rouge
|
|
48
48
|
groups Name::Property, Text, Punctuation
|
49
49
|
end
|
50
50
|
|
51
|
-
rule %r/\d{4}-\d{2}-\d{2}
|
51
|
+
rule %r/\d{4}-\d{2}-\d{2}(?:[Tt ]\d{2}:\d{2}:\d{2}(?:[Zz]|[+-]\d{2}:\d{2})?)?/, Literal::Date
|
52
|
+
rule %r/\d{2}:\d{2}:\d{2}/, Literal::Date
|
52
53
|
|
53
54
|
rule %r/[+-]?\d+(?:_\d+)*\.\d+(?:_\d+)*(?:[eE][+-]?\d+(?:_\d+)*)?/, Num::Float
|
54
55
|
rule %r/[+-]?\d+(?:_\d+)*[eE][+-]?\d+(?:_\d+)*/, Num::Float
|
@@ -37,6 +37,15 @@ module Rouge
|
|
37
37
|
base.prepend :root do
|
38
38
|
rule %r/[?][.]/, base::Punctuation
|
39
39
|
rule %r/[?]{2}/, base::Operator
|
40
|
+
|
41
|
+
# Positive Examples:
|
42
|
+
# const cat = { name: "Garfield" } satisfies Person;
|
43
|
+
# import {something as thingy} from 'module'
|
44
|
+
# export { foo as default }
|
45
|
+
# ...spreadOperator as const;
|
46
|
+
# Negative Example:
|
47
|
+
# cy.get('kitten').as('friend')
|
48
|
+
rule %r{(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(as)|(satisfies))\s+}, base::Keyword::Declaration
|
40
49
|
end
|
41
50
|
|
42
51
|
base.prepend :statement do
|
data/lib/rouge/themes/base16.rb
CHANGED
@@ -3,27 +3,28 @@
|
|
3
3
|
|
4
4
|
module Rouge
|
5
5
|
module Themes
|
6
|
-
#
|
7
|
-
#
|
6
|
+
# author Chris Kempson
|
7
|
+
# base16 default dark
|
8
|
+
# https://github.com/chriskempson/base16-default-schemes
|
8
9
|
class Base16 < CSSTheme
|
9
10
|
name 'base16'
|
10
11
|
|
11
|
-
palette base00: "#
|
12
|
-
palette base01: "#
|
13
|
-
palette base02: "#
|
14
|
-
palette base03: "#
|
15
|
-
palette base04: "#
|
16
|
-
palette base05: "#
|
17
|
-
palette base06: "#
|
18
|
-
palette base07: "#
|
19
|
-
palette base08: "#
|
20
|
-
palette base09: "#
|
21
|
-
palette base0A: "#
|
22
|
-
palette base0B: "#
|
23
|
-
palette base0C: "#
|
24
|
-
palette base0D: "#
|
25
|
-
palette base0E: "#
|
26
|
-
palette base0F: "#
|
12
|
+
palette base00: "#181818"
|
13
|
+
palette base01: "#282828"
|
14
|
+
palette base02: "#383838"
|
15
|
+
palette base03: "#585858"
|
16
|
+
palette base04: "#b8b8b8"
|
17
|
+
palette base05: "#d8d8d8"
|
18
|
+
palette base06: "#e8e8e8"
|
19
|
+
palette base07: "#f8f8f8"
|
20
|
+
palette base08: "#ab4642"
|
21
|
+
palette base09: "#dc9656"
|
22
|
+
palette base0A: "#f7ca88"
|
23
|
+
palette base0B: "#a1b56c"
|
24
|
+
palette base0C: "#86c1b9"
|
25
|
+
palette base0D: "#7cafc2"
|
26
|
+
palette base0E: "#ba8baf"
|
27
|
+
palette base0F: "#a16946"
|
27
28
|
|
28
29
|
extend HasModes
|
29
30
|
|
@@ -60,6 +61,10 @@ module Rouge
|
|
60
61
|
style Generic::Deleted, :fg => :base08
|
61
62
|
style Generic::Heading, :fg => :base0D, :bg => :base00, :bold => true
|
62
63
|
|
64
|
+
style Generic::Emph, :italic => true
|
65
|
+
style Generic::EmphStrong, :italic => true, :bold => true
|
66
|
+
style Generic::Strong, :bold => true
|
67
|
+
|
63
68
|
style Keyword, :fg => :base0E
|
64
69
|
style Keyword::Constant,
|
65
70
|
Keyword::Type, :fg => :base09
|
data/lib/rouge/themes/bw.rb
CHANGED
@@ -33,6 +33,7 @@ module Rouge
|
|
33
33
|
style Generic::Heading, :bold => true
|
34
34
|
style Generic::Subheading, :bold => true
|
35
35
|
style Generic::Emph, :italic => true
|
36
|
+
style Generic::EmphStrong, :italic => true, :bold => true
|
36
37
|
style Generic::Strong, :bold => true
|
37
38
|
style Generic::Prompt, :bold => true
|
38
39
|
|
@@ -58,6 +58,7 @@ module Rouge
|
|
58
58
|
style Generic::Inserted, :fg => "#00A000"
|
59
59
|
style Generic::Error, :fg => "#FF0000"
|
60
60
|
style Generic::Emph, :italic => true
|
61
|
+
style Generic::EmphStrong, :italic => true, :bold => true
|
61
62
|
style Generic::Strong, :bold => true
|
62
63
|
style Generic::Prompt, :fg => "#c65d09", :bold => true
|
63
64
|
style Generic::Output, :fg => "#888"
|
data/lib/rouge/themes/github.rb
CHANGED
data/lib/rouge/themes/gruvbox.rb
CHANGED
@@ -140,6 +140,10 @@ module Rouge
|
|
140
140
|
style Generic::Deleted, :fg => :red, :bg => :bg0
|
141
141
|
style Generic::Heading, :fg => :green, :bold => true
|
142
142
|
|
143
|
+
style Generic::Emph, :italic => true
|
144
|
+
style Generic::EmphStrong, :italic => true, :bold => true
|
145
|
+
style Generic::Strong, :bold => true
|
146
|
+
|
143
147
|
style Keyword, :fg => :red
|
144
148
|
style Keyword::Constant, :fg => :purple
|
145
149
|
style Keyword::Type, :fg => :yellow
|
@@ -164,7 +168,6 @@ module Rouge
|
|
164
168
|
style Literal::Number, :fg => :purple
|
165
169
|
|
166
170
|
style Literal::String::Symbol, :fg => :blue
|
167
|
-
|
168
171
|
end
|
169
172
|
end
|
170
173
|
end
|
@@ -10,6 +10,9 @@ module Rouge
|
|
10
10
|
style Comment::Preproc, :fg => '#CC00A3'
|
11
11
|
style Comment::Special, :fg => '#CC00A3'
|
12
12
|
style Comment, :fg => '#FF0000'
|
13
|
+
style Generic::Emph, :italic => true
|
14
|
+
style Generic::EmphStrong, :italic => true, :bold => true
|
15
|
+
style Generic::Strong, :bold => true
|
13
16
|
style Keyword::Constant, :fg => '#C34E00'
|
14
17
|
style Keyword::Declaration, :fg => '#0000FF'
|
15
18
|
style Keyword::Reserved, :fg => '#007575'
|
@@ -41,6 +41,7 @@ module Rouge
|
|
41
41
|
style Generic::Deleted, :fg => :cherry
|
42
42
|
style Generic::Inserted, :fg => :forest
|
43
43
|
style Generic::Emph, :italic => true
|
44
|
+
style Generic::EmphStrong, :italic => true, :bold => true
|
44
45
|
style Generic::Strong, :bold => true
|
45
46
|
style Generic::Traceback, :fg => :black, :bg => :lavender
|
46
47
|
style Keyword::Constant, :fg => :forest, :bold => true
|
data/lib/rouge/themes/molokai.rb
CHANGED
@@ -25,7 +25,8 @@ module Rouge
|
|
25
25
|
style Error, :fg => :white, :bg => :grey
|
26
26
|
style Generic::Inserted, :fg => :green
|
27
27
|
style Generic::Deleted, :fg => :red
|
28
|
-
style Generic::Emph, :
|
28
|
+
style Generic::Emph, :italic => true
|
29
|
+
style Generic::EmphStrong, :italic => true, :bold => true
|
29
30
|
style Generic::Error,
|
30
31
|
Generic::Traceback, :fg => :red
|
31
32
|
style Generic::Heading, :fg => :grey
|
data/lib/rouge/themes/monokai.rb
CHANGED
@@ -35,7 +35,8 @@ module Rouge
|
|
35
35
|
style Error, :fg => :carmine, :bg => :very_dark
|
36
36
|
style Generic::Inserted, :fg => :white, :bg => :dimgreen
|
37
37
|
style Generic::Deleted, :fg => :white, :bg => :dimred
|
38
|
-
style Generic::Emph, :
|
38
|
+
style Generic::Emph, :italic => true
|
39
|
+
style Generic::EmphStrong, :italic => true, :bold => true
|
39
40
|
style Generic::Error,
|
40
41
|
Generic::Traceback, :fg => :dark_red
|
41
42
|
style Generic::Heading, :fg => :grey
|
@@ -30,7 +30,9 @@ module Rouge
|
|
30
30
|
style Literal::String::Regex, :fg => :orange
|
31
31
|
style Generic::Output, :fg => :dark_grey
|
32
32
|
style Generic::Prompt, :fg => :emperor
|
33
|
-
style Generic::
|
33
|
+
style Generic::Emph, :italic => true
|
34
|
+
style Generic::EmphStrong, :italic => true, :bold => true
|
35
|
+
style Generic::Strong, :bold => true
|
34
36
|
style Generic::Subheading, :fg => :light_grey
|
35
37
|
style Name::Builtin, :fg => :orange
|
36
38
|
style Comment::Multiline,
|
@@ -42,8 +44,7 @@ module Rouge
|
|
42
44
|
Generic::Error,
|
43
45
|
Generic::Traceback, :fg => :carmine
|
44
46
|
style Generic::Deleted,
|
45
|
-
Generic::Inserted,
|
46
|
-
Generic::Emph, :fg => :dark
|
47
|
+
Generic::Inserted, :fg => :dark
|
47
48
|
style Keyword::Constant,
|
48
49
|
Keyword::Declaration,
|
49
50
|
Keyword::Reserved,
|
data/lib/rouge/themes/pastie.rb
CHANGED
@@ -22,6 +22,7 @@ module Rouge
|
|
22
22
|
style Generic::Inserted, :fg => '#000000', :bg => '#ddffdd'
|
23
23
|
|
24
24
|
style Generic::Emph, :italic => true
|
25
|
+
style Generic::EmphStrong, :italic => true, :bold => true
|
25
26
|
style Generic::Strong, :bold => true
|
26
27
|
|
27
28
|
style Generic::Lineno, :fg => '#888888'
|
@@ -38,6 +38,7 @@ module Rouge
|
|
38
38
|
style Generic::Deleted, :fg => :scarletred2
|
39
39
|
style Generic::Inserted, :fg => :go_get_it
|
40
40
|
style Generic::Emph, :italic => true
|
41
|
+
style Generic::EmphStrong, :italic => true, :bold => true
|
41
42
|
style Generic::Strong, :bold => true
|
42
43
|
style Generic::Traceback, :fg => :eggshell_cloud, :bg => :slate_blue
|
43
44
|
style Keyword::Constant, :fg => :pink_merengue, :bold => true
|
data/lib/rouge/themes/tulip.rb
CHANGED
@@ -33,6 +33,7 @@ module Rouge
|
|
33
33
|
style Generic::Deleted, :fg => :red
|
34
34
|
style Generic::Inserted, :fg => :green
|
35
35
|
style Generic::Emph, :italic => true
|
36
|
+
style Generic::EmphStrong, :italic => true, :bold => true
|
36
37
|
style Generic::Strong, :bold => true
|
37
38
|
style Generic::Traceback,
|
38
39
|
Generic::Lineno, :fg => :white, :bg => :purple
|
data/lib/rouge/token.rb
CHANGED
@@ -172,15 +172,16 @@ module Rouge
|
|
172
172
|
token :Generic, 'g' do
|
173
173
|
token :Deleted, 'gd'
|
174
174
|
token :Emph, 'ge'
|
175
|
+
token :EmphStrong, 'ges'
|
175
176
|
token :Error, 'gr'
|
176
177
|
token :Heading, 'gh'
|
177
178
|
token :Inserted, 'gi'
|
179
|
+
token :Lineno, 'gl'
|
178
180
|
token :Output, 'go'
|
179
181
|
token :Prompt, 'gp'
|
180
182
|
token :Strong, 'gs'
|
181
183
|
token :Subheading, 'gu'
|
182
184
|
token :Traceback, 'gt'
|
183
|
-
token :Lineno, 'gl'
|
184
185
|
end
|
185
186
|
|
186
187
|
# convenience
|
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.
|
4
|
+
version: 4.3.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: 2024-
|
11
|
+
date: 2024-06-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:
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- lib/rouge/demos/hylang
|
110
110
|
- lib/rouge/demos/idlang
|
111
111
|
- lib/rouge/demos/idris
|
112
|
+
- lib/rouge/demos/iecst
|
112
113
|
- lib/rouge/demos/igorpro
|
113
114
|
- lib/rouge/demos/ini
|
114
115
|
- lib/rouge/demos/io
|
@@ -353,6 +354,7 @@ files:
|
|
353
354
|
- lib/rouge/lexers/hylang.rb
|
354
355
|
- lib/rouge/lexers/idlang.rb
|
355
356
|
- lib/rouge/lexers/idris.rb
|
357
|
+
- lib/rouge/lexers/iecst.rb
|
356
358
|
- lib/rouge/lexers/igorpro.rb
|
357
359
|
- lib/rouge/lexers/ini.rb
|
358
360
|
- lib/rouge/lexers/io.rb
|