ast 1.1.0 → 2.0.0

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: 96c7dc9848d3ba4b34349181d246a995c6069ca3
4
- data.tar.gz: 305049a41e9a331d5eb804d3f0837205dfaabe51
3
+ metadata.gz: 0b74cff86763a30c7b0b92c2aae6467d904ad2c4
4
+ data.tar.gz: f829d02411d598e5b470ad57cf726d342349ff07
5
5
  SHA512:
6
- metadata.gz: 97fb761b1bd3d1371892551884cd42eb4ac520a11a6dd79c5d08813cf4a3448860b81754a0983cfaf5a798b3d616b098fae5582808604989d5cb441c289511bd
7
- data.tar.gz: 3d6011553e169bdd41619ead8ba2e62ec75544edf3ab68c205d3624a3eb5d4e5caff44f038321aa6e4af050e6eb8b7ccd78f00bda10fe734206d041d8a6a7fca
6
+ metadata.gz: 51d6106feef1199a6ae5f347c9121303479d155d13291292a0c733884fd88579f56be461237fd8d21551305649e85c9d556791aab1deaf45bee66ad387bb954c
7
+ data.tar.gz: a310e6c19a8b83477e855b8fa9d95c1c1de9398b2308d91a84cbf1b84a52004c5193a10ac522474e9ee20f058c469c4e4de38369df2d2d21114b4afc62d196ce
@@ -6,8 +6,4 @@ rvm:
6
6
  - 2.0
7
7
  - jruby-18mode
8
8
  - jruby-19mode
9
- - rbx-18mode
10
- - rbx-19mode
11
- matrix:
12
- allow_failures:
13
- - rvm: rbx-19mode
9
+ - rbx-2
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Parser
1
+ # AST
2
2
 
3
3
  [![Build Status](https://travis-ci.org/whitequark/ast.png?branch=master)](https://travis-ci.org/whitequark/ast)
4
4
  [![Code Climate](https://codeclimate.com/github/whitequark/ast.png)](https://codeclimate.com/github/whitequark/ast)
@@ -1,9 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ast'
3
- s.version = '1.1.0'
3
+ s.version = '2.0.0'
4
+ s.license = 'MIT'
4
5
  s.authors = ["Peter Zotov"]
5
6
  s.email = ["whitequark@whitequark.org"]
6
- s.homepage = "http://github.com/whitequark/ast"
7
+ s.homepage = "https://whitequark.github.io/ast/"
7
8
  s.summary = %q{A library for working with Abstract Syntax Trees.}
8
9
  s.description = s.summary
9
10
 
@@ -17,7 +18,10 @@ Gem::Specification.new do |s|
17
18
  s.add_development_dependency 'bacon', '~> 1.2'
18
19
  s.add_development_dependency 'bacon-colored_output'
19
20
  s.add_development_dependency 'simplecov'
21
+
20
22
  s.add_development_dependency 'coveralls'
23
+ s.add_development_dependency 'json_pure' # for coveralls on 1.9.2
24
+ s.add_development_dependency 'mime-types', '~> 1.25' # for coveralls on 1.8.7
21
25
 
22
26
  s.add_development_dependency 'yard'
23
27
  s.add_development_dependency 'kramdown'
@@ -45,6 +45,10 @@ module AST
45
45
  # @return [Array]
46
46
  attr_reader :children
47
47
 
48
+ # Returns the precomputed hash value for this node
49
+ # @return [Fixnum]
50
+ attr_reader :hash
51
+
48
52
  # Constructs a new instance of Node.
49
53
  #
50
54
  # The arguments `type` and `children` are converted with `to_sym` and
@@ -59,9 +63,20 @@ module AST
59
63
 
60
64
  assign_properties(properties)
61
65
 
66
+ @hash = [@type, @children, self.class].hash
67
+
62
68
  freeze
63
69
  end
64
70
 
71
+ # Test if other object is equal to
72
+ # @param [Object] other
73
+ # @return [Boolean]
74
+ def eql?(other)
75
+ self.class.eql?(other.class) &&
76
+ @type.eql?(other.type) &&
77
+ @children.eql?(other.children)
78
+ end
79
+
65
80
  # By default, each entry in the `properties` hash is assigned to
66
81
  # an instance variable in this instance of Node. A subclass should define
67
82
  # attribute readers for such variables. The values passed in the hash
@@ -68,7 +68,20 @@ describe AST::Node do
68
68
  @node.to_ast.should.be.identical_to @node
69
69
  end
70
70
 
71
- it 'should only use type and children in comparisons' do
71
+ it 'should only use type and children to compute #hash' do
72
+ @node.hash.should.equal([@node.type, @node.children, @node.class].hash)
73
+ end
74
+
75
+ it 'should only use type and children in #eql? comparisons' do
76
+ # Not identical but equivalent
77
+ @node.eql?(AST::Node.new(:node, [0, 1])).should.be.true
78
+ # Not identical and not equivalent
79
+ @node.eql?(AST::Node.new(:other, [0, 1])).should.be.false
80
+ # Not identical and not equivalent because of differend class
81
+ @node.eql?(@metanode).should.be.false
82
+ end
83
+
84
+ it 'should only use type and children in #== comparisons' do
72
85
  @node.should.equal @node
73
86
  @node.should.equal @metanode
74
87
  @node.should.not.equal :foo
metadata CHANGED
@@ -1,111 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ast
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
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-06-17 00:00:00.000000000 Z
11
+ date: 2014-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '10.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '10.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bacon
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.2'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bacon-colored_output
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: simplecov
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: coveralls
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: json_pure
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: mime-types
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.25'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.25'
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: yard
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
- - - '>='
115
+ - - ">="
88
116
  - !ruby/object:Gem::Version
89
117
  version: '0'
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
- - - '>='
122
+ - - ">="
95
123
  - !ruby/object:Gem::Version
96
124
  version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: kramdown
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
- - - '>='
129
+ - - ">="
102
130
  - !ruby/object:Gem::Version
103
131
  version: '0'
104
132
  type: :development
105
133
  prerelease: false
106
134
  version_requirements: !ruby/object:Gem::Requirement
107
135
  requirements:
108
- - - '>='
136
+ - - ">="
109
137
  - !ruby/object:Gem::Version
110
138
  version: '0'
111
139
  description: A library for working with Abstract Syntax Trees.
@@ -115,9 +143,9 @@ executables: []
115
143
  extensions: []
116
144
  extra_rdoc_files: []
117
145
  files:
118
- - .gitignore
119
- - .travis.yml
120
- - .yardopts
146
+ - ".gitignore"
147
+ - ".travis.yml"
148
+ - ".yardopts"
121
149
  - CHANGELOG.md
122
150
  - Gemfile
123
151
  - LICENSE.MIT
@@ -131,8 +159,9 @@ files:
131
159
  - lib/ast/sexp.rb
132
160
  - test/helper.rb
133
161
  - test/test_ast.rb
134
- homepage: http://github.com/whitequark/ast
135
- licenses: []
162
+ homepage: https://whitequark.github.io/ast/
163
+ licenses:
164
+ - MIT
136
165
  metadata: {}
137
166
  post_install_message:
138
167
  rdoc_options: []
@@ -140,17 +169,17 @@ require_paths:
140
169
  - lib
141
170
  required_ruby_version: !ruby/object:Gem::Requirement
142
171
  requirements:
143
- - - '>='
172
+ - - ">="
144
173
  - !ruby/object:Gem::Version
145
174
  version: '0'
146
175
  required_rubygems_version: !ruby/object:Gem::Requirement
147
176
  requirements:
148
- - - '>='
177
+ - - ">="
149
178
  - !ruby/object:Gem::Version
150
179
  version: '0'
151
180
  requirements: []
152
181
  rubyforge_project:
153
- rubygems_version: 2.0.0
182
+ rubygems_version: 2.2.2
154
183
  signing_key:
155
184
  specification_version: 4
156
185
  summary: A library for working with Abstract Syntax Trees.