Uga_Uga

Don't use this. Use Treetop or OMeta.

Installation

gem 'uga_uga'

Usage

  require "uga_uga"

  code = "    bobby {\n      howie { :funny }\n      mandel { \"comedian\" }\n    }\n  EOF\n\n  results = []\n\n  Uga_Uga.uga code do |name, blok|\n\n    case name\n\n    when \"bobby\"\n      results << \"bobby was called\"\n      blok\n\n    when \"howie\"\n      results << \"howie was called\"\n      blok\n\n    when \"mandel\"\n      results << \"mandel was called\"\n      blok\n\n    when \":funny\", '\"comedian\"'\n\n    else\n      fail ArgumentError, \"Command not found: \#{name.inspect}\"\n    end\n\n  end\n\n  puts results.inspect\n\n"