syntax_search 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +2 -29
- data/Gemfile.lock +3 -1
- data/exe/syntax_search +5 -71
- data/lib/syntax_search/auto.rb +5 -49
- data/syntax_search.gemspec +3 -3
- metadata +17 -19
- data/lib/syntax_search.rb +0 -145
- data/lib/syntax_search/around_block_scan.rb +0 -193
- data/lib/syntax_search/block_expand.rb +0 -74
- data/lib/syntax_search/capture_code_context.rb +0 -62
- data/lib/syntax_search/code_block.rb +0 -78
- data/lib/syntax_search/code_frontier.rb +0 -151
- data/lib/syntax_search/code_line.rb +0 -128
- data/lib/syntax_search/code_search.rb +0 -154
- data/lib/syntax_search/display_code_with_line_numbers.rb +0 -56
- data/lib/syntax_search/display_invalid_blocks.rb +0 -100
- data/lib/syntax_search/fyi.rb +0 -7
- data/lib/syntax_search/heredoc_block_parse.rb +0 -30
- data/lib/syntax_search/lex_all.rb +0 -58
- data/lib/syntax_search/parse_blocks_from_indent_line.rb +0 -56
- data/lib/syntax_search/version.rb +0 -5
- data/lib/syntax_search/who_dis_syntax_error.rb +0 -32
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module SyntaxErrorSearch
|
4
|
-
# Determines what type of syntax error is in the source
|
5
|
-
#
|
6
|
-
# Example:
|
7
|
-
#
|
8
|
-
# puts WhoDisSyntaxError.new("def foo;").call.error_symbol
|
9
|
-
# # => :missing_end
|
10
|
-
class WhoDisSyntaxError < Ripper
|
11
|
-
attr_reader :error, :run_once, :error_symbol
|
12
|
-
|
13
|
-
def call
|
14
|
-
@run_once ||= begin
|
15
|
-
parse
|
16
|
-
true
|
17
|
-
end
|
18
|
-
self
|
19
|
-
end
|
20
|
-
|
21
|
-
def on_parse_error(msg)
|
22
|
-
@error = msg
|
23
|
-
if @error.match?(/unexpected end-of-input/)
|
24
|
-
@error_symbol = :missing_end
|
25
|
-
elsif @error.match?(/unexpected `end'/) || @error.match?(/expecting end-of-input/)
|
26
|
-
@error_symbol = :unmatched_end
|
27
|
-
else
|
28
|
-
@error_symbol = :nope
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|