Uga_Uga

Don't use this. Use Treetop or OMeta.

Installation

gem 'uga_uga'

Usage

  require "uga_uga"

  code = <<-EOF
    bobby {
      howie { :funny }
      mandel { "comedian" }
    }
  EOF

  results = []

  Uga_Uga.uga code do |name, blok|

    case name

    when "bobby"
      results << "bobby was called"
      blok

    when "howie"
      results << "howie was called"
      blok

    when "mandel"
      results << "mandel was called"
      blok

    when ":funny", '"comedian"'

    else
      fail ArgumentError, "Command not found: #{name.inspect}"
    end

  end

  puts results.inspect