/** * Produces output for an evaluated PHP-document. This means * that the main strategy delivers an String representing the output * of the PHP-script. * * @author Eric Bouwers */ module php/strategy/const-prop/output rules php-get-evaluated-string: TemplateDocument(lit-or-echo) -> output where lit-or-echos' := <map(output-from-lit-or-echo)> lit-or-echo ; output := <concat-strings> lit-or-echos' php-get-evaluated-string: Document(top-html,_,stats,_,bottom-html) -> output where top-html' := <map(output-from-lit-or-echo)> top-html ; stats' := <map(output-from-statement)> stats ; bottom-html' := <map(output-from-lit-or-echo)> bottom-html ; output := <concat ; concat-strings> [top-html',stats',bottom-html'] rules output-from-lit-or-echo: Literal(txt) -> txt output-from-lit-or-echo: InlineEcho(_,expr,_,_) -> value where value := <get-simple-raw-string-value> expr rules // General rule. A statement has no output! output-from-statement: t -> "" where <not(?Echo(_))> t ; <not(?InlineHTML(_,_,_))> t output-from-statement: Echo(exprs) -> output where exprs' := <map(get-simple-raw-string-value)> exprs ; output := <concat-strings> exprs' output-from-statement: InlineHTML(_,lit-or-echo,_) -> output where lit-or-echos' := <map(output-from-lit-or-echo)> lit-or-echo ; output := <concat-strings> lit-or-echos'