Project

luobo

0.0
No commit activity in last 3 years
No release in over 3 years
Luobo is an easy to extend code generator.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.5

Runtime

>= 0
 Project Readme

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