From: NISHIO Mizuho Date: 2002-03-18T10:30:34+09:00 Subject: Re: Parsing Ruby > I'm looking for a good, simple, working parser for Ruby, in Ruby. It'd > be nice if it came with tests and maybe even some documentation. It'd > be nice if when you run it, it would run and not blow up looking for > some random file that doesn't come with it. > > Is there such a thing that folks can recommend? > > Thanks, > > Ron Jeffries > www.XProgramming.com > You are closing your eyes to a situation you do not wish to acknowledge. > --Professor Harold Hill I extract the parser from RDoc, and modify it. I use this parser in order to display the structure of the Ruby script(Module/Class/Method). Though I don't know this parser is good or simple, I hope this is userful. You can get it at http://jurader.s1.xrea.com/archive/browser.tar.gz There are some tests in this archive. But no documentation. This is the sample script. ------------- Sample --------------- exit if ARGV.size == 0 require 'parser/parser' #require 'pp' parser = FreeRIDE::Parser.new io = File.open(ARGV[0]) begin parser.scan(io) #pp parser.top_level p parser.top_level ensure io.close end end ----------------------------------- *********************** NISHIO Mizuho e-mail : gha@intrastore.cdc.com