8
8
9
9
$:. unshift ( File . expand_path ( "../lib" , __dir__ ) )
10
10
require "ripper"
11
- require "yarp "
11
+ require "prism "
12
12
13
13
if ARGV [ 0 ] == "-e"
14
14
source = ARGV [ 1 ]
@@ -21,33 +21,33 @@ pattern = "%-70s %-70s"
21
21
22
22
ripper =
23
23
begin
24
- YARP . lex_ripper ( source )
24
+ Prism . lex_ripper ( source )
25
25
rescue ArgumentError , SyntaxError
26
26
# If Ripper raises a syntax error, we want to continue as if it didn't
27
- # return any tokens at all. YARP won't raise a syntax error, so it's nicer
28
- # to still be able to see the tokens that YARP generated.
27
+ # return any tokens at all. prism won't raise a syntax error, so it's nicer
28
+ # to still be able to see the tokens that prism generated.
29
29
[ ]
30
30
end
31
31
32
- yarp = YARP . lex_compat ( source , filepath )
33
- if yarp . errors . any?
32
+ prism = Prism . lex_compat ( source , filepath )
33
+ if prism . errors . any?
34
34
puts "Errors lexing:"
35
- yarp . errors . map do |error |
35
+ prism . errors . map do |error |
36
36
print "- [#{ error . location . start_line } ,#{ error . location . start_column } -"
37
37
print "#{ error . location . end_line } ,#{ error . location . end_column } ] "
38
38
puts "\e [1;31m#{ error . message } \e [0m"
39
39
end
40
40
puts "\n "
41
41
end
42
42
43
- puts pattern % [ "Ripper lex" , "YARP lex" ]
43
+ puts pattern % [ "Ripper lex" , "Prism lex" ]
44
44
puts pattern % [ "-" * 70 , "-" * 70 ]
45
45
46
- yarp_value = yarp . value
46
+ prism_value = prism . value
47
47
48
- [ yarp_value . length , ripper . length ] . max . times do |index |
48
+ [ prism_value . length , ripper . length ] . max . times do |index |
49
49
left = ripper [ index ]
50
- right = yarp_value [ index ]
50
+ right = prism_value [ index ]
51
51
52
52
color = left == right ? "38;5;102" : "1;31"
53
53
0 commit comments