parser 3.1.3.0 → 3.2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -191,11 +191,20 @@ module Parser
191
191
  end
192
192
  end
193
193
 
194
- def slice(range)
194
+ def slice(start, length = nil)
195
+ if length.nil?
196
+ if start.is_a?(::Range)
197
+ length = start.size
198
+ start = start.begin
199
+ else
200
+ length = 1
201
+ end
202
+ end
203
+
195
204
  if @slice_source.nil?
196
- @source[range]
205
+ @source[start, length]
197
206
  else
198
- @slice_source[range].encode(@source.encoding)
207
+ @slice_source[start, length].encode(@source.encoding)
199
208
  end
200
209
  end
201
210
 
@@ -130,7 +130,7 @@ module Parser
130
130
  # @return [String] all source code covered by this range.
131
131
  #
132
132
  def source
133
- @source_buffer.slice(self.begin_pos...self.end_pos)
133
+ @source_buffer.slice(@begin_pos, @end_pos - @begin_pos)
134
134
  end
135
135
 
136
136
  ##
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Parser
4
- VERSION = '3.1.3.0'
4
+ VERSION = '3.2.0.0'
5
5
  end
data/lib/parser.rb CHANGED
@@ -64,7 +64,11 @@ module Parser
64
64
 
65
65
  require 'parser/static_environment'
66
66
 
67
- require 'parser/lexer'
67
+ if RUBY_ENGINE == 'truffleruby'
68
+ require 'parser/lexer-F0'
69
+ else
70
+ require 'parser/lexer-F1'
71
+ end
68
72
  require 'parser/lexer/literal'
69
73
  require 'parser/lexer/stack_state'
70
74
  require 'parser/lexer/dedenter'
data/parser.gemspec CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
 
31
31
  spec.add_development_dependency 'bundler', '>= 1.15', '< 3.0.0'
32
32
  spec.add_development_dependency 'rake', '~> 13.0.1'
33
- spec.add_development_dependency 'racc', '= 1.6.0'
33
+ spec.add_development_dependency 'racc', '= 1.6.1'
34
34
  spec.add_development_dependency 'cliver', '~> 0.3.2'
35
35
 
36
36
  spec.add_development_dependency 'yard'
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: 3.1.3.0
4
+ version: 3.2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - whitequark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-25 00:00:00.000000000 Z
11
+ date: 2023-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast
@@ -64,14 +64,14 @@ dependencies:
64
64
  requirements:
65
65
  - - '='
66
66
  - !ruby/object:Gem::Version
67
- version: 1.6.0
67
+ version: 1.6.1
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - '='
73
73
  - !ruby/object:Gem::Version
74
- version: 1.6.0
74
+ version: 1.6.1
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: cliver
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -183,7 +183,8 @@ files:
183
183
  - lib/parser/deprecation.rb
184
184
  - lib/parser/diagnostic.rb
185
185
  - lib/parser/diagnostic/engine.rb
186
- - lib/parser/lexer.rb
186
+ - lib/parser/lexer-F0.rb
187
+ - lib/parser/lexer-F1.rb
187
188
  - lib/parser/lexer/dedenter.rb
188
189
  - lib/parser/lexer/explanation.rb
189
190
  - lib/parser/lexer/literal.rb
@@ -246,9 +247,9 @@ licenses:
246
247
  - MIT
247
248
  metadata:
248
249
  bug_tracker_uri: https://github.com/whitequark/parser/issues
249
- changelog_uri: https://github.com/whitequark/parser/blob/v3.1.3.0/CHANGELOG.md
250
- documentation_uri: https://www.rubydoc.info/gems/parser/3.1.3.0
251
- source_code_uri: https://github.com/whitequark/parser/tree/v3.1.3.0
250
+ changelog_uri: https://github.com/whitequark/parser/blob/v3.2.0.0/CHANGELOG.md
251
+ documentation_uri: https://www.rubydoc.info/gems/parser/3.2.0.0
252
+ source_code_uri: https://github.com/whitequark/parser/tree/v3.2.0.0
252
253
  post_install_message:
253
254
  rdoc_options: []
254
255
  require_paths: