Skips to the next non-whitespace token.

@param int $direction

@return mixed
438746
public function skipToNextNonWhitespace($direction = self::DIR_FORWARD)
    {
        return $this->safeMove(function () use ($direction) {
            $this->moveWithCondition(function () {
                return $this->current()->getType() !== T_WHITESPACE;
            }, $direction);

            return $this;
        })->next();
    }
464703
public function setDirection($direction)
    {
        if ($direction === null) {
            $this->direction = $direction;
            return $this;
        }

        if (!is_string($direction)) {
            throw new InvalidArgumentException(
                'Direction must be a string.'
            );
        }

        $this->direction = strtolower($direction) === 'asc' ? 'ASC' : 'DESC';
        return $this;
    }
757337
public function nextIs($tokenName, $ignoreWhitespace = false)
    {
        $i = $this->index+1;
        $len = count($this->tokens);
        while ($i < $len) {
            $tok = $this->tokens[$i][0];
            if ($ignoreWhitespace && $tok === 'WHITESPACE') {
                $i++;
            } else {
                return $tok === $tokenName;
            }
        }
        return false;
    }
178228
public function marginRight($margin = null)
    {
        if ($margin === null) {
            return $this->_marginRight;
        }
        $this->_marginRight = $margin;

        return $this;
    }
265540
public function setOrderDirection($direction)
    {

        $direction = strtolower($direction);

        if (!in_array($direction, ['asc', 'desc'])) {
            throw new \InvalidArgumentException('$direction must be "asc" or "desc"');
        }

        $this->orderDirection = $direction;
        return $this;
    }
980985
function order($expr, $direction = \Sirel\Node\Order::ASC)
    {
        return $this->from()->order($expr, $direction);
    }
485860
public function skipSpaces($pos)
    {
        
        for ( $max = strlen ($this->src); $pos < $max; $pos++) {
            if (!$this->md->utils->isSpace($this->src[$pos])) { break; }
        }
        return $pos;
    }
1312248
public function order($direction = null)
    {
        if (is_null($direction)) {
            $direction = $this->getOrderDirection();
        } else {
            $this->setOrderDirection($direction);
        }

        // if a direction is set
        if (!empty($direction)) {
            if (!is_string($this->order) && is_callable($this->order)) {
                call_user_func_array($this->order, $this);
            } else {

                $table = $this->getTable();

                // verify that source is a query
                if (!$table->isSourceQueryBuilder()) {
                    throw new \Exception('Table source is not an instance of query builder');
                }

                $table->getSource()->orderBy($this->order, $direction);
            }
        }

        return $this;
    }
502488
public function skipWhitespaces($skipComment = false)
    {
        $skips = [T_WHITESPACE => true];

        if (!$skipComment) {
            $skips += [T_COMMENT => true, T_DOC_COMMENT => true];
        }

        $this->_current++;
        return $this->_skip($skips);
    }
434490
protected function adjustLines(array $lines, $direction)
    {
        $adjust_method = 'adjust' . ucwords(strtolower($direction))  . 'Lines';

        if (method_exists($this, $adjust_method)) {
            return $this->$adjust_method($lines);
        }

        return $lines;
    }
982516
public function getReverseDirection($lowercase = false)
    {
        $return = $this->direction === self::DESC ? self::ASC : self::DESC;
        if ($lowercase) {
            $return = \strtolower($return);
        }

        return $return;
    }
919506
public static function lastChangeComparator(int $direction = 1): Closure
    {
        return static function (GedcomRecord $x, GedcomRecord $y) use ($direction): int {
            return $direction * ($x->lastChangeTimestamp() <=> $y->lastChangeTimestamp());
        };
    }
973417
public static function validate(string $direction)
    {
        if (!isset(self::$directions[$direction])) {
            throw InvalidArgumentException::format(
                    'Invalid ordering direction: expecting one of (%s), \'%s\' given',
                    Debug::formatValues(array_keys(self::$directions)), $direction
            );
        }
    }
650801
protected function next()
    {
        while ($token = array_shift($this->tokens)) {
            $this->line += substr_count($this->value($token), "\n");

            if (is_array($token) && in_array($token[0], [T_WHITESPACE, T_COMMENT, T_DOC_COMMENT], true)) {
                continue;
            }

            return $token;
        }
    }
1173684
private function walk($count = 1)
    {
        $token = $nextToken = $this->lexer->token;

        for ($i = 0; ($i < $count) || ($token === $nextToken); ++$i) {
            $this->lexer->moveNext();
            $nextToken = $this->lexer->token;
        }

        return $nextToken;
    }
352267
private function _checkNoWhiteSpaceAfter($token) {
		if ($this->_isActive('noSpaceAfterToken')) {

			$text = $token->text;

			if (!$this->_config->isException('noSpaceAfterToken', $text)) {

				// The next token is a whitespace
				if ($this->tokenizer->checkNextToken(T_WHITESPACE)) {

					// And the next valid token is on the same line
					$tokenAfter = $this->tokenizer->peekNextValidToken();
					if ($tokenAfter->line === $token->line) {
						$msg = $this->_getMessage('NO_SPACE_AFTER_TOKEN', $text);
						$this->_writeError('noSpaceAfterToken', $msg);
					}
				}
			}
		}
	}
637388
public function exitTo($lines, $direction)
    {
        $lines       = $this->adjustLines($lines, $direction);
        $line_method = $this->getLineMethod($direction);

        $direction_keyframes = $this->getDirectionFrames($direction, $lines, $line_method);

        $keyframes   = array_fill(0, 4, $lines);
        $keyframes   = array_merge($keyframes, $direction_keyframes);
        $keyframes[] = array_fill(0, count($lines), '');

        return $keyframes;
    }