public function parse($content)
 {
     $this->input = new StringInputStream($content);
     $this->output = new StringOutputStream();
     $this->output->write('<?php ' . TemplateSyntaxElement::RESULT . '=\'');
     $this->do_parse();
     $this->output->write('\'; ?>');
     return $this->output->to_string();
 }
 public function parse(TemplateSyntaxParserContext $context, StringInputStream $input, StringOutputStream $output)
 {
     $matches = array();
     if ($input->consume_next('(?P<var>\\w+)', '', $matches)) {
         $varname = $matches['var'];
         $output->write(TemplateSyntaxElement::DATA . '->get(\'' . $varname . '\')');
     } else {
         throw new TemplateRenderingException('invalid simple variable name', $input);
     }
 }
 public function parse(TemplateSyntaxParserContext $context, StringInputStream $input, StringOutputStream $output)
 {
     $matches = array();
     if ($input->consume_next('(?P<constant>(?:[0-9]+(?:\\.[0-9]+)?)|(?:\'[^\']*\')|(?:true)|(?:false))', '', $matches)) {
         $constant = $matches['constant'];
         $output->write($constant);
     } else {
         throw new TemplateRenderingException('invalid constant variable', $input);
     }
 }
 public function parse(TemplateSyntaxParserContext $context, StringInputStream $input, StringOutputStream $output)
 {
     $matches = array();
     if ($input->consume_next('@(?P<html>H\\|)?(?P<msg>[a-z0-9A-Z_][\\w_.]*)', '', $matches)) {
         $is_html = $matches['html'];
         $msg = $matches['msg'];
         $function = $is_html ? 'i18nraw' : 'i18n';
         $output->write(TemplateSyntaxElement::FUNCTIONS . '->' . $function . '(\'' . $msg . '\')');
     } else {
         throw new TemplateRenderingException('invalid simple variable name', $input);
     }
 }