parser 2.2.2.2 → 2.2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9642fd7259af701acf759e9083a66ca26a0c4de
4
- data.tar.gz: a689a5f7b816813fb86845abeef9e92f9dbba73b
3
+ metadata.gz: ab4cd18ca1c0a175a8631f5b33b00d1b74a87138
4
+ data.tar.gz: 84d9cd1a7216ab854b704080977bfec9dcd86023
5
5
  SHA512:
6
- metadata.gz: a9688dd01f3454ad7adc0c21e23de107529acc73709f49bf12845425db1e65cf75da35ac94d79bbabac731759695a85efbf67d9062a739e43aaf0d031aa0255b
7
- data.tar.gz: f33b299a27fafb355fa0b44101e22cee7db03407fe16d8acf6c64ce7b0d0901fa042eb7c0a824f17aa8d9ae8b02323a47f90d5489299a4a8f0468f26d2bd411a
6
+ metadata.gz: cdf15aa367699423e2b475cc9e90c90eb52e6fdbd0c8560e63ea9f3e85ed8dd0963052f2413363460dda0b2adfde1738abf059cba398983c2937f3c5860fd4ac
7
+ data.tar.gz: 6be794d016744e9d7a0ffab004983bb6af6030c88ba1ccd11c31776d1108d8f45391fa2455d82fc14ca30b89d2c25951648ae3cf186111fc5397f6721978d17c
@@ -1,6 +1,15 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ v2.2.2.3 (2015-05-17)
5
+ ---------------------
6
+
7
+ API modifications:
8
+ * lexer.rl: "a?? 1 : 0": squelch "invalid character syntax" warning. (whitequark)
9
+
10
+ Bugs fixed:
11
+ * Source::Map: do not include :node in to_hash. (whitequark)
12
+
4
13
  v2.2.2.2 (2015-04-28)
5
14
  ---------------------
6
15
 
data/Rakefile CHANGED
@@ -81,7 +81,10 @@ task :changelog do
81
81
  end
82
82
  end
83
83
 
84
- IO.popen("git log --pretty='#{format}' remotes/origin/2.0 remotes/origin/2.1 master", 'r') do |io|
84
+ branch = `git describe HEAD --all`.strip.gsub(/.+\/([^\/]+)$/, '\1')
85
+
86
+ IO.popen("git log --pretty='#{format}' " \
87
+ "remotes/origin/2.0 remotes/origin/2.1 remotes/origin/2.2 #{branch}", 'r') do |io|
85
88
  current_version = nil
86
89
 
87
90
  io.each_line do |line|
@@ -90,7 +93,8 @@ task :changelog do
90
93
  date = Date.parse(date)
91
94
 
92
95
  current_version = "#{$1} (#{date})" if version =~ /(v[\d\w.]+)/
93
- current_version = "v#{Parser::VERSION} (#{date})" if version =~ /(^|[^\/])master/
96
+ current_version = "v#{Parser::VERSION} (#{date})" \
97
+ if version =~ /(^| |\/)#{Regexp.escape branch}$/
94
98
 
95
99
  next if current_version.nil?
96
100
  changelog[current_version] # add a hash
@@ -1401,8 +1401,17 @@ class Parser::Lexer
1401
1401
  # AMBIGUOUS TOKENS RESOLVED VIA EXPR_BEG
1402
1402
  #
1403
1403
 
1404
- # a ?b
1405
- # Character literal.
1404
+ # a??
1405
+ # Ternary operator
1406
+ '?' c_space_nl
1407
+ => {
1408
+ # Unlike expr_beg as invoked in the next rule, do not warn
1409
+ p = @ts - 1
1410
+ fgoto expr_end;
1411
+ };
1412
+
1413
+ # a ?b, a? ?
1414
+ # Character literal or ternary operator
1406
1415
  w_space* '?'
1407
1416
  => { fhold; fgoto expr_beg; };
1408
1417
 
@@ -144,9 +144,11 @@ module Parser
144
144
  # @return [Hash(Symbol, Parser::Source::Range)]
145
145
  #
146
146
  def to_hash
147
- Hash[instance_variables.map do |ivar|
148
- [ ivar[1..-1].to_sym, instance_variable_get(ivar) ]
149
- end]
147
+ instance_variables.inject({}) do |hash, ivar|
148
+ next hash if ivar.to_sym == :@node
149
+ hash[ivar[1..-1].to_sym] = instance_variable_get(ivar)
150
+ hash
151
+ end
150
152
  end
151
153
 
152
154
  protected
@@ -1,3 +1,3 @@
1
1
  module Parser
2
- VERSION = '2.2.2.2'
2
+ VERSION = '2.2.2.3'
3
3
  end
@@ -0,0 +1,13 @@
1
+ require 'helper'
2
+ require 'parse_helper'
3
+
4
+ class TestSourceComment < Minitest::Test
5
+ include ParseHelper
6
+
7
+ def test_to_hash
8
+ buf = Parser::Source::Buffer.new("<input>")
9
+ buf.source = "1"
10
+ ast = parser_for_ruby_version('1.8').parse(buf)
11
+ assert_equal [:expression, :operator], ast.loc.to_hash.keys.sort_by(&:to_s)
12
+ end
13
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2.2
4
+ version: 2.2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Zotov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-28 00:00:00.000000000 Z
11
+ date: 2015-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast
@@ -327,6 +327,7 @@ files:
327
327
  - test/test_source_buffer.rb
328
328
  - test/test_source_comment.rb
329
329
  - test/test_source_comment_associator.rb
330
+ - test/test_source_map.rb
330
331
  - test/test_source_range.rb
331
332
  - test/test_source_rewriter.rb
332
333
  - test/test_source_rewriter_action.rb
@@ -375,6 +376,7 @@ test_files:
375
376
  - test/test_source_buffer.rb
376
377
  - test/test_source_comment.rb
377
378
  - test/test_source_comment_associator.rb
379
+ - test/test_source_map.rb
378
380
  - test/test_source_range.rb
379
381
  - test/test_source_rewriter.rb
380
382
  - test/test_source_rewriter_action.rb