Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Parsing a ruby code

Reply
Thread Tools

Parsing a ruby code

 
 
Zeeshan Haq
Guest
Posts: n/a
 
      06-08-2008
Hello,
I am using the below given code to parse ruby code line by line and
generate its s-expression (AST). The help i need from you is that i want
to parse the whole ruby file at a time instead of parsing line by line.

require "ruby_parser"
# puts RubyParser.new.parse("My name is defecto")
counter = 1
file = File.new("readfile.rb", "r")

while (line = file.gets)
puts "#{counter}: #{RubyParser.new.parse(line)}"
counter = counter + 1
end
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANN] Parsing Tutorial and YARD 1.0: A C++ Parsing Framework Christopher Diggins C++ 0 07-09-2007 09:01 PM
[ANN] Parsing Tutorial and YARD 1.0: A C++ Parsing Framework Christopher Diggins C++ 0 07-09-2007 08:58 PM
Parsing ruby-code with the ruby-interpreter itself cies Ruby 1 10-24-2006 01:38 PM
SAX Parsing - Weird results when parsing content between tags. Naren XML 0 05-11-2004 07:25 PM
Perl expression for parsing CSV (ignoring parsing commas when in double quotes) GIMME Perl 2 02-11-2004 05:40 PM



Advertisments