rouge 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b6d9cbc5bd266812506988d40b94a9de6436f72
4
- data.tar.gz: 7fb0fe3816ed4d0adcc35d780640efbbfe72d6c2
3
+ metadata.gz: 726f116a1b78032be65f6abef810b5b1db42a093
4
+ data.tar.gz: acb0e9e2ad10c72f5e455517f17b71382693016b
5
5
  SHA512:
6
- metadata.gz: 69735105b5246d5d1a230af6c3501ab45b275d9f988a4948034205202e9c2355e1b804566d1458e17940a4dc201332ab8f5d408d236a1f92ed76134651be5d46
7
- data.tar.gz: 5b04ba1b449cc48ae61394bc44a83c43cffd5cf333a9af73a47b476d69fe4676096b4f6a8445ed4a1f9798d2157d9bfdcb5c2676fb615d984fab650b59a957b3
6
+ metadata.gz: cb8b9f3139cc5d9539aa4b539a6c03f1b36630bc2483bac383cce749cff0f8b87565eeaa30ec74a0312098b77ae5e89824b063a89e36d1e53a986ad330a97e6f
7
+ data.tar.gz: 61a48f640f1594d76ff48efe7501a3c5c151d9703d130a6d25db3c318a882b494a0409b9df8103c32fed6fad6768e617d158b84dedfb0b64dbd07dceaf4456e8
data/Gemfile CHANGED
@@ -5,17 +5,21 @@ gemspec
5
5
  gem 'minitest', '~> 4.0'
6
6
  gem 'wrong'
7
7
 
8
+ gem 'rubocop', '~> 0.49.1' if RUBY_VERSION >= '2.0.0'
9
+
8
10
  gem 'rake'
9
11
 
10
12
  # don't try to install redcarpet under jruby
11
13
  gem 'redcarpet', :platforms => :ruby
12
14
 
13
- gem 'pry'
15
+ group :development do
16
+ gem 'pry'
14
17
 
15
- # docs
16
- gem 'yard'
17
- gem 'github-markup'
18
+ # docs
19
+ gem 'yard'
20
+ gem 'github-markup'
18
21
 
19
- # for visual tests
20
- gem 'sinatra'
21
- gem 'shotgun'
22
+ # for visual tests
23
+ gem 'sinatra'
24
+ gem 'shotgun'
25
+ end
@@ -66,7 +66,7 @@ module Rouge
66
66
  return klass.parse(argv) if klass
67
67
 
68
68
  case mode
69
- when '-h', '--help', 'help', '-help'
69
+ when '-h', '--help', 'help', '-help', nil
70
70
  Help.parse(argv)
71
71
  else
72
72
  argv.unshift(mode) if mode
@@ -282,7 +282,7 @@ module Rouge
282
282
  formatter.format(lexer.lex(input), &method(:print))
283
283
  end
284
284
 
285
- private
285
+ private_class_method
286
286
  def self.parse_cgi(str)
287
287
  pairs = CGI.parse(str).map { |k, v| [k.to_sym, v.first] }
288
288
  Hash[pairs]
@@ -374,7 +374,7 @@ module Rouge
374
374
  end
375
375
  end
376
376
 
377
- private
377
+ private_class_method
378
378
  def self.normalize_syntax(argv)
379
379
  out = []
380
380
  argv.each do |arg|
@@ -26,7 +26,7 @@ module Rouge
26
26
  end
27
27
  end
28
28
 
29
- private
29
+
30
30
  TABLE_FOR_ESCAPE_HTML = {
31
31
  '&' => '&',
32
32
  '<' => '&lt;',
@@ -48,9 +48,9 @@ module Rouge
48
48
 
49
49
  def prompt_prefix_regex
50
50
  if allow_comments?
51
- /^[^<#]*?/
51
+ /[^<#]*?/m
52
52
  else
53
- /^.*?/
53
+ /.*?/m
54
54
  end
55
55
  end
56
56
 
@@ -20,7 +20,7 @@ module Rouge
20
20
  rule /#.*$/, Comment::Single
21
21
  rule %r{\b(case|cond|end|bc|lc|if|unless|try|loop|receive|fn|defmodule|
22
22
  defp?|defprotocol|defimpl|defrecord|defmacrop?|defdelegate|
23
- defexception|exit|raise|throw|unless|after|rescue|catch|else)\b(?![?!])|
23
+ defexception|exit|raise|throw|after|rescue|catch|else)\b(?![?!])|
24
24
  (?<!\.)\b(do|\-\>)\b}x, Keyword
25
25
  rule /\b(import|require|use|recur|quote|unquote|super|refer)\b(?![?!])/, Keyword::Namespace
26
26
  rule /(?<!\.)\b(and|not|or|when|xor|in)\b/, Operator::Word
@@ -56,7 +56,7 @@ module Rouge
56
56
  rule /([^\s:]+)( *)(:)( *)([^\r\n]+)(\r?\n|$)/ do |m|
57
57
  key = m[1]
58
58
  value = m[5]
59
- if key.strip.downcase == 'content-type'
59
+ if key.strip.casecmp('content-type').zero?
60
60
  @content_type = value.split(';')[0].downcase
61
61
  end
62
62
 
@@ -263,7 +263,7 @@ module Rouge
263
263
  rule %r(//), Comment, :comments
264
264
 
265
265
  rule /\b#{object}/ do |m|
266
- if m[0].downcase.match /function/
266
+ if m[0].downcase =~ /function/
267
267
  token Keyword::Declaration
268
268
  push :parse_function
269
269
  elsif self.class.igorDeclarations.include? m[0].downcase
@@ -281,7 +281,7 @@ module Rouge
281
281
  elsif self.class.hdf5Operation.include? m[0].downcase
282
282
  token Keyword::Reserved
283
283
  push :operationFlags
284
- elsif m[0].downcase.match /(v|s|w)_[a-z]+[a-z0-9]*/
284
+ elsif m[0].downcase =~ /(v|s|w)_[a-z]+[a-z0-9]*/
285
285
  token Name::Builtin
286
286
  else
287
287
  token Name
@@ -105,7 +105,7 @@ module Rouge
105
105
  state :filters do
106
106
  mixin :whitespace
107
107
 
108
- rule (/\}\}/) { token Punctuation; reset_stack }
108
+ rule(/\}\}/) { token Punctuation; reset_stack }
109
109
 
110
110
  rule /([^\s\|:]+)(:?)(\s*)/ do
111
111
  groups Name::Function, Punctuation, Text::Whitespace
@@ -156,11 +156,11 @@ module Rouge
156
156
  end
157
157
 
158
158
  state :end_of_tag do
159
- rule (/\}\}/) { token Punctuation; reset_stack }
159
+ rule(/\}\}/) { token Punctuation; reset_stack }
160
160
  end
161
161
 
162
162
  state :end_of_block do
163
- rule (/%\}/) { token Punctuation; reset_stack }
163
+ rule(/%\}/) { token Punctuation; reset_stack }
164
164
  end
165
165
 
166
166
  # states for unknown markup
@@ -96,7 +96,7 @@ module Rouge
96
96
  end
97
97
 
98
98
  rule(/\\./m) { delegate @shell }
99
- stop = /\$\(|\(|\)|\n|\\/
99
+ stop = /\$\(|\(|\)|\\|$/
100
100
  rule(/.+?(?=#{stop})/m) { delegate @shell }
101
101
  rule(stop) { delegate @shell }
102
102
  end
@@ -11,7 +11,7 @@ module Rouge
11
11
  mimetypes 'text/x-matlab', 'application/x-matlab'
12
12
 
13
13
  def self.analyze_text(text)
14
- return 0.4 if text.match(/^\s*% /) # % comments are a dead giveaway
14
+ return 0.4 if text =~ /^\s*% / # % comments are a dead giveaway
15
15
  end
16
16
 
17
17
  def self.keywords
@@ -73,7 +73,7 @@ module Rouge
73
73
  getbstat getdualray getiis getiissense getiistype getinfcause getinfeas getlb getloadedlinctrs getloadedmpvars getname getprimalray getprobstat getrange getsensrng getsize getsol getub getvars
74
74
  implies indicator isiisvalid isintegral loadbasis
75
75
  loadmipsol loadprob
76
- maximize, minimize
76
+ maximize minimize
77
77
  postsolve
78
78
  readbasis readdirs readsol refinemipsol rejectintsol repairinfeas resetbasis resetiis resetsol
79
79
  savebasis savemipsol savesol savestate selectsol setbstat setcallback setcbcutoff setgndata setlb setmipdir setmodcut setsol setub setucbdata stopoptimize
@@ -100,15 +100,15 @@ module Rouge
100
100
  getasnumber getchar getcwd getdate getday getdaynum getdays getdirsep
101
101
  getendparse setendparse
102
102
  getenv getfsize getfstat getftime gethour getminute getmonth getmsec getpathsep
103
- getqtype, setqtype
103
+ getqtype setqtype
104
104
  getsecond
105
- getsepchar, setsepchar
105
+ getsepchar setsepchar
106
106
  getsize
107
- getstart, setstart
108
- getsucc, setsucc
107
+ getstart setstart
108
+ getsucc setsucc
109
109
  getsysinfo getsysstat gettime
110
110
  gettmpdir
111
- gettrim, settrim
111
+ gettrim settrim
112
112
  getweekday getyear
113
113
  inserttext isvalid
114
114
  makedir makepath newtar
@@ -139,7 +139,7 @@ module Rouge
139
139
 
140
140
  state :root do
141
141
  mixin :expr_whitespace
142
- rule (//) { push :statement }
142
+ rule(//) { push :statement }
143
143
  rule /^%[a-zA-Z0-9]+/, Comment::Preproc, :statement
144
144
 
145
145
  rule(
@@ -166,7 +166,7 @@ module Rouge
166
166
  push :comma_list
167
167
  end
168
168
 
169
- rule /[\s\n]/, Text, :pop!
169
+ rule /[\s]/, Text, :pop!
170
170
  end
171
171
 
172
172
  state :procedure_call do
@@ -175,7 +175,7 @@ module Rouge
175
175
  rule /(:|\s*\()/, Punctuation, :pop!
176
176
 
177
177
  rule /'/, Name::Function
178
- rule /[^:\('\n\s]+/, Name::Function
178
+ rule /[^:\('\s]+/, Name::Function
179
179
 
180
180
  rule /(?=\s+)/ do
181
181
  token Text
@@ -187,7 +187,7 @@ module Rouge
187
187
  state :procedure_definition do
188
188
  rule /(:|\s*\()/, Punctuation, :pop!
189
189
 
190
- rule /[^:\(\n\s]+/, Name::Function
190
+ rule /[^:\(\s]+/, Name::Function
191
191
 
192
192
  rule /(\s+)/, Text, :pop!
193
193
  end
@@ -53,17 +53,17 @@ module Rouge
53
53
 
54
54
  state :package do
55
55
  rule /[a-zA-Z_]\w*/, Name::Namespace, :pop!
56
- rule (//) { pop! }
56
+ rule(//) { pop! }
57
57
  end
58
58
 
59
59
  state :message do
60
60
  rule /[a-zA-Z_]\w*/, Name::Class, :pop!
61
- rule (//) { pop! }
61
+ rule(//) { pop! }
62
62
  end
63
63
 
64
64
  state :type do
65
65
  rule /[a-zA-Z_]\w*/, Name, :pop!
66
- rule (//) { pop! }
66
+ rule(//) { pop! }
67
67
  end
68
68
  end
69
69
  end
@@ -71,7 +71,7 @@ module Rouge
71
71
  state :objects do
72
72
  rule variable_naming do |m|
73
73
  variable = m[0]
74
- if entities.include?(variable) || ('A'..'Z').include?(variable[0])
74
+ if entities.include?(variable) || ('A'..'Z').cover?(variable[0])
75
75
  token Name::Class
76
76
  else
77
77
  token Keyword::Variable
@@ -46,6 +46,7 @@ module Rouge
46
46
  @name = name
47
47
  @defn = defn
48
48
  @rules = []
49
+ @loaded = false
49
50
  end
50
51
 
51
52
  def to_state(lexer_class)
@@ -102,7 +103,7 @@ module Rouge
102
103
  proc do |stream|
103
104
  puts " yielding #{tok.qualname}, #{stream[0].inspect}" if @debug
104
105
  @output_stream.call(tok, stream[0])
105
- puts " popping stack: #{1}" if @debug
106
+ puts " popping stack: 1" if @debug
106
107
  @stack.pop or raise 'empty stack!'
107
108
  end
108
109
  when :push
@@ -300,7 +301,7 @@ module Rouge
300
301
  # the most common, for now...
301
302
  next if rule.beginning_of_line && !stream.beginning_of_line?
302
303
 
303
- if size = stream.skip(rule.re)
304
+ if (size = stream.skip(rule.re))
304
305
  puts " got #{stream[0].inspect}" if @debug
305
306
 
306
307
  instance_exec(stream, &rule.callback)
@@ -7,10 +7,10 @@ module Rouge
7
7
  end
8
8
 
9
9
  def [](k)
10
- _sup = super
11
- return _sup if own_keys.include?(k)
10
+ value = super
11
+ return value if own_keys.include?(k)
12
12
 
13
- _sup || parent[k]
13
+ value || parent[k]
14
14
  end
15
15
 
16
16
  def parent
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rouge
4
4
  def self.version
5
- "2.1.0"
5
+ "2.1.1"
6
6
  end
7
7
  end
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: 2.1.0
4
+ version: 2.1.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: 2017-06-07 00:00:00.000000000 Z
11
+ date: 2017-06-22 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: