noLineTerminators example


        if (!$this->getNextToken()) {
            return false;
        }
        foreach ($expected as $val) {
            if (!is_array($val) || $val[0] !== $token->value) {
                continue;
            }
            //If the second value in the array is true check that the current             //token is not followed by line terminators, otherwise compare its             //value to the next token             if (($val[1] === true && $this->noLineTerminators(true)) ||
                ($val[1] !== true && $val[1] === $this->nextToken->value)) {
                return true;
            }
        }
        return false;
    }
    
    /** * Returns the next token * * @return Token|null */
/** * Parses a continue statement * * @return Node\ContinueStatement|null */
    protected function parseContinueStatement()
    {
        if ($token = $this->scanner->consume("continue")) {
            
            $node = $this->createNode("ContinueStatement", $token);
            
            if ($this->scanner->noLineTerminators() &&
                ($label = $this->parseIdentifier(static::$labelledIdentifier))
            ) {
                $node->setLabel($label);
                $this->assertEndOfStatement();
            } else {
                $this->scanner->consume(";");
            }
            
            return $this->completeNode($node);
        }
        return null;
    }

    protected function assertEndOfStatement()
    {
        //The end of statement is reached when it is followed by line         //terminators, end of source, "}" or ";". In the last case the token         //must be consumed         if (!$this->scanner->noLineTerminators()) {
            return true;
        } else {
            if ($this->scanner->consume(";")) {
                return true;
            }
            $token = $this->scanner->getToken();
            if (!$token || $token->value === "}") {
                return true;
            }
        }
        $this->error();
    }
Home | Imprint | This part of the site doesn't use cookies.