dead_end 3.1.0 → 3.1.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
  SHA256:
3
- metadata.gz: 80d945bb6aff86e5dce0ef0998bb524e0b18b813412c21a2442fb5824b641ea9
4
- data.tar.gz: 5cfa47620a0e21e5cf5de02c96a9d30da43aee18bace9ef386da54397518dedb
3
+ metadata.gz: 64abeaee0636d3ded8df0f0dc124674a70f954287b37302dff7151f04b746557
4
+ data.tar.gz: 02e6eea73a9e9e832b898f9294c1ce3f7f38f9b8996554a8f6527abf7027d115
5
5
  SHA512:
6
- metadata.gz: 94ada1bbdead52d89e883f18466d0bc0abc1fcb278e9ff4c191503392571f9ca00b33c71d6ed52ef83a50d7f7bf016b1f85ddbde0d0cb617b7201de680dac5be
7
- data.tar.gz: 79eb132ca9d28196646823b00fd1b57feb9395fe88d4590272c809fd2af4074370853cc6e19ccd45fead55136586c5f50486329703eb138da178c5290139601b
6
+ metadata.gz: e7381458f44ef92f5053ac3171ac8bc59e89a805d793dde1c48ce1eda855dcea624ef6dc7a1faa3da9c20abc53983675fc66a7b08e3e02893801b4b4ff0edf65
7
+ data.tar.gz: 8b92dee56fac32777f31b76e25a0b778b2a4ffa1ff6914f24ef835bbf5ab79898f4a3a5607a9bebc641f86b05f2a88224504f0f8aaab83c3262b1d067ea32af0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## HEAD (unreleased)
2
2
 
3
+ ## 3.1.1
4
+
5
+ - Fix case where Ripper lexing identified incorrect code as a keyword (https://github.com/zombocom/dead_end/pull/122)
6
+
3
7
  ## 3.1.0
4
8
 
5
9
  - Add support for Ruby 3.1 by updating `require_relative` logic (https://github.com/zombocom/dead_end/pull/120)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dead_end (3.1.0)
4
+ dead_end (3.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -62,4 +62,4 @@ DEPENDENCIES
62
62
  standard
63
63
 
64
64
  BUNDLED WITH
65
- 2.2.30
65
+ 2.3.4
@@ -25,7 +25,10 @@ module DeadEnd
25
25
  lineno = @lex.last.pos.first + 1
26
26
  end
27
27
 
28
- @lex.map! { |elem| LexValue.new(elem.pos.first, elem.event, elem.tok, elem.state) }
28
+ last_lex = nil
29
+ @lex.map! { |elem|
30
+ last_lex = LexValue.new(elem.pos.first, elem.event, elem.tok, elem.state, last_lex)
31
+ }
29
32
  end
30
33
 
31
34
  def to_a
@@ -15,19 +15,21 @@ module DeadEnd
15
15
  class LexValue
16
16
  attr_reader :line, :type, :token, :state
17
17
 
18
- def initialize(line, type, token, state)
18
+ def initialize(line, type, token, state, last_lex = nil)
19
19
  @line = line
20
20
  @type = type
21
21
  @token = token
22
22
  @state = state
23
23
 
24
- set_kw_end
24
+ set_kw_end(last_lex)
25
25
  end
26
26
 
27
- private def set_kw_end
27
+ private def set_kw_end(last_lex)
28
28
  @is_end = false
29
29
  @is_kw = false
30
30
  return if type != :on_kw
31
+ #
32
+ return if last_lex && last_lex.fname? # https://github.com/ruby/ruby/commit/776759e300e4659bb7468e2b97c8c2d4359a2953
31
33
 
32
34
  case token
33
35
  when "if", "unless", "while", "until"
@@ -41,6 +43,10 @@ module DeadEnd
41
43
  end
42
44
  end
43
45
 
46
+ def fname?
47
+ state.allbits?(Ripper::EXPR_FNAME)
48
+ end
49
+
44
50
  def ignore_newline?
45
51
  type == :on_ignored_nl
46
52
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeadEnd
4
- VERSION = "3.1.0"
4
+ VERSION = "3.1.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dead_end
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - schneems
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-21 00:00:00.000000000 Z
11
+ date: 2022-01-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: When you get an "unexpected end" in your syntax this gem helps you find
14
14
  it
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  requirements: []
83
- rubygems_version: 3.3.0.dev
83
+ rubygems_version: 3.2.32
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Find syntax errors in your source in a snap