parser 2.2.2.2 → 2.2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Rakefile +6 -2
- data/lib/parser/lexer.rl +11 -2
- data/lib/parser/source/map.rb +5 -3
- data/lib/parser/version.rb +1 -1
- data/test/test_source_map.rb +13 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab4cd18ca1c0a175a8631f5b33b00d1b74a87138
|
4
|
+
data.tar.gz: 84d9cd1a7216ab854b704080977bfec9dcd86023
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdf15aa367699423e2b475cc9e90c90eb52e6fdbd0c8560e63ea9f3e85ed8dd0963052f2413363460dda0b2adfde1738abf059cba398983c2937f3c5860fd4ac
|
7
|
+
data.tar.gz: 6be794d016744e9d7a0ffab004983bb6af6030c88ba1ccd11c31776d1108d8f45391fa2455d82fc14ca30b89d2c25951648ae3cf186111fc5397f6721978d17c
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
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})"
|
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
|
data/lib/parser/lexer.rl
CHANGED
@@ -1401,8 +1401,17 @@ class Parser::Lexer
|
|
1401
1401
|
# AMBIGUOUS TOKENS RESOLVED VIA EXPR_BEG
|
1402
1402
|
#
|
1403
1403
|
|
1404
|
-
# a
|
1405
|
-
#
|
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
|
|
data/lib/parser/source/map.rb
CHANGED
@@ -144,9 +144,11 @@ module Parser
|
|
144
144
|
# @return [Hash(Symbol, Parser::Source::Range)]
|
145
145
|
#
|
146
146
|
def to_hash
|
147
|
-
|
148
|
-
|
149
|
-
|
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
|
data/lib/parser/version.rb
CHANGED
@@ -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.
|
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-
|
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
|