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

Breadcrumb

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

function Scanner::getState

Returns the current scanner state

Return value

array

File

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

Class

Scanner
Base class for scanners.

Namespace

Peast\Syntax

Code

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("FreezeState", array(
        &$state,
    ));
    return $state;
}

API Navigation

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