From: Minero Aoki Date: 2003-11-22T10:59:24+09:00 Subject: Re: Ripper (Ruby Language Parser) to be imported in the standard library? Hi, In mail "Ripper (Ruby Language Parser) to be imported in the standard library?" surrender_it@yahoo.it (gabriele renzi @ google) wrote: > I think the need to use a parser/lexer for the ruby syntax is quite > important for everyone taht wants to write tools to enhance the > programming experience agreed. FYI, I'm developping newer version of Ripper, Ruby Parser Extention. Now almost all works are done. Notable change is: * Ruby 1.8 syntax support. * Ruby's parse.y compatible. (Just #undef RIPPER) * NO backward compatibility :-\ Example: ~/c/ripper % head tools/strip.rb last_is_void = false ARGF.each do |line| if line.strip.empty? puts() unless last_is_void last_is_void = true elsif /\A\#/ === line ; else print line last_is_void = false ~/c/ripper % ruby sample/lex.rb tools/strip.rb | head ["ident", "last_is_void"] ["sp", " "] ["op", "="] ["sp", " "] ["kw", "false"] ["nl", "\n"] ["const", "ARGF"] ["period", "."] ["ident", "each"] ["sp", " "] If you are interested in the latest ripper, check it out from my CVS repository: % cvs -d :pserver:anonymous@cvs.loveruby.net:/src co ripper Note that not all samples are rewritten for current ripper. Regards, Minero Aoki