Latte\Parser::parseMacroTag PHP Method

parseMacroTag() public method

Parses macro tag to name, arguments a modifiers parts.
public parseMacroTag ( $tag ) : array
return array
    public function parseMacroTag($tag)
    {
        if (!preg_match('~^
			(?P<closing>/?)
			(
				(?P<name>\\?|[a-z]\\w*+(?:[.:]\\w+)*+(?!::|\\(|\\\\))|   ## ?, name, /name, but not function( or class:: or namespace\\
				(?P<noescape>!?)(?P<shortname>[=\\~#%^&_]?)      ## !expression, !=expression, ...
			)(?P<args>(?:' . self::RE_STRING . '|[^\'"])*?)
			(?P<modifiers>(?<!\\|)\\|[a-z](?P<modArgs>(?:' . self::RE_STRING . '|(?:\\((?P>modArgs)\\))|[^\'"/()]|/(?=.))*+))?
			(?P<empty>/?\\z)
		()\\z~isx', $tag, $match)) {
            if (preg_last_error()) {
                throw new RegexpException(NULL, preg_last_error());
            }
            return FALSE;
        }
        if ($match['name'] === '') {
            $match['name'] = $match['shortname'] ?: ($match['closing'] ? '' : '=');
            if ($match['noescape']) {
                trigger_error("The noescape shortcut {!...} is deprecated, use {...|noescape} modifier on line {$this->getLine()}.", E_USER_DEPRECATED);
                $match['modifiers'] .= '|noescape';
            }
        }
        return [$match['name'], trim($match['args']), $match['modifiers'], (bool) $match['empty'], (bool) $match['closing']];
    }