SassParser::getNode PHP Method

getNode() public method

The tpye of SassNode depends on the content of the SassToken.
public getNode ( SassNode $node ) : SassNode | null
$node SassNode
return SassNode | null a SassNode of the appropriate type. Null when no more source to parse.
    public function getNode($node)
    {
        $token = $this->getToken();
        if (empty($token)) {
            return null;
        }
        switch (true) {
            case SassDirectiveNode::isa($token):
                return $this->parseDirective($token, $node);
            case SassCommentNode::isa($token):
                return new SassCommentNode($token);
            case SassVariableNode::isa($token):
                return new SassVariableNode($token);
            case SassPropertyNode::isa(array('token' => $token, 'syntax' => $this->getProperty_syntax())):
                return new SassPropertyNode($token, $this->property_syntax);
            case SassFunctionDefinitionNode::isa($token):
                return new SassFunctionDefinitionNode($token);
            case SassMixinDefinitionNode::isa($token):
                if ($this->syntax === SassFile::SCSS) {
                    if ($this->debug) {
                        throw new SassException('Mixin definition shortcut not allowed in SCSS', $this);
                    }
                    return NULL;
                } else {
                    return new SassMixinDefinitionNode($token);
                }
            case SassMixinNode::isa($token):
                if ($this->syntax === SassFile::SCSS) {
                    if ($this->debug) {
                        throw new SassException('Mixin include shortcut not allowed in SCSS', $this);
                    }
                    return NULL;
                } else {
                    return new SassMixinNode($token);
                }
            default:
                return new SassRuleNode($token);
                break;
        }
        // switch
    }