Project

uga_uga

0.0
No commit activity in last 3 years
No release in over 3 years
It takes in a String and gives you back a stupid data structure of commands, blocks, and Strings. You then do stuff to make that stuff come alive. Whatever... I don't have time to tell you exactly since you will use Treetop anyway: https://github.com/nathansobo/treetop
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

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