

Racc full package for parser development (compiling. Sexp_processor for Sexp and SexpProcessor classes, and testing. Until all of these are done, you won’t have a clean test run. Require generated parser in lib/ruby_parser.rb.Īdd new V# = ::Ruby#Parser end to ruby_parser.rb (bottom of file).Īdd empty TestRubyParserShared#Plus module and TestRubyParserV# to test/test_ruby_parser.rb.Įxtend Manifest.txt with generated file names.Īdd new version number to sexp_processor’s pt_testcase.rb in all_versions New parser should be generated from lib/ruby_parser.yy.Įxtend lib/ruby_parser.yy with new class name.Īdd new version number to V2/V3 in Rakefile for rule creation.Īdd new ‘ruby_parse “x.y.z”` line to Rakefile for rake compare (line ~300). You can also use Ruby19Parser, Ruby18Parser, or RubyParser.for_current_ruby: RubyParser. Known Issue: line number values can be slightly off.
#PRINTRIPPER S CODE#
Known Issue: Code is much better, but still has a long way to go. MRI+PT parsed the same in 67.38s (avg 200.89 Kb/s) RP parses a corpus of 3702 files in 125s (avg 108 Kb/s) Known Issue: Speed is now pretty good, but can always improve:

Includes preceding comment data for defn/defs/class/module nodes!Ĭan utilize PT’s SexpProcessor and UnifiedRuby for language processing. Tested against 2,672,412 unique ruby files across 167k gems. It outputs s-expressions which can be manipulated and converted back to ruby via the ruby2ruby gem.Īs an example: def conditional1 arg1 return 1 if arg1 = 0 return 0 endīecomes: s( :defn, :conditional1, s( :args, :arg1), Ruby_parser (RP) is a ruby parser written in pure ruby (utilizing racc–which does by default use a C extension). seattlerb/ruby_parser/issues rdocĭ/ruby_parser DESCRIPTION: ¶ ↑
