Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Parser.php

function Parser::consumeUntil

Consumes all the characters until the given one is reached

Parameters

string $stop Stop character:

bool $removeEscapes If false escape characters won't be removed:

false $includeStop If true stop character will be returned:

Return value

string|null

2 calls to Parser::consumeUntil()
Parser::parseLiteralRegex in vendor/mck89/peast/lib/Peast/Selector/Parser.php
Parses a literal regex
Parser::parseLiteralString in vendor/mck89/peast/lib/Peast/Selector/Parser.php
Parses a literal string

File

vendor/mck89/peast/lib/Peast/Selector/Parser.php, line 478

Class

Parser
Selector parser class

Namespace

Peast\Selector

Code

protected function consumeUntil($stop, $removeEscapes = true, $includeStop = false) {
    $buffer = "";
    $escaped = false;
    while (($char = $this->getChar()) !== null) {
        $this->index += 1;
        if (!$escaped) {
            if ($char === "\\") {
                $escaped = true;
                if (!$removeEscapes) {
                    $buffer .= $char;
                }
                continue;
            }
            elseif ($char === $stop) {
                if ($includeStop) {
                    $buffer .= $char;
                }
                return $buffer;
            }
        }
        $buffer .= $char;
        $escaped = false;
    }
    return null;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal