parser 2.0.0.beta2 → 2.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -4
- data/Gemfile +1 -3
- data/Rakefile +2 -2
- data/lib/parser/ast/processor.rb +3 -2
- data/lib/parser/lexer.rl +3 -3
- data/lib/parser/version.rb +1 -1
- data/test/test_lexer.rb +7 -0
- data/test/test_parser.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3c90abfdc392d6c6d0c73d73138f073428117e6
|
4
|
+
data.tar.gz: d0c947aa1ada143e47b3558ae215a4f245f2ccff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76e1c1063a7ab852b19cc2b6a6eb1121cd7f9aa13ec40b3712dc568dfd24b8ac7b72610386d4a33932e22331eac5fca2575efdf302b3daf9cfe398edac1d13be
|
7
|
+
data.tar.gz: 4647419022b86a8d8a53f9a126d0c47fa6d9f23d5b2ed2b5ce60277b6803a0202f7701e24c8905ce41d072954aa60408198fd98087584f9fdf44f688b176420b
|
data/CHANGELOG.md
CHANGED
@@ -1,14 +1,23 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
v2.0.0.beta3 (2013-05-29)
|
5
|
+
-------------------------
|
6
|
+
|
7
|
+
Bugs fixed:
|
8
|
+
* AST::Processor: traverse "A, B = foo" (fixes #55). (Peter Zotov)
|
9
|
+
* lexer.rl: correctly handle CRLF line endings (fixes #56). (Peter Zotov)
|
10
|
+
* Fix traversing of "case; when a?; when b?; end" by AST::Processor. (Peter Zotov)
|
11
|
+
* Correctly lex "foo a, b # comment\nbar" (fixes #54). (Peter Zotov)
|
12
|
+
|
13
|
+
v2.0.0.beta2 (2013-05-27)
|
14
|
+
-------------------------
|
6
15
|
|
7
16
|
Bugs fixed:
|
8
17
|
* Actually return comments from Parser::Base#tokenize instead of nil. (Peter Zotov)
|
9
18
|
|
10
|
-
v2.0.0 (2013-05-25)
|
11
|
-
|
19
|
+
v2.0.0.beta1 (2013-05-25)
|
20
|
+
-------------------------
|
12
21
|
|
13
22
|
API modifications:
|
14
23
|
* Completely rewrite whitespace handling in lexer (fixes #36). (Peter Zotov)
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -67,8 +67,8 @@ task :changelog do
|
|
67
67
|
match(/^(?: \((.*)\))?#{fs}(.*)#{fs}(.*)#{fs}(.*)$/o).captures
|
68
68
|
date = Date.parse(date)
|
69
69
|
|
70
|
-
current_version = "#{$1} (#{date})" if version =~ /(v\d
|
71
|
-
current_version = "#{Parser::VERSION} (#{date})" if version =~ /HEAD/
|
70
|
+
current_version = "#{$1} (#{date})" if version =~ /(v[\d\w.]+)/
|
71
|
+
current_version = "v#{Parser::VERSION} (#{date})" if version =~ /HEAD/
|
72
72
|
|
73
73
|
next if current_version.nil? || message !~ /^[+*-]/
|
74
74
|
|
data/lib/parser/ast/processor.rb
CHANGED
@@ -75,7 +75,7 @@ module Parser
|
|
75
75
|
scope_node, name, value_node = *node
|
76
76
|
|
77
77
|
scope_node = process(scope_node) if scope_node
|
78
|
-
value_node = process(value_node)
|
78
|
+
value_node = process(value_node) if value_node
|
79
79
|
node.updated(nil, [ scope_node, name, value_node ])
|
80
80
|
end
|
81
81
|
|
@@ -184,9 +184,10 @@ module Parser
|
|
184
184
|
cond_node, *bodies = *node
|
185
185
|
when_nodes, else_node = bodies[0..-2], bodies[-1]
|
186
186
|
|
187
|
+
cond_node = process(cond_node) if cond_node
|
187
188
|
else_node = process(else_node) if else_node
|
188
189
|
node.updated(nil, [
|
189
|
-
|
190
|
+
cond_node,
|
190
191
|
*(process_all(when_nodes) << else_node)
|
191
192
|
])
|
192
193
|
end
|
data/lib/parser/lexer.rl
CHANGED
@@ -154,7 +154,7 @@ class Parser::Lexer
|
|
154
154
|
#
|
155
155
|
# Patches accepted.
|
156
156
|
#
|
157
|
-
@source = @source_buffer.source
|
157
|
+
@source = @source_buffer.source + "\0\0\0"
|
158
158
|
else
|
159
159
|
@source = nil
|
160
160
|
end
|
@@ -377,7 +377,7 @@ class Parser::Lexer
|
|
377
377
|
@newline_s = p
|
378
378
|
}
|
379
379
|
|
380
|
-
c_nl = '\n' $ do_nl;
|
380
|
+
c_nl = '\r'? '\n' $ do_nl;
|
381
381
|
c_space = [ \t\r\f\v];
|
382
382
|
c_space_nl = c_space | c_nl;
|
383
383
|
c_eof = 0x04 | 0x1a | 0; # ^D, ^Z, EOF
|
@@ -1241,7 +1241,7 @@ class Parser::Lexer
|
|
1241
1241
|
fgoto expr_end;
|
1242
1242
|
};
|
1243
1243
|
|
1244
|
-
w_space
|
1244
|
+
w_space* w_newline
|
1245
1245
|
=> { fhold; fgoto expr_end; };
|
1246
1246
|
|
1247
1247
|
c_any
|
data/lib/parser/version.rb
CHANGED
data/test/test_lexer.rb
CHANGED
@@ -2523,6 +2523,13 @@ class TestLexer < Minitest::Test
|
|
2523
2523
|
:tIDENTIFIER, "foo")
|
2524
2524
|
end
|
2525
2525
|
|
2526
|
+
def test_bug_expr_arg_comment_newline
|
2527
|
+
@lex.state = :expr_arg
|
2528
|
+
util_lex_token(" #\nfoo",
|
2529
|
+
:tNL, nil,
|
2530
|
+
:tIDENTIFIER, 'foo')
|
2531
|
+
end
|
2532
|
+
|
2526
2533
|
def test_bug_heredoc_backspace_nl
|
2527
2534
|
util_lex_token(" <<'XXX'\nf \\\nXXX\n",
|
2528
2535
|
:tSTRING_BEG, "'",
|
data/test/test_parser.rb
CHANGED
@@ -4135,6 +4135,25 @@ class TestParser < Minitest::Test
|
|
4135
4135
|
# Miscellanea
|
4136
4136
|
#
|
4137
4137
|
|
4138
|
+
def test_crlf_line_endings
|
4139
|
+
with_versions(ALL_VERSIONS) do |_ver, parser|
|
4140
|
+
source_file = Parser::Source::Buffer.new('(comments)')
|
4141
|
+
source_file.source = "\r\nfoo"
|
4142
|
+
|
4143
|
+
range = lambda do |from, to|
|
4144
|
+
Parser::Source::Range.new(source_file, from, to)
|
4145
|
+
end
|
4146
|
+
|
4147
|
+
ast = parser.parse(source_file)
|
4148
|
+
|
4149
|
+
assert_equal s(:lvar, :foo),
|
4150
|
+
ast
|
4151
|
+
|
4152
|
+
assert_equal range.call(2, 5),
|
4153
|
+
ast.loc.expression
|
4154
|
+
end
|
4155
|
+
end
|
4156
|
+
|
4138
4157
|
def test_begin_cmdarg
|
4139
4158
|
assert_parses(
|
4140
4159
|
s(:send, nil, :p,
|
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.0.0.
|
4
|
+
version: 2.0.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Zotov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ast
|