getNextToken example


    protected function parseJSXFragment()
    {
        $startOpeningToken = $this->scanner->getToken();
        if (!$startOpeningToken || $startOpeningToken->value !== "<") {
            return null;
        }
        
        $endOpeningToken = $this->scanner->getNextToken();
        if (!$endOpeningToken || $endOpeningToken->value !== ">") {
            return null;
        }
        
        $this->scanner->consumeToken();
        $this->scanner->consumeToken();
        
        $children = $this->parseJSXChildren();
        
        if (!($startClosingToken = $this->scanner->consume("<")) ||
            !$this->scanner->consume("/") ||
            !

    protected function checkAsyncFunctionStart($checkFn = true)
    {
        return ($asyncToken = $this->scanner->getToken()) &&
        $asyncToken->value === "async" &&
        (
            !$checkFn ||
            (($nextToken = $this->scanner->getNextToken()) &&
                $nextToken->value === "function")
        ) &&
        $this->scanner->noLineTerminators(true) ?
            $asyncToken :
            null;
    }
    
    /** * Parses function or generator declaration * * @param bool $default Default mode * @param bool $allowGenerator True to allow parsing of generators * * @return Node\FunctionDeclaration|null */

    public function getState()
    {
        //Consume current and next tokens so that they wont' be parsed again         //if the state is restored. If the current token is a slash the next         //token isn't parsed, this prevents some edge cases where a regexp         //that contains something that can be interpreted as a comment causes         //the content to be parsed as a real comment too         $token = $this->currentToken ?: $this->getToken();
        if ($token && $token->value !== "/") {
            $this->getNextToken();
        }
        $state = array();
        foreach ($this->stateProps as $prop) {
            $state[$prop] = $this->$prop;
        }
        if ($this->registerTokens) {
            $state["tokensNum"] = count($this->tokens);
        }
        //Emit the FreezeState event and pass the given state so that listeners         //attached to this event can add data         $this->eventsEmitter && $this->eventsEmitter->fire(
            
Home | Imprint | This part of the site doesn't use cookies.