Latte\Parser::contextMacro PHP Method

contextMacro() private method

Handles CONTEXT_MACRO.
private contextMacro ( )
    private function contextMacro()
    {
        $matches = $this->match('~
			(?P<comment>\\*.*?\\*' . $this->delimiters[1] . '\\n{0,2})|
			(?P<macro>(?>
				' . self::RE_STRING . '|
				\\{(?>' . self::RE_STRING . '|[^\'"{}])*+\\}|
				[^\'"{}]+
			)++)
			' . $this->delimiters[1] . '
			(?P<rmargin>[ \\t]*(?=\\n))?
		~xsiA');
        if (!empty($matches['macro'])) {
            $token = $this->addToken(Token::MACRO_TAG, $this->context[1][1] . $matches[0]);
            list($token->name, $token->value, $token->modifiers, $token->empty, $token->closing) = $this->parseMacroTag($matches['macro']);
            $this->context = $this->context[1][0];
        } elseif (!empty($matches['comment'])) {
            $this->addToken(Token::COMMENT, $this->context[1][1] . $matches[0]);
            $this->context = $this->context[1][0];
        } else {
            throw new CompileException('Malformed macro');
        }
    }