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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aeb1a643a1e50280d971697fce43dd37ef01179a
4
- data.tar.gz: f50c9ceeba38d5fdcf3b5d9c13fcd2c32425d805
3
+ metadata.gz: ffeb12159b6b536bbd1d47f0d0fd6c5f00726972
4
+ data.tar.gz: 9a9af81cd8070c6a7ec4b48aaeb09c2ba68a66f2
5
5
  SHA512:
6
- metadata.gz: 1d75b85fd7a2628ef8eac25c419b8c313e6983d431e9afe40050449d99d15f48509d8f1b4e08b8b1a1659abd089d2f9111046b8afb2ada27e3897643a98ed8a6
7
- data.tar.gz: 98a3cbf81cbd31ea822a29c6f87ba544c397955befb74f86a611a943447eb13a1708d2fd0e52f2c00bbf748f5d1808f18008e8b3a1c0c78d744048a81df1b963
6
+ metadata.gz: c6e0265a8b7621a76d4aa1068452f87efb7edc48feb4f744e188c69eb4c19110908b924f7a1ff49a76e569d9f8045e1a5fc27741c4a8facc3862a5cb5f15d224
7
+ data.tar.gz: 851a3cc71aacef3107b54636092d3579eb65b0c4f9914e24324bf3a9ba21490cff67e8d0a96911dcb99af18f0cdde45313b49ebc260d834007e7fed830d7100b
@@ -150,7 +150,7 @@ class Parser::Lexer
150
150
  #
151
151
  # Patches accepted.
152
152
  #
153
- @source = @source_buffer.source.gsub(/\r\n/, "\n") + "\0\0\0"
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
@@ -1,3 +1,3 @@
1
1
  module Parser
2
- VERSION = '1.4.0'
2
+ VERSION = '1.4.1'
3
3
  end
@@ -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.0
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-22 00:00:00.000000000 Z
11
+ date: 2013-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast