Ripper (Ruby Language Parser) to be imported in the standard library?

  • Thread starter gabriele renzi @ google
  • Start date
G

gabriele renzi @ google

Hi gurus and nubys,

I just read the blog from Jim Weirich about RC3 and discovered that
people talked about the need for a ruby parser usable from ruby.
Now I even remember that people pointed out the need for this, and
for the ability to access the built-in parsed representation a few
times.

I wonder if there is will to provide such a functionality in newer
release
(i.e. 1.9 or even better 1.8.2 ;).

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

(syntax highlight for editors, refactoring stuff, possibly
rubyToWhateverOtherLang compilers, code beautyfiers, even IRB lexer
sometimes goes out of sync with the change to the syntax..)

Some info ?
 
M

Minero Aoki

Hi,

In mail "Ripper (Ruby Language Parser) to be imported in the standard library?"
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:[email protected]:/src co ripper

Note that not all samples are rewritten for current ripper.


Regards,
Minero Aoki
 
R

Richard Kilmer

Wonderful Minero!

I just checked it out, built it (and turned it into a Ruby gem ;-)

Now its time to install this in FreeRIDE.

-rich
 
M

Martin DeMello

Richard Kilmer said:
Wonderful Minero!

I just checked it out, built it (and turned it into a Ruby gem ;-)

Is that still active? Nice to know! What's the current status, and is
there a guide anywhere on porting existing packages?

martin
 
G

gabriele renzi

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 :-\

hey, we can accept the #3 fact and have a party for the other two.
I have to ask questions more often :)

If you are interested in the latest ripper, check it out from
my CVS repository:

% cvs -d :pserver:[email protected]:/src co ripper

still, I think this should go in the standard library CVS.. someone
would start a poll please? ;)

thank you very much for this
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top