parser 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/parser/lexer.rl +2 -2
- data/lib/parser/version.rb +1 -1
- 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: ffeb12159b6b536bbd1d47f0d0fd6c5f00726972
|
4
|
+
data.tar.gz: 9a9af81cd8070c6a7ec4b48aaeb09c2ba68a66f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6e0265a8b7621a76d4aa1068452f87efb7edc48feb4f744e188c69eb4c19110908b924f7a1ff49a76e569d9f8045e1a5fc27741c4a8facc3862a5cb5f15d224
|
7
|
+
data.tar.gz: 851a3cc71aacef3107b54636092d3579eb65b0c4f9914e24324bf3a9ba21490cff67e8d0a96911dcb99af18f0cdde45313b49ebc260d834007e7fed830d7100b
|
data/lib/parser/lexer.rl
CHANGED
@@ -150,7 +150,7 @@ class Parser::Lexer
|
|
150
150
|
#
|
151
151
|
# Patches accepted.
|
152
152
|
#
|
153
|
-
@source = @source_buffer.source
|
153
|
+
@source = @source_buffer.source + "\0\0\0"
|
154
154
|
else
|
155
155
|
@source = nil
|
156
156
|
end
|
@@ -363,7 +363,7 @@ class Parser::Lexer
|
|
363
363
|
@newline_s = p
|
364
364
|
}
|
365
365
|
|
366
|
-
c_nl = '\n' $ do_nl;
|
366
|
+
c_nl = '\r'? '\n' $ do_nl;
|
367
367
|
c_space = [ \t\r\f\v];
|
368
368
|
c_space_nl = c_space | c_nl;
|
369
369
|
c_eof = 0x04 | 0x1a | 0; # ^D, ^Z, EOF
|
data/lib/parser/version.rb
CHANGED
data/test/test_parser.rb
CHANGED
@@ -4139,6 +4139,25 @@ class TestParser < MiniTest::Unit::TestCase
|
|
4139
4139
|
# Miscellanea
|
4140
4140
|
#
|
4141
4141
|
|
4142
|
+
def test_crlf_line_endings
|
4143
|
+
with_versions(ALL_VERSIONS) do |_ver, parser|
|
4144
|
+
source_file = Parser::Source::Buffer.new('(comments)')
|
4145
|
+
source_file.source = "\r\nfoo"
|
4146
|
+
|
4147
|
+
range = lambda do |from, to|
|
4148
|
+
Parser::Source::Range.new(source_file, from, to)
|
4149
|
+
end
|
4150
|
+
|
4151
|
+
ast = parser.parse(source_file)
|
4152
|
+
|
4153
|
+
assert_equal s(:lvar, :foo),
|
4154
|
+
ast
|
4155
|
+
|
4156
|
+
assert_equal range.call(2, 5),
|
4157
|
+
ast.loc.expression
|
4158
|
+
end
|
4159
|
+
end
|
4160
|
+
|
4142
4161
|
def test_begin_cmdarg
|
4143
4162
|
assert_parses(
|
4144
4163
|
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: 1.4.
|
4
|
+
version: 1.4.1
|
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-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ast
|