ruby_parser 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ruby_parser might be problematic. Click here for more details.

data.tar.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,16 @@
1
+ === 3.1.1 / 2012-12-19
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Added MOVE_TIMEOUT env var for ruby_parse_extract_error to move slow files to a sibling directory
6
+
7
+ * 4 bug fixes:
8
+
9
+ * 1.9: Fixed lexing of "0o". (whitequark)
10
+ * 1.9: Fixed parsing of unary plus on literals. (whitequark)
11
+ * Added timeout arg to RubyParser#process to pass through to the real parser
12
+ * Updated Synopsis to reflect new options for running RP. (louismullie)
13
+
1
14
  === 3.1.0 / 2012-12-06
2
15
 
3
16
  * 2 minor enhancements:
data/README.txt CHANGED
@@ -43,7 +43,12 @@ becomes:
43
43
 
44
44
  == SYNOPSIS:
45
45
 
46
- Ruby19Parser.new.parse "1+1"
46
+ RubyParser.new.parse "1+1"
47
+ # => s(:call, s(:lit, 1), :+, s(:lit, 1))
48
+
49
+ You can also use Ruby19Parser, Ruby18Parser, or RubyParser.for_current_ruby:
50
+
51
+ RubyParser.for_current_ruby.parse "1+1"
47
52
  # => s(:call, s(:lit, 1), :+, s(:lit, 1))
48
53
 
49
54
  == REQUIREMENTS:
@@ -4,11 +4,14 @@ $d ||= false
4
4
  $d ||= ENV["DELETE"]
5
5
  $t ||= false
6
6
  $t ||= ENV["DELETE_TIMEOUT"]
7
+ $m ||= false
8
+ $m ||= ENV["MOVE_TIMEOUT"]
7
9
  $q ||= false
8
10
  $q ||= ENV["QUIET"]
9
11
 
10
12
  require 'rubygems'
11
13
  require 'ruby_parser'
14
+ require 'fileutils'
12
15
 
13
16
  ARGV.push "-" if ARGV.empty?
14
17
 
@@ -96,7 +99,14 @@ def process file
96
99
  rescue Timeout::Error
97
100
  $exit = 1
98
101
  warn "TIMEOUT parsing #{file}. Skipping."
99
- File.unlink file if $t
102
+
103
+ if $m then
104
+ dir = File.join $m, File.dirname(file)
105
+ FileUtils.mkdir_p dir
106
+ FileUtils.move file, dir
107
+ elsif $t then
108
+ File.unlink file
109
+ end
100
110
  rescue StandardError, SyntaxError, Racc::ParseError => e
101
111
  $exit = 1
102
112
  warn ""
data/lib/ruby19_parser.rb CHANGED
@@ -4117,11 +4117,7 @@ def _reduce_215(val, _values, result)
4117
4117
  end
4118
4118
 
4119
4119
  def _reduce_216(val, _values, result)
4120
- if val[1][0] == :lit then
4121
- result = val[1]
4122
- else
4123
- result = new_call val[1], :"+@"
4124
- end
4120
+ result = new_call val[1], :"+@"
4125
4121
 
4126
4122
  result
4127
4123
  end
data/lib/ruby19_parser.y CHANGED
@@ -671,11 +671,7 @@ rule
671
671
  }
672
672
  | tUPLUS arg
673
673
  {
674
- if val[1][0] == :lit then
675
- result = val[1]
676
- else
677
- result = new_call val[1], :"+@"
678
- end
674
+ result = new_call val[1], :"+@"
679
675
  }
680
676
  | tUMINUS arg
681
677
  {
data/lib/ruby_lexer.rb CHANGED
@@ -188,7 +188,7 @@ class RubyLexer
188
188
  self.string_buffer = []
189
189
 
190
190
  case
191
- when src.scan(/(-?)(['"`])(.*?)\2/) then
191
+ when src.scan(/(-?)([\'\"\`])(.*?)\2/) then
192
192
  term = src[2]
193
193
  func |= STR_FUNC_INDENT unless src[1].empty?
194
194
  func |= case term
@@ -200,7 +200,7 @@ class RubyLexer
200
200
  STR_XQUOTE
201
201
  end
202
202
  string_buffer << src[3]
203
- when src.scan(/-?(['"`])(?!\1*\Z)/) then
203
+ when src.scan(/-?([\'\"\`])(?!\1*\Z)/) then
204
204
  rb_compile_error "unterminated here document identifier"
205
205
  when src.scan(/(-?)(\w+)/) then
206
206
  term = '"'
@@ -249,6 +249,9 @@ class RubyLexer
249
249
 
250
250
  def int_with_base base
251
251
  rb_compile_error "Invalid numeric format" if src.matched =~ /__/
252
+ rb_compile_error "numeric literal without digits" if
253
+ ruby19 and src.matched =~ /0o/i
254
+
252
255
  self.yacc_value = src.matched.to_i(base)
253
256
  return :tINTEGER
254
257
  end
@@ -108,7 +108,7 @@ class RPStringScanner < StringScanner
108
108
  end
109
109
 
110
110
  module RubyParserStuff
111
- VERSION = '3.1.0' unless constants.include? "VERSION" # SIGH
111
+ VERSION = '3.1.1' unless constants.include? "VERSION" # SIGH
112
112
 
113
113
  attr_accessor :lexer, :in_def, :in_single, :file
114
114
  attr_reader :env, :comments
@@ -1286,10 +1286,10 @@ class RubyParser
1286
1286
  @p19 = Ruby19Parser.new
1287
1287
  end
1288
1288
 
1289
- def process(s, f = "(string)") # parens for emacs *sigh*
1290
- @p19.process s, f
1289
+ def process(s, f = "(string)", t = 10) # parens for emacs *sigh*
1290
+ @p19.process s, f, t
1291
1291
  rescue Racc::ParseError
1292
- @p18.process s, f
1292
+ @p18.process s, f, t
1293
1293
  end
1294
1294
 
1295
1295
  alias :parse :process
@@ -1764,4 +1764,11 @@ class TestRuby19Parser < RubyParserTestCase
1764
1764
  rb = "f::(42)"
1765
1765
  assert_parse rb, pt
1766
1766
  end
1767
+
1768
+ def test_unary_plus_on_literal
1769
+ rb = "+:a"
1770
+ pt = s(:call, s(:lit, :a), :+@)
1771
+
1772
+ assert_parse rb, pt
1773
+ end
1767
1774
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_parser
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
- - 0
10
- version: 3.1.0
9
+ - 1
10
+ version: 3.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Davis
@@ -36,7 +36,7 @@ cert_chain:
36
36
  FBHgymkyj/AOSqKRIpXPhjC6
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2012-12-07 00:00:00 Z
39
+ date: 2012-12-19 00:00:00 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sexp_processor
@@ -107,11 +107,11 @@ dependencies:
107
107
  requirements:
108
108
  - - ~>
109
109
  - !ruby/object:Gem::Version
110
- hash: 1
110
+ hash: 15
111
111
  segments:
112
112
  - 3
113
- - 3
114
- version: "3.3"
113
+ - 4
114
+ version: "3.4"
115
115
  type: :development
116
116
  version_requirements: *id005
117
117
  description: |-
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- �ۇ�o�����?�^iuvS�?��bx
1
+ �����”߱PjGdz�ޠ�;�?��Ns2��'rB;�]�%�a��eEJ9v�^_ޅ��s�Y-d>`ٸ=�,�= /0�'�`�6�x3 Fķ�7Z�5�)�9��pY���zvnh�H��x)b:!H�. ���(����`��uom�W�S>C����_E���(!�� p�=��"c����Bg!�V1���[r����:
2
+ �*�k�ӒV禈�P�