Tale\Jade\Parser::handleExpansion PHP Méthode

handleExpansion() protected méthode

If there's no current element, we don't expand anything and throw an exception If there's no space behind the : and the next token is a -token, we don't treat this as an expansion, but rather as a tag-extension (a:b === , a: b === ) This is important for XML and XML-namespaces Notice that, right now, any element that can also land in $_current can be expanded (so almost all elements there are) It just makes no sense for some elements ("extends", "include") $_current is reset after the expansion so that we can collect the expanding element and handle it on a newLine or in an indent
protected handleExpansion ( array $token )
$token array the -token
    protected function handleExpansion(array $token)
    {
        if (!$this->current) {
            $this->throwException("An element expansion needs a preceding element. It can't be used stand-alone.", $token);
        }
        if ($this->current->type === 'element' && !$token['withSpace']) {
            if (!$this->expectNext(['tag'])) {
                $this->throwException(sprintf("Expected a tag name or an expanding element after block expansion, " . "a %s-node was given.", $this->getToken()['type']), $token);
            }
            $token = $this->getToken();
            $this->current->tag .= ':' . $token['name'];
            return;
        }
        if ($this->expansion) {
            $this->current->expands = $this->expansion;
        }
        $this->expansion = $this->current;
        $this->current = null;
    }