From 04ee002e30b5451d505ee5abd9c6b97c40da2df0 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Mon, 21 Oct 2013 12:47:41 +0200 Subject: Removed old parse function and added some documentation. --- stupid_template_engine.php | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'stupid_template_engine.php') diff --git a/stupid_template_engine.php b/stupid_template_engine.php index 386f760..78a3eec 100644 --- a/stupid_template_engine.php +++ b/stupid_template_engine.php @@ -106,6 +106,11 @@ class RuntimeError extends \Exception {} */ class FatalRuntimeError extends \Exception {} +/* + * Class: Parser + * The class, where the parser lives in. Can not be constructed manually. + * Use the static method parse. + */ class Parser { private $text; private $name; @@ -205,6 +210,22 @@ class Parser { return $name; } + /* + * Function: parse + * Parses the input into an AST. + * + * You only need this function, if you want to manually trnascompile a template. + * + * Parameters: + * $text - The input code. + * $name - The name of the template. + * + * Returns: + * An array of objects. + * + * Throws: + * + */ public static function parse($text, $name) { $obj = new self($text, $name); $res = $obj->parse_text( @@ -525,23 +546,6 @@ class Parser { } } -/* - * Function: parse - * Parsing a STE T/PL template. - * You only need this function, if you want to manually transcompile a template. - * - * Parameters: - * $code - The STE T/PL code. - * $tpl - The name of the template. - * - * Returns: - * An abstract syntax tree, which can be used with . - */ -function parse($code, $tpl) -{ - return mk_ast($code, $tpl, 0); -} - function indent_code($code) { return implode( -- cgit v1.2.3-70-g09d2