Uga_Uga

Don't use this. Use Parslet or OMeta.

Here is a video on creating your own external DSL: Writing DSL's with Parslet by Jason Garber

Installation

gem 'uga_uga'

Usage

  require "uga_uga"

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

  results = []

  Uga_Uga.new code do

    case

    when rex?("(white*)(word) { ")
      line = shift
      results << "#{captures.last} was called"
      {:raw=>grab_until(bracket(line, '}'))}

    when rex?(" (word) { (...) } ")
      results << "#{captures.first} called with #{captures.last}"

    else
      fail ArgumentError, "Command not found: #{l!.inspect}"

    end # === case name

  end # === .new

  results