A simple, easy to extend code generator
Ruby Lua
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
backup
examples
lib
spec
.gitignore
README.rdoc
Rakefile
luobo.gemspec
temp.rb

README.rdoc

Luobo

Luobo is a code-generator that can expands macros defined in a source file.

Basically you use luobo by extends a Converter:

require "luobo"
class LuaSpecConverter < Luobo::Converter
  def regex_comment_header; '^\s*--' end
  def do_hello token
    "-- Hello, " + token.line_code + "!"
  end
end

You write a lua file (`test.lua`) like:

require "some_code"
-- HELLO: world

You run:

LuaSpecConverter.new('test.lua', STDOUT).convert

Then you will get those in stdout:

require "some_code"
-- Hello, world!

Inline processor like:

save to file ##FILE: name##

If you define

def do_file token
  '<tt class="filename">' + token.line_code + '</tt>'
end

will become:

<tt class="filename">token.line_code</tt>

TODO:

  • block inside comments

  • more robust tests

  • remove bin file