ruby_parser 3.17.0 → 3.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/History.rdoc +109 -0
  4. data/Manifest.txt +5 -0
  5. data/README.rdoc +9 -6
  6. data/Rakefile +85 -24
  7. data/bin/ruby_parse_extract_error +1 -1
  8. data/compare/normalize.rb +6 -1
  9. data/gauntlet.md +108 -0
  10. data/lib/rp_extensions.rb +15 -36
  11. data/lib/rp_stringscanner.rb +20 -51
  12. data/lib/ruby20_parser.rb +7430 -3528
  13. data/lib/ruby20_parser.y +328 -257
  14. data/lib/ruby21_parser.rb +7408 -3572
  15. data/lib/ruby21_parser.y +323 -254
  16. data/lib/ruby22_parser.rb +7543 -3601
  17. data/lib/ruby22_parser.y +327 -256
  18. data/lib/ruby23_parser.rb +7549 -3612
  19. data/lib/ruby23_parser.y +327 -256
  20. data/lib/ruby24_parser.rb +7640 -3624
  21. data/lib/ruby24_parser.y +327 -256
  22. data/lib/ruby25_parser.rb +7640 -3623
  23. data/lib/ruby25_parser.y +327 -256
  24. data/lib/ruby26_parser.rb +7649 -3632
  25. data/lib/ruby26_parser.y +326 -255
  26. data/lib/ruby27_parser.rb +10132 -4545
  27. data/lib/ruby27_parser.y +871 -262
  28. data/lib/ruby30_parser.rb +10504 -4655
  29. data/lib/ruby30_parser.y +1065 -333
  30. data/lib/ruby31_parser.rb +13622 -0
  31. data/lib/ruby31_parser.y +3481 -0
  32. data/lib/ruby3_parser.yy +3536 -0
  33. data/lib/ruby_lexer.rb +261 -609
  34. data/lib/ruby_lexer.rex +27 -20
  35. data/lib/ruby_lexer.rex.rb +59 -23
  36. data/lib/ruby_lexer_strings.rb +638 -0
  37. data/lib/ruby_parser.rb +2 -0
  38. data/lib/ruby_parser.yy +903 -272
  39. data/lib/ruby_parser_extras.rb +333 -113
  40. data/test/test_ruby_lexer.rb +181 -129
  41. data/test/test_ruby_parser.rb +1529 -288
  42. data/tools/munge.rb +34 -6
  43. data/tools/ripper.rb +15 -10
  44. data.tar.gz.sig +0 -0
  45. metadata +27 -23
  46. metadata.gz.sig +0 -0
@@ -1,64 +1,33 @@
1
1
  require "strscan"
2
2
 
3
3
  class RPStringScanner < StringScanner
4
- # if ENV['TALLY'] then
5
- # alias :old_getch :getch
6
- # def getch
7
- # warn({:getch => caller[0]}.inspect)
8
- # old_getch
9
- # end
10
- # end
11
-
12
- if "".respond_to? :encoding then
13
- if "".respond_to? :byteslice then
14
- def string_to_pos
15
- string.byteslice(0, pos)
16
- end
17
- else
18
- def string_to_pos
19
- string.bytes.first(pos).pack("c*").force_encoding(string.encoding)
20
- end
21
- end
22
-
23
- def charpos
24
- string_to_pos.length
25
- end
26
- else
27
- alias :charpos :pos
28
-
29
- def string_to_pos
30
- string[0..pos]
31
- end
32
- end
33
-
34
- def unread_many str # TODO: remove this entirely - we should not need it
35
- warn({:unread_many => caller[0]}.inspect) if ENV['TALLY']
36
- begin
37
- string[charpos, 0] = str
38
- rescue IndexError
39
- # HACK -- this is a bandaid on a dirty rag on an open festering wound
40
- end
41
- end
42
-
43
- if ENV['DEBUG'] then
44
- alias :old_getch :getch
4
+ if ENV["DEBUG"] || ENV["TALLY"] then
45
5
  def getch
46
- c = self.old_getch
47
- p :getch => [c, caller.first]
6
+ c = super
7
+ where = caller.drop_while { |s| s =~ /(getch|nextc).$/ }.first
8
+ where = where.split(/:/).first(2).join(":")
9
+ if ENV["TALLY"] then
10
+ d getch:where
11
+ else
12
+ d getch:[c, where]
13
+ end
48
14
  c
49
15
  end
50
16
 
51
- alias :old_scan :scan
52
17
  def scan re
53
- s = old_scan re
54
- where = caller[1].split(/:/).first(2).join(":")
55
- d :scan => [s, where] if s
18
+ s = super
19
+ where = caller.drop_while { |x| x =~ /scan.$/ }.first
20
+ where = where.split(/:/).first(2).join(":")
21
+ if ENV["TALLY"] then
22
+ d scan:[where]
23
+ else
24
+ d scan:[s, where] if s
25
+ end
56
26
  s
57
27
  end
58
- end
59
28
 
60
- def d o
61
- $stderr.puts o.inspect
29
+ def d o
30
+ STDERR.puts o.inspect
31
+ end
62
32
  end
63
33
  end
64
-