Skip to content

da99/uga_uga

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A Rubygem for people too lazy to use Treetop or OMeta.

Resources

License

Stars

Watchers

Forks

Packages

No packages published