$b->addToLexeme($b->getCharacter());
    $b->next();
}
$b->setType('baz');
$b->commit();
$t->is($b->next(), 'p', '->next() returns the next character.');
for ($x = 0; $x < 4; $x++) {
    $b->addToLexeme($b->getCharacter());
    $b->next();
}
$b->setType('gab');
$t->is($b->getType(), 'gab', '->getType() is returns the type');
$b->commit();
$b->advancePosition(3);
$t->is($b->getPosition(), 15, '->advancePosition() moves the position up');
$t->is($b->next(), false, '->next() returns false when at the end');
$t->is($b->getLexeme(2)->getLexeme(), 'pròj', '->getLexeme() looks up in the index.');
$t->is($b->getLexeme(-1)->getLexeme(), 'pròj', '->getLexeme() with negative goes backwards in index');
try {
    $msg = '->getLexeme() fails if the commit is out of range';
    $b->getLexeme(-10);
    $t->fail($msg);
} catch (Exception $e) {
    $t->pass($msg);
}
$b->commit();
$t->is($b->count(), 3, '->commit() does not create a new lexeme if the text is empty');
$b = new xfLexemeBuilder('102');
$t->is($b->next(), 1, '->next() works on numbers');
$t->is($b->next(), 0, '->next() works on numbers');
$t->is($b->next(), 2, '->next() works on numbers');
 /**
  * Creates the lexemes.
  */
 private function process()
 {
     while (false !== ($char = $this->builder->next())) {
         $this->fsm->process($this->translateCharacter($char));
     }
     $this->fsm->process(self::IN_WHITE);
     if ($this->fsm->getState() !== self::ST_WHITE) {
         throw new xfParserException('Unexpected end of query.');
     }
 }