rouge 3.1.1 → 3.2.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.rb +1 -0
- data/lib/rouge/cli.rb +3 -1
- data/lib/rouge/demos/crystal +45 -0
- data/lib/rouge/demos/hcl +7 -0
- data/lib/rouge/demos/terraform +31 -0
- data/lib/rouge/lexers/crystal.rb +429 -0
- data/lib/rouge/lexers/css.rb +1 -1
- data/lib/rouge/lexers/erb.rb +1 -1
- data/lib/rouge/lexers/fortran.rb +2 -2
- data/lib/rouge/lexers/haskell.rb +15 -0
- data/lib/rouge/lexers/hcl.rb +162 -0
- data/lib/rouge/lexers/html.rb +1 -1
- data/lib/rouge/lexers/igorpro.rb +449 -194
- data/lib/rouge/lexers/java.rb +1 -1
- data/lib/rouge/lexers/javascript.rb +1 -0
- data/lib/rouge/lexers/julia.rb +19 -25
- data/lib/rouge/lexers/kotlin.rb +1 -1
- data/lib/rouge/lexers/markdown.rb +1 -1
- data/lib/rouge/lexers/nix.rb +13 -8
- data/lib/rouge/lexers/objective_c.rb +1 -1
- data/lib/rouge/lexers/perl.rb +1 -1
- data/lib/rouge/lexers/scheme.rb +2 -2
- data/lib/rouge/lexers/terraform.rb +104 -0
- data/lib/rouge/lexers/vhdl.rb +1 -1
- data/lib/rouge/version.rb +1 -1
- metadata +9 -3
data/lib/rouge/lexers/java.rb
CHANGED
@@ -20,7 +20,7 @@ module Rouge
|
|
20
20
|
public static strictfp super synchronized throws transient volatile
|
21
21
|
)
|
22
22
|
|
23
|
-
types = %w(boolean byte char double float int long short void)
|
23
|
+
types = %w(boolean byte char double float int long short var void)
|
24
24
|
|
25
25
|
id = /[a-zA-Z_][a-zA-Z0-9_]*/
|
26
26
|
|
data/lib/rouge/lexers/julia.rb
CHANGED
@@ -15,26 +15,20 @@ module Rouge
|
|
15
15
|
end
|
16
16
|
|
17
17
|
BUILTINS = /\b(?:
|
18
|
-
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
| isa | isequal | load
|
24
|
-
| method_exists | Nan | new
|
25
|
-
| ntuple | pi | promote
|
26
|
-
| promote_type | realmax | realmin
|
27
|
-
| sizeof | subtype | system
|
28
|
-
| throw | tuple | typemax
|
29
|
-
| typemin | typeof | uid
|
30
|
-
| whos
|
18
|
+
true | false | missing | nothing
|
19
|
+
| Inf | Inf16 | Inf32 | Inf64
|
20
|
+
| NaN | NaN16 | NaN32 | NaN64
|
21
|
+
| stdout | stderr | stdin | devnull
|
22
|
+
| pi | π | ℯ | im
|
31
23
|
)\b/x
|
32
24
|
|
33
25
|
KEYWORDS = /\b(?:
|
34
26
|
function | return | module | import | export
|
35
27
|
| if | else | elseif | end | for
|
36
|
-
| in | while | try | catch
|
37
|
-
| const
|
28
|
+
| in | isa | while | try | catch
|
29
|
+
| const | local | global | using | struct
|
30
|
+
| mutable struct | abstract type | finally
|
31
|
+
| begin | do | quote | macro | for outer
|
38
32
|
)\b/x
|
39
33
|
|
40
34
|
TYPES = /\b(?:
|
@@ -43,14 +37,13 @@ module Rouge
|
|
43
37
|
| Int32 | UInt32 | Int64
|
44
38
|
| UInt64 | Int128 | UInt128
|
45
39
|
| Float16 | Float32 | Float64
|
46
|
-
| Bool |
|
47
|
-
|
|
48
|
-
|
|
49
|
-
| Char |
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
| Any | Nothing | None
|
40
|
+
| Bool | BigInt | BigFloat
|
41
|
+
| Complex | ComplexF16 | ComplexF32
|
42
|
+
| ComplexF64 | Missing | Nothing
|
43
|
+
| Char | String | SubString
|
44
|
+
| Regex | RegexMatch | Any
|
45
|
+
| Type | DataType | UnionAll
|
46
|
+
| (Abstract)?(Array|Vector|Matrix|VecOrMat)
|
54
47
|
)\b/x
|
55
48
|
|
56
49
|
OPERATORS = / \+ | = | - | \* | \/
|
@@ -63,10 +56,11 @@ module Rouge
|
|
63
56
|
| <= | ≤ | >= | ≥ | \.
|
64
57
|
| :: | <: | -> | \? | \.\*
|
65
58
|
| \.\^ | \.\\ | \.\/ | \\ | <
|
66
|
-
| >
|
59
|
+
| > | ÷ | >: | : | ===
|
60
|
+
| !==
|
67
61
|
/x
|
68
62
|
|
69
|
-
PUNCTUATION = / [ \[ \] { }
|
63
|
+
PUNCTUATION = / [ \[ \] { } \( \) , ; @ ] /x
|
70
64
|
|
71
65
|
|
72
66
|
state :root do
|
data/lib/rouge/lexers/kotlin.rb
CHANGED
data/lib/rouge/lexers/nix.rb
CHANGED
@@ -52,17 +52,22 @@ module Rouge
|
|
52
52
|
end
|
53
53
|
|
54
54
|
state :string do
|
55
|
-
rule /"/, Str::Double, :
|
56
|
-
rule /''/, Str::Double, :
|
55
|
+
rule /"/, Str::Double, :double_quoted_string
|
56
|
+
rule /''/, Str::Double, :indented_string
|
57
57
|
end
|
58
58
|
|
59
59
|
state :string_content do
|
60
|
+
rule /\\./, Str::Escape
|
61
|
+
rule /\$\$/, Str::Escape
|
60
62
|
rule /\${/, Str::Interpol, :string_interpolated_arg
|
61
|
-
mixin :escaped_sequence
|
62
63
|
end
|
63
64
|
|
64
|
-
state :
|
65
|
-
rule
|
65
|
+
state :indented_string_content do
|
66
|
+
rule /'''/, Str::Escape
|
67
|
+
rule /''\$/, Str::Escape
|
68
|
+
rule /\$\$/, Str::Escape
|
69
|
+
rule /''\\./, Str::Escape
|
70
|
+
rule /\${/, Str::Interpol, :string_interpolated_arg
|
66
71
|
end
|
67
72
|
|
68
73
|
state :string_interpolated_arg do
|
@@ -70,13 +75,13 @@ module Rouge
|
|
70
75
|
rule /}/, Str::Interpol, :pop!
|
71
76
|
end
|
72
77
|
|
73
|
-
state :
|
74
|
-
mixin :
|
78
|
+
state :indented_string do
|
79
|
+
mixin :indented_string_content
|
75
80
|
rule /''/, Str::Double, :pop!
|
76
81
|
rule /./, Str::Double
|
77
82
|
end
|
78
83
|
|
79
|
-
state :
|
84
|
+
state :double_quoted_string do
|
80
85
|
mixin :string_content
|
81
86
|
rule /"/, Str::Double, :pop!
|
82
87
|
rule /./, Str::Double
|
@@ -8,7 +8,7 @@ module Rouge
|
|
8
8
|
tag 'objective_c'
|
9
9
|
title "Objective-C"
|
10
10
|
desc 'an extension of C commonly used to write Apple software'
|
11
|
-
aliases 'objc'
|
11
|
+
aliases 'objc', 'obj-c', 'obj_c'
|
12
12
|
filenames '*.m', '*.h'
|
13
13
|
|
14
14
|
mimetypes 'text/x-objective_c', 'application/x-objective_c'
|
data/lib/rouge/lexers/perl.rb
CHANGED
data/lib/rouge/lexers/scheme.rb
CHANGED
@@ -0,0 +1,104 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
|
3
|
+
module Rouge
|
4
|
+
module Lexers
|
5
|
+
load_lexer 'hcl.rb'
|
6
|
+
|
7
|
+
class Terraform < Hcl
|
8
|
+
title "Terraform"
|
9
|
+
desc "Terraform HCL Interpolations"
|
10
|
+
|
11
|
+
tag 'terraform'
|
12
|
+
aliases 'tf'
|
13
|
+
filenames '*.tf'
|
14
|
+
|
15
|
+
def self.keywords
|
16
|
+
@keywords ||= Set.new %w(
|
17
|
+
terraform module provider variable resource data provisioner output
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.declarations
|
22
|
+
@declarations ||= Set.new %w(
|
23
|
+
var local
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.reserved
|
28
|
+
@reserved ||= Set.new %w()
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.constants
|
32
|
+
@constants ||= Set.new %w(true false null)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.builtins
|
36
|
+
@builtins ||= %w()
|
37
|
+
end
|
38
|
+
|
39
|
+
state :strings do
|
40
|
+
rule /\\./, Str::Escape
|
41
|
+
rule /\$\{/ do
|
42
|
+
token Keyword
|
43
|
+
push :interpolation
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
state :dq do
|
48
|
+
rule /[^\\"\$]+/, Str::Double
|
49
|
+
mixin :strings
|
50
|
+
rule /"/, Str::Double, :pop!
|
51
|
+
end
|
52
|
+
|
53
|
+
state :sq do
|
54
|
+
rule /[^\\'\$]+/, Str::Single
|
55
|
+
mixin :strings
|
56
|
+
rule /'/, Str::Single, :pop!
|
57
|
+
end
|
58
|
+
|
59
|
+
state :heredoc do
|
60
|
+
rule /\n/, Str::Heredoc, :heredoc_nl
|
61
|
+
rule /[^$\n\$]+/, Str::Heredoc
|
62
|
+
rule /[$]/, Str::Heredoc
|
63
|
+
mixin :strings
|
64
|
+
end
|
65
|
+
|
66
|
+
state :interpolation do
|
67
|
+
rule /\}/ do
|
68
|
+
token Keyword
|
69
|
+
pop!
|
70
|
+
end
|
71
|
+
|
72
|
+
mixin :expression
|
73
|
+
end
|
74
|
+
|
75
|
+
id = /[$a-z_\-][a-z0-9_\-]*/io
|
76
|
+
|
77
|
+
state :expression do
|
78
|
+
mixin :primitives
|
79
|
+
rule /\s+/, Text
|
80
|
+
|
81
|
+
rule %r(\+\+ | -- | ~ | && | \|\| | \\(?=\n) | << | >>>? | == | != )x, Operator
|
82
|
+
rule %r([-<>+*%&|\^/!=?:]=?), Operator
|
83
|
+
rule /[(\[,]/, Punctuation
|
84
|
+
rule /[)\].]/, Punctuation
|
85
|
+
|
86
|
+
rule id do |m|
|
87
|
+
if self.class.keywords.include? m[0]
|
88
|
+
token Keyword
|
89
|
+
elsif self.class.declarations.include? m[0]
|
90
|
+
token Keyword::Declaration
|
91
|
+
elsif self.class.reserved.include? m[0]
|
92
|
+
token Keyword::Reserved
|
93
|
+
elsif self.class.constants.include? m[0]
|
94
|
+
token Keyword::Constant
|
95
|
+
elsif self.class.builtins.include? m[0]
|
96
|
+
token Name::Builtin
|
97
|
+
else
|
98
|
+
token Name::Other
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
data/lib/rouge/lexers/vhdl.rb
CHANGED
@@ -27,7 +27,7 @@ module Rouge
|
|
27
27
|
@keywords_type ||= Set.new %w(
|
28
28
|
bit bit_vector boolean boolean_vector character integer integer_vector natural positive
|
29
29
|
real real_vector severity_level signed std_logic std_logic_vector std_ulogic
|
30
|
-
std_ulogic_vector string unsigned time
|
30
|
+
std_ulogic_vector string unsigned time time_vector
|
31
31
|
)
|
32
32
|
end
|
33
33
|
|
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.2.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: 2018-
|
11
|
+
date: 2018-08-02 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:
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- lib/rouge/demos/console
|
43
43
|
- lib/rouge/demos/coq
|
44
44
|
- lib/rouge/demos/cpp
|
45
|
+
- lib/rouge/demos/crystal
|
45
46
|
- lib/rouge/demos/csharp
|
46
47
|
- lib/rouge/demos/css
|
47
48
|
- lib/rouge/demos/d
|
@@ -68,6 +69,7 @@ files:
|
|
68
69
|
- lib/rouge/demos/haml
|
69
70
|
- lib/rouge/demos/handlebars
|
70
71
|
- lib/rouge/demos/haskell
|
72
|
+
- lib/rouge/demos/hcl
|
71
73
|
- lib/rouge/demos/html
|
72
74
|
- lib/rouge/demos/http
|
73
75
|
- lib/rouge/demos/hylang
|
@@ -139,6 +141,7 @@ files:
|
|
139
141
|
- lib/rouge/demos/swift
|
140
142
|
- lib/rouge/demos/tap
|
141
143
|
- lib/rouge/demos/tcl
|
144
|
+
- lib/rouge/demos/terraform
|
142
145
|
- lib/rouge/demos/tex
|
143
146
|
- lib/rouge/demos/toml
|
144
147
|
- lib/rouge/demos/tsx
|
@@ -193,6 +196,7 @@ files:
|
|
193
196
|
- lib/rouge/lexers/console.rb
|
194
197
|
- lib/rouge/lexers/coq.rb
|
195
198
|
- lib/rouge/lexers/cpp.rb
|
199
|
+
- lib/rouge/lexers/crystal.rb
|
196
200
|
- lib/rouge/lexers/csharp.rb
|
197
201
|
- lib/rouge/lexers/css.rb
|
198
202
|
- lib/rouge/lexers/d.rb
|
@@ -220,6 +224,7 @@ files:
|
|
220
224
|
- lib/rouge/lexers/haml.rb
|
221
225
|
- lib/rouge/lexers/handlebars.rb
|
222
226
|
- lib/rouge/lexers/haskell.rb
|
227
|
+
- lib/rouge/lexers/hcl.rb
|
223
228
|
- lib/rouge/lexers/html.rb
|
224
229
|
- lib/rouge/lexers/http.rb
|
225
230
|
- lib/rouge/lexers/hylang.rb
|
@@ -295,6 +300,7 @@ files:
|
|
295
300
|
- lib/rouge/lexers/swift.rb
|
296
301
|
- lib/rouge/lexers/tap.rb
|
297
302
|
- lib/rouge/lexers/tcl.rb
|
303
|
+
- lib/rouge/lexers/terraform.rb
|
298
304
|
- lib/rouge/lexers/tex.rb
|
299
305
|
- lib/rouge/lexers/toml.rb
|
300
306
|
- lib/rouge/lexers/tsx.rb
|
@@ -356,7 +362,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
356
362
|
version: '0'
|
357
363
|
requirements: []
|
358
364
|
rubyforge_project: rouge
|
359
|
-
rubygems_version: 2.
|
365
|
+
rubygems_version: 2.4.5.1
|
360
366
|
signing_key:
|
361
367
|
specification_version: 4
|
362
368
|
summary: A pure-ruby colorizer based on pygments
|