parser 2.0.0.beta1 → 2.0.0.beta2

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: 461f75016915d79b41bf1d98c2ffd979b85b92a8
4
- data.tar.gz: e4e95ba6d0d7a54da4d29f10d103f9a9541a1102
3
+ metadata.gz: 07879ee1d09632725a820a2ebe8cffd8ab8b96df
4
+ data.tar.gz: e6e2daa3f5ce930d63f72457fceded6a319309aa
5
5
  SHA512:
6
- metadata.gz: af23698e24fc19b7c12cb521d21657be6a1aa5b7771562b3643e8be35082765fe02e3e81a8801f8667f28adb0114f3353b512ac9121eb673b68836c05286bfde
7
- data.tar.gz: 82bc2d8abbf80d1c46860ae02ebea4dfe284799b88e3a9163b1121993158952eeff5a7c969b27d9d3e2281441eefd056c60c4f55eb66dd199d0324c73dbf6b8c
6
+ metadata.gz: ebb7af02e3f6c83c57d221857c8a4c3f3606aa61ab84f33cb1ccc10ec6b3433da0fbc44af7a26bc8beb7e3cc6df1ef1feafc30734fa20a86060db212adc92d05
7
+ data.tar.gz: 97d3ba4a5f88a4dbdaaa9521aa5a24ecae3397d9d5d7f39691a757b74f2aadaa48e14b08fd8b28343ec94c8d6d7b5254663d57407c60f384bb4c17019e5bc9db
data/CHANGELOG.md CHANGED
@@ -1,9 +1,15 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
- 2.0.0.beta1 (2013-05-25)
4
+ 2.0.0.beta2 (2013-05-27)
5
5
  ------------------------
6
6
 
7
+ Bugs fixed:
8
+ * Actually return comments from Parser::Base#tokenize instead of nil. (Peter Zotov)
9
+
10
+ v2.0.0 (2013-05-25)
11
+ -------------------
12
+
7
13
  API modifications:
8
14
  * Completely rewrite whitespace handling in lexer (fixes #36). (Peter Zotov)
9
15
  * Rename Parser::AST::Node#source_map to #location, #src to #loc (closes #40). (Peter Zotov)
data/lib/parser/base.rb CHANGED
@@ -33,8 +33,6 @@ module Parser
33
33
 
34
34
  @static_env = StaticEnvironment.new
35
35
 
36
- @comments = []
37
-
38
36
  @lexer = Lexer.new(version)
39
37
  @lexer.diagnostics = @diagnostics
40
38
  @lexer.static_env = @static_env
@@ -90,7 +88,7 @@ module Parser
90
88
  def tokenize(source_buffer)
91
89
  @lexer.tokens = []
92
90
 
93
- ast, comments = parse(source_buffer)
91
+ ast, comments = parse_with_comments(source_buffer)
94
92
 
95
93
  [ ast, comments, @lexer.tokens ]
96
94
  ensure
@@ -1,3 +1,3 @@
1
1
  module Parser
2
- VERSION = '2.0.0.beta1'
2
+ VERSION = '2.0.0.beta2'
3
3
  end
data/parser.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency 'rake', '~> 0.9'
32
32
  spec.add_development_dependency 'racc'
33
33
 
34
- spec.add_development_dependency 'minitest', '~> 4.7.0'
34
+ spec.add_development_dependency 'minitest', '~> 5.0'
35
35
  spec.add_development_dependency 'simplecov', '~> 0.7'
36
36
  spec.add_development_dependency 'coveralls'
37
37
  spec.add_development_dependency 'json_pure' # for coveralls on 1.9.2
data/test/test_current.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'helper'
2
2
  require 'parser/current'
3
3
 
4
- class TestCurrent < MiniTest::Unit::TestCase
4
+ class TestCurrent < Minitest::Test
5
5
  def test_current
6
6
  case RUBY_VERSION
7
7
  when '1.8.7'
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestDiagnostic < MiniTest::Unit::TestCase
3
+ class TestDiagnostic < Minitest::Test
4
4
  def setup
5
5
  @buffer = Parser::Source::Buffer.new('(string)')
6
6
  @buffer.source = "if (this is some bad code + bugs)"
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestDiagnosticEngine < MiniTest::Unit::TestCase
3
+ class TestDiagnosticEngine < Minitest::Test
4
4
  def setup
5
5
  @buffer = Parser::Source::Buffer.new('(source)')
6
6
  @buffer.source = 'foobar'
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'helper'
4
4
 
5
- class TestEncoding < MiniTest::Unit::TestCase
5
+ class TestEncoding < Minitest::Test
6
6
  def recognize(string)
7
7
  Parser::Source::Buffer.recognize_encoding(string)
8
8
  end
data/test/test_lexer.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'helper'
4
4
 
5
- class TestLexer < MiniTest::Unit::TestCase
5
+ class TestLexer < Minitest::Test
6
6
  def setup_lexer(version)
7
7
  @lex = Parser::Lexer.new(version)
8
8
 
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestLexerStackState < MiniTest::Unit::TestCase
3
+ class TestLexerStackState < Minitest::Test
4
4
  def setup
5
5
  @state = Parser::Lexer::StackState.new('state')
6
6
  end
@@ -1,7 +1,7 @@
1
1
  require 'helper'
2
2
  require 'parse_helper'
3
3
 
4
- class TestParseHelper < MiniTest::Unit::TestCase
4
+ class TestParseHelper < Minitest::Test
5
5
  include ParseHelper
6
6
 
7
7
  def test_parser_for_ruby_version
data/test/test_parser.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'helper'
4
4
  require 'parse_helper'
5
5
 
6
- class TestParser < MiniTest::Unit::TestCase
6
+ class TestParser < Minitest::Test
7
7
  include ParseHelper
8
8
 
9
9
  def parser_for_ruby_version(version)
@@ -4214,7 +4214,10 @@ class TestParser < MiniTest::Unit::TestCase
4214
4214
  Parser::Source::Range.new(source_file, from, to)
4215
4215
  end
4216
4216
 
4217
- _ast, comments = parser.parse_with_comments(source_file)
4217
+ ast, comments = parser.parse_with_comments(source_file)
4218
+
4219
+ assert_equal s(:send, s(:int, 1), :+, s(:int, 2)),
4220
+ ast
4218
4221
 
4219
4222
  assert_equal [
4220
4223
  Parser::Source::Comment.new(range.call(4, 9))
@@ -4231,7 +4234,14 @@ class TestParser < MiniTest::Unit::TestCase
4231
4234
  Parser::Source::Range.new(source_file, from, to)
4232
4235
  end
4233
4236
 
4234
- _ast, _comments, tokens = parser.tokenize(source_file)
4237
+ ast, comments, tokens = parser.tokenize(source_file)
4238
+
4239
+ assert_equal s(:send, s(:int, 1), :+, s(:int, 2)),
4240
+ ast
4241
+
4242
+ assert_equal [
4243
+ Parser::Source::Comment.new(range.call(4, 9))
4244
+ ], comments
4235
4245
 
4236
4246
  assert_equal [
4237
4247
  [:tINTEGER, [ 1, range.call(0, 1) ]],
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestSourceBuffer < MiniTest::Unit::TestCase
3
+ class TestSourceBuffer < Minitest::Test
4
4
  def setup
5
5
  @buffer = Parser::Source::Buffer.new('(string)')
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestSourceComment < MiniTest::Unit::TestCase
3
+ class TestSourceComment < Minitest::Test
4
4
  def setup
5
5
  @buf = Parser::Source::Buffer.new('(string)')
6
6
  @buf.source = "# foo\n=begin foo\nbar\n=end baz\n"
@@ -1,7 +1,7 @@
1
1
  require 'helper'
2
2
  require 'parser/ruby18'
3
3
 
4
- class TestSourceCommentAssociator < MiniTest::Unit::TestCase
4
+ class TestSourceCommentAssociator < Minitest::Test
5
5
  def test_associate
6
6
  parser = Parser::Ruby18.new
7
7
 
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestSourceRange < MiniTest::Unit::TestCase
3
+ class TestSourceRange < Minitest::Test
4
4
  def setup
5
5
  @buf = Parser::Source::Buffer.new('(string)')
6
6
  @buf.source = "foobar\nbaz"
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestSourceRewriter < MiniTest::Unit::TestCase
3
+ class TestSourceRewriter < Minitest::Test
4
4
  def setup
5
5
  @buf = Parser::Source::Buffer.new('(rewriter)')
6
6
  @buf.source = 'foo bar baz'
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestSourceRewriterAction < MiniTest::Unit::TestCase
3
+ class TestSourceRewriterAction < Minitest::Test
4
4
  def setup
5
5
  @buf = Parser::Source::Buffer.new('(rewriter_action)')
6
6
  @buf.source = 'foo bar baz'
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestStaticEnvironment < MiniTest::Unit::TestCase
3
+ class TestStaticEnvironment < Minitest::Test
4
4
  def setup
5
5
  @env = Parser::StaticEnvironment.new
6
6
  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.0.0.beta1
4
+ version: 2.0.0.beta2
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-25 00:00:00.000000000 Z
11
+ date: 2013-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - ~>
88
88
  - !ruby/object:Gem::Version
89
- version: 4.7.0
89
+ version: '5.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
- version: 4.7.0
96
+ version: '5.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: simplecov
99
99
  requirement: !ruby/object:Gem::Requirement