rouge 3.30.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/rouge/version.rb CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Rouge
5
5
  def self.version
6
- "3.30.0"
6
+ "4.0.1"
7
7
  end
8
8
  end
data/rouge.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.files = Dir['Gemfile', 'LICENSE', 'rouge.gemspec', 'lib/**/*.rb', 'lib/**/*.yml', 'bin/rougify', 'lib/rouge/demos/*']
17
17
  s.executables = %w(rougify)
18
18
  s.licenses = ['MIT', 'BSD-2-Clause']
19
- s.required_ruby_version = '>= 2.0'
19
+ s.required_ruby_version = '>= 2.7'
20
20
  s.metadata = {
21
21
  "bug_tracker_uri" => "https://github.com/rouge-ruby/rouge/issues",
22
22
  "changelog_uri" => "https://github.com/rouge-ruby/rouge/blob/master/CHANGELOG.md",
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.30.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeanine Adkisson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-30 00:00:00.000000000 Z
11
+ date: 2022-12-17 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:
@@ -185,6 +185,7 @@ files:
185
185
  - lib/rouge/demos/reasonml
186
186
  - lib/rouge/demos/rego
187
187
  - lib/rouge/demos/rescript
188
+ - lib/rouge/demos/rml
188
189
  - lib/rouge/demos/robot_framework
189
190
  - lib/rouge/demos/ruby
190
191
  - lib/rouge/demos/rust
@@ -201,7 +202,6 @@ files:
201
202
  - lib/rouge/demos/smalltalk
202
203
  - lib/rouge/demos/smarty
203
204
  - lib/rouge/demos/sml
204
- - lib/rouge/demos/solidity
205
205
  - lib/rouge/demos/sparql
206
206
  - lib/rouge/demos/sqf
207
207
  - lib/rouge/demos/sql
@@ -435,6 +435,7 @@ files:
435
435
  - lib/rouge/lexers/reasonml.rb
436
436
  - lib/rouge/lexers/rego.rb
437
437
  - lib/rouge/lexers/rescript.rb
438
+ - lib/rouge/lexers/rml.rb
438
439
  - lib/rouge/lexers/robot_framework.rb
439
440
  - lib/rouge/lexers/ruby.rb
440
441
  - lib/rouge/lexers/rust.rb
@@ -452,7 +453,6 @@ files:
452
453
  - lib/rouge/lexers/smalltalk.rb
453
454
  - lib/rouge/lexers/smarty.rb
454
455
  - lib/rouge/lexers/sml.rb
455
- - lib/rouge/lexers/solidity.rb
456
456
  - lib/rouge/lexers/sparql.rb
457
457
  - lib/rouge/lexers/sqf.rb
458
458
  - lib/rouge/lexers/sqf/keywords.rb
@@ -534,7 +534,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
534
534
  requirements:
535
535
  - - ">="
536
536
  - !ruby/object:Gem::Version
537
- version: '2.0'
537
+ version: '2.7'
538
538
  required_rubygems_version: !ruby/object:Gem::Requirement
539
539
  requirements:
540
540
  - - ">="
@@ -1,13 +0,0 @@
1
- pragma solidity ~0.4.15;
2
-
3
- interface IMirror {
4
- function reflect() external payable returns(bool /* ain't I pretty?.. */);
5
- }
6
-
7
- contract Mirror is IMirror {
8
- event logMessage(address indexed sender, uint256 value, uint256 gas, bytes data);
9
-
10
- function () { // no funny stuff
11
- revert();
12
- }
13
- }
@@ -1,185 +0,0 @@
1
- # -*- coding: utf-8 -*- #
2
-
3
- module Rouge
4
- module Lexers
5
- class Solidity < RegexLexer
6
- title "Solidity"
7
- desc "Solidity, an Ethereum smart contract programming language"
8
- tag 'solidity'
9
- filenames '*.sol', '*.solidity'
10
- mimetypes 'text/x-solidity'
11
-
12
- # optional comment or whitespace
13
- ws = %r((?:\s|//.*?\n|/[*].*?[*]/)+)
14
- id = /[a-zA-Z$_][\w$_]*/
15
-
16
- def self.detect?(text)
17
- return true if text.start_with? 'pragma solidity'
18
- end
19
-
20
- # TODO: seperate by "type"
21
- def self.keywords
22
- @keywords ||= Set.new %w(
23
- abstract anonymous as assembly break catch calldata constant
24
- constructor continue contract do delete else emit enum event
25
- external fallback for function hex if indexed interface
26
- internal import is library mapping memory modifier new
27
- override payable public pure pragma private receive return
28
- returns storage struct throw try type using var view virtual
29
- while
30
- )
31
- end
32
-
33
- def self.builtins
34
- return @builtins if @builtins
35
-
36
- @builtins = Set.new %w(
37
- now
38
- false true
39
- balance now selector super this
40
- blockhash gasleft
41
- assert require revert
42
- selfdestruct suicide
43
- call callcode delegatecall
44
- send transfer
45
- addmod ecrecover keccak256 mulmod sha256 sha3 ripemd160
46
- )
47
-
48
- # TODO: use (currently shadowed by catch-all in :statements)
49
- abi = %w(decode encode encodePacked encodeWithSelector encodeWithSignature)
50
- @builtins.merge( abi.map { |i| "abi.#{i}" } )
51
- block = %w(coinbase difficulty gaslimit hash number timestamp)
52
- @builtins.merge( block.map { |i| "block.#{i}" } )
53
- msg = %w(data gas sender sig value)
54
- @builtins.merge( msg.map { |i| "msg.#{i}" } )
55
- tx = %w(gasprice origin)
56
- @builtins.merge( tx.map { |i| "tx.#{i}" } )
57
- end
58
-
59
- def self.constants
60
- @constants ||= Set.new %w(
61
- wei finney szabo ether
62
- seconds minutes hours days weeks years
63
- )
64
- end
65
-
66
- def self.keywords_type
67
- @keywords_type ||= Set.new %w(
68
- address bool byte bytes int string uint
69
- )
70
- end
71
-
72
- def self.reserved
73
- @reserved ||= Set.new %w(
74
- alias after apply auto case copyof default define final fixed
75
- immutable implements in inline let macro match mutable null of
76
- partial promise reference relocatable sealed sizeof static
77
- supports switch typedef typeof ufixed unchecked
78
- )
79
- end
80
-
81
- start { push :bol }
82
-
83
- state :expr_bol do
84
- mixin :inline_whitespace
85
-
86
- rule(//) { pop! }
87
- end
88
-
89
- # :expr_bol is the same as :bol but without labels, since
90
- # labels can only appear at the beginning of a statement.
91
- state :bol do
92
- mixin :expr_bol
93
- end
94
-
95
- # TODO: natspec in comments
96
- state :inline_whitespace do
97
- rule %r/[ \t\r]+/, Text
98
- rule %r/\\\n/, Text # line continuation
99
- rule %r(/\*), Comment::Multiline, :comment_multi
100
- end
101
-
102
- state :whitespace do
103
- rule %r/\n+/m, Text, :bol
104
- rule %r(//(\\.|.)*?\n), Comment::Single, :bol
105
- mixin :inline_whitespace
106
- end
107
-
108
- state :expr_whitespace do
109
- rule %r/\n+/m, Text, :expr_bol
110
- mixin :whitespace
111
- end
112
-
113
- state :statements do
114
- mixin :whitespace
115
- rule %r/(hex)?\"/, Str, :string_double
116
- rule %r/(hex)?\'/, Str, :string_single
117
- rule %r('(\\.|\\[0-7]{1,3}|\\x[a-f0-9]{1,2}|[^\\'\n])')i, Str::Char
118
- rule %r/\d\d*\.\d+([eE]\d+)?/i, Num::Float
119
- rule %r/0x[0-9a-f]+/i, Num::Hex
120
- rule %r/\d+([eE]\d+)?/i, Num::Integer
121
- rule %r(\*/), Error
122
- rule %r([~!%^&*+=\|?:<>/-]), Operator
123
- rule %r/[()\[\],.]/, Punctuation
124
- rule %r/u?fixed\d+x\d+/, Keyword::Reserved
125
- rule %r/bytes\d+/, Keyword::Type
126
- rule %r/u?int\d+/, Keyword::Type
127
- rule id do |m|
128
- name = m[0]
129
-
130
- if self.class.keywords.include? name
131
- token Keyword
132
- elsif self.class.builtins.include? name
133
- token Name::Builtin
134
- elsif self.class.constants.include? name
135
- token Keyword::Constant
136
- elsif self.class.keywords_type.include? name
137
- token Keyword::Type
138
- elsif self.class.reserved.include? name
139
- token Keyword::Reserved
140
- else
141
- token Name
142
- end
143
- end
144
- end
145
-
146
- state :root do
147
- mixin :expr_whitespace
148
- rule(//) { push :statement }
149
- # TODO: function declarations
150
- end
151
-
152
- state :statement do
153
- rule %r/;/, Punctuation, :pop!
154
- mixin :expr_whitespace
155
- mixin :statements
156
- rule %r/[{}]/, Punctuation
157
- end
158
-
159
- state :string_common do
160
- rule %r/\\(u[a-fA-F0-9]{4}|x..|[^x])/, Str::Escape
161
- rule %r/[^\\\"\'\n]+/, Str
162
- rule %r/\\\n/, Str # line continuation
163
- rule %r/\\/, Str # stray backslash
164
- end
165
-
166
- state :string_double do
167
- mixin :string_common
168
- rule %r/\"/, Str, :pop!
169
- rule %r/\'/, Str
170
- end
171
-
172
- state :string_single do
173
- mixin :string_common
174
- rule %r/\'/, Str, :pop!
175
- rule %r/\"/, Str
176
- end
177
-
178
- state :comment_multi do
179
- rule %r(\*/), Comment::Multiline, :pop!
180
- rule %r([^*/]+), Comment::Multiline
181
- rule %r([*/]), Comment::Multiline
182
- end
183
- end
184
- end
185
- end