Package template
Class TemplateEngine
- java.lang.Object
-
- template.TemplateEngine
-
- All Implemented Interfaces:
java.io.Serializable,sleep.interfaces.Function,sleep.interfaces.Loadable
public class TemplateEngine extends java.lang.Object implements sleep.interfaces.Loadable, sleep.interfaces.FunctionThis class is an implementation of the Sleep template engine. The template engine constructs an executable template that consists of strings to print and code to evaluate. Valid templates include: <% expression >%> <?sleep statement(s) ?>- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.MaptemplateCache
-
Constructor Summary
Constructors Constructor Description TemplateEngine()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description sleep.runtime.Scalarevaluate(java.lang.String name, sleep.runtime.ScriptInstance script, java.util.Stack args)static voidmain(java.lang.String[] args)protected sleep.engine.BlockparseCode(java.lang.String name, int lineNo, sleep.parser.ImportManager imports, java.lang.String code)parses the template codeTemplateparseTemplate(java.io.File name, java.lang.String code)parses a Sleep template file.voidscriptLoaded(sleep.runtime.ScriptInstance script)voidscriptUnloaded(sleep.runtime.ScriptInstance script)
-
-
-
Method Detail
-
scriptLoaded
public void scriptLoaded(sleep.runtime.ScriptInstance script)
- Specified by:
scriptLoadedin interfacesleep.interfaces.Loadable
-
scriptUnloaded
public void scriptUnloaded(sleep.runtime.ScriptInstance script)
- Specified by:
scriptUnloadedin interfacesleep.interfaces.Loadable
-
evaluate
public sleep.runtime.Scalar evaluate(java.lang.String name, sleep.runtime.ScriptInstance script, java.util.Stack args)- Specified by:
evaluatein interfacesleep.interfaces.Function
-
parseCode
protected sleep.engine.Block parseCode(java.lang.String name, int lineNo, sleep.parser.ImportManager imports, java.lang.String code) throws sleep.error.YourCodeSucksExceptionparses the template code- Throws:
sleep.error.YourCodeSucksException
-
parseTemplate
public Template parseTemplate(java.io.File name, java.lang.String code) throws sleep.error.YourCodeSucksException
parses a Sleep template file. Lots of fun for the whole family- Throws:
sleep.error.YourCodeSucksException
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
-