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

Breadcrumb

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

function Scanner::consumeToken

Consumes the current token

Return value

$this

2 calls to Scanner::consumeToken()
Scanner::consume in vendor/mck89/peast/lib/Peast/Syntax/Scanner.php
Checks if the given string is matched, if so it consumes the token
Scanner::consumeOneOf in vendor/mck89/peast/lib/Peast/Syntax/Scanner.php
Checks if one of the given strings is matched, if so it consumes the token

File

vendor/mck89/peast/lib/Peast/Syntax/Scanner.php, line 663

Class

Scanner
Base class for scanners.

Namespace

Peast\Syntax

Code

public function consumeToken() {
    
    //Move the scanner position to the end of the current position
    $this->position = $this->currentToken->location->end;
    
    //Before consume the token, consume comments associated with it
    if ($this->comments) {
        $this->consumeCommentsForCurrentToken();
    }
    
    //Register the token if required
    if ($this->registerTokens) {
        $this->tokens[] = $this->currentToken;
    }
    
    //Emit the TokenConsumed event for the consumed token
    $this->eventsEmitter && $this->eventsEmitter
        ->fire("TokenConsumed", array(
        $this->currentToken,
    ));
    $this->currentToken = $this->nextToken;
    $this->nextToken = null;
    return $this;
}

API Navigation

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