add compile_to_lua helper function

This commit is contained in:
leaf corcoran
2014-02-01 12:36:38 -08:00
parent 9fd6d7af0f
commit e81c4e4399
3 changed files with 24 additions and 0 deletions

View File

@@ -199,6 +199,11 @@ class Parser
setfenv fn, combined_env
fn buffer, #buffer, tostring, concat, html_escape
compile_to_lua: (str) =>
success, err = @parse str
return nil, err unless success
@chunks_to_lua!
-- generates the code of the template
chunks_to_lua: =>
-- todo: find a no-conflict name for locals