Parsing a ruby code

Discussion in 'Ruby' started by Zeeshan Haq, Jun 8, 2008.

  1. Zeeshan Haq

    Zeeshan Haq Guest

    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/.
     
    Zeeshan Haq, Jun 8, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. GIMME
    Replies:
    2
    Views:
    935
    GIMME
    Feb 11, 2004
  2. Naren
    Replies:
    0
    Views:
    615
    Naren
    May 11, 2004
  3. Christopher Diggins
    Replies:
    0
    Views:
    631
    Christopher Diggins
    Jul 9, 2007
  4. Christopher Diggins
    Replies:
    0
    Views:
    458
    Christopher Diggins
    Jul 9, 2007
  5. cies
    Replies:
    1
    Views:
    114
    Dominik Bathon
    Oct 24, 2006
Loading...

Share This Page