ruby_parser 2.3.0 → 2.3.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
@@ -1,3 +1,10 @@
1
+ === 2.3.1 / 2011-09-21
2
+
3
+ * 2 bug fixes:
4
+
5
+ * Fixed line numbers at end of special var+whitespace (larsch)
6
+ * Holy crap I was smokin' something good... Fixed 1.9.3 warning
7
+
1
8
  === 2.3.0 / 2011-09-06
2
9
 
3
10
  * 2 minor enhancements:
data/README.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  = ruby_parser
2
2
 
3
3
  home :: https://github.com/seattlerb/ruby_parser
4
- rdoc :: http://parsetree.rubyforge.org/ruby_parser
4
+ rdoc :: http://docs.seattlerb.org/ruby_parser
5
5
 
6
6
  == DESCRIPTION:
7
7
 
@@ -727,7 +727,7 @@ class RubyLexer
727
727
  # @comments << '=' << src.matched
728
728
  @comments << src.matched
729
729
 
730
- unless src.scan(/.*?\n=end( |\t|\f)*[^(\n|\z)]*(\n|\z)/m) then
730
+ unless src.scan(/.*?\n=end( |\t|\f)*[^\n]*(\n|\z)/m) then
731
731
  @comments.clear
732
732
  rb_compile_error("embedded document meets end of file")
733
733
  end
@@ -5169,37 +5169,38 @@ end
5169
5169
  # reduce 429 omitted
5170
5170
 
5171
5171
  def _reduce_430(val, _values, result)
5172
- result = :nil
5172
+ result = s(:nil)
5173
5173
  result
5174
5174
  end
5175
5175
 
5176
5176
  def _reduce_431(val, _values, result)
5177
- result = :self
5177
+ result = s(:self)
5178
5178
  result
5179
5179
  end
5180
5180
 
5181
5181
  def _reduce_432(val, _values, result)
5182
- result = :true
5182
+ result = s(:true)
5183
5183
  result
5184
5184
  end
5185
5185
 
5186
5186
  def _reduce_433(val, _values, result)
5187
- result = :false
5187
+ result = s(:false)
5188
5188
  result
5189
5189
  end
5190
5190
 
5191
5191
  def _reduce_434(val, _values, result)
5192
- result = :__FILE__
5192
+ result = s(:str, self.file)
5193
5193
  result
5194
5194
  end
5195
5195
 
5196
5196
  def _reduce_435(val, _values, result)
5197
- result = :__LINE__
5197
+ result = s(:lit, lexer.src.current_line)
5198
5198
  result
5199
5199
  end
5200
5200
 
5201
5201
  def _reduce_436(val, _values, result)
5202
- result = self.gettable val[0]
5202
+ var = val[0]
5203
+ result = Sexp === var ? var : self.gettable(var)
5203
5204
 
5204
5205
  result
5205
5206
  end
@@ -1560,16 +1560,17 @@ xstring_contents: none
1560
1560
  | tGVAR
1561
1561
  | tCONSTANT
1562
1562
  | tCVAR
1563
- | kNIL { result = :nil }
1564
- | kSELF { result = :self }
1565
- | kTRUE { result = :true }
1566
- | kFALSE { result = :false }
1567
- | k__FILE__ { result = :__FILE__ }
1568
- | k__LINE__ { result = :__LINE__ }
1563
+ | kNIL { result = s(:nil) }
1564
+ | kSELF { result = s(:self) }
1565
+ | kTRUE { result = s(:true) }
1566
+ | kFALSE { result = s(:false) }
1567
+ | k__FILE__ { result = s(:str, self.file) }
1568
+ | k__LINE__ { result = s(:lit, lexer.src.current_line) }
1569
1569
 
1570
1570
  var_ref: variable
1571
1571
  {
1572
- result = self.gettable val[0]
1572
+ var = val[0]
1573
+ result = Sexp === var ? var : self.gettable(var)
1573
1574
  }
1574
1575
 
1575
1576
  var_lhs: variable
@@ -123,7 +123,7 @@ class RPStringScanner < StringScanner
123
123
  end
124
124
 
125
125
  class RubyParser < Racc::Parser
126
- VERSION = '2.3.0' unless constants.include? "VERSION" # SIGH
126
+ VERSION = '2.3.1' unless constants.include? "VERSION" # SIGH
127
127
 
128
128
  attr_accessor :lexer, :in_def, :in_single, :file
129
129
  attr_reader :env, :comments
@@ -292,16 +292,7 @@ class RubyParser < Racc::Parser
292
292
  end
293
293
 
294
294
  def gettable(id)
295
- raise "no: #{id.inspect}" if Sexp === id
296
- id = id.to_sym if Sexp === id # HACK
297
- id = id.to_sym if String === id # HACK
298
-
299
- return s(:self) if id == :self
300
- return s(:nil) if id == :nil
301
- return s(:true) if id == :true
302
- return s(:false) if id == :false
303
- return s(:str, self.file) if id == :"__FILE__"
304
- return s(:lit, lexer.src.current_line) if id == :"__LINE__"
295
+ id = id.to_sym if String === id
305
296
 
306
297
  result = case id.to_s
307
298
  when /^@@/ then
@@ -323,9 +314,9 @@ class RubyParser < Racc::Parser
323
314
  end
324
315
  end
325
316
 
326
- return result if result
317
+ raise "identifier #{id.inspect} is not valid" unless result
327
318
 
328
- raise "identifier #{id.inspect} is not valid"
319
+ result
329
320
  end
330
321
 
331
322
  ##
@@ -593,6 +593,13 @@ class TestRubyParser < RubyParserTestCase
593
593
  assert_equal 4, result.call.line
594
594
  end
595
595
 
596
+ def test_parse_line_newlines
597
+ rb = "true\n\n"
598
+ pt = s(:true)
599
+
600
+ assert_parse_line rb, pt, 1
601
+ end
602
+
596
603
  def test_parse_line_return
597
604
  rb = <<-RUBY
598
605
  def blah
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
  - 2
8
8
  - 3
9
- - 0
10
- version: 2.3.0
9
+ - 1
10
+ version: 2.3.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: 2011-09-06 00:00:00 Z
39
+ date: 2011-09-22 00:00:00 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sexp_processor
metadata.gz.sig CHANGED
Binary file