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(