/**
  *  Will return a normalized ie unicode sequences been evaluated.
  *
  *  @return string a normalized character class string
  *  @param ReverseRegex\Generator\Scope $head
  *  @param ReverseRegex\Generator\Scope $set
  *  @param Lexer $lexer the lexer to normalize
  */
 public function normalize(Scope $head, Scope $set, Lexer $lexer)
 {
     $collection = array();
     $unicode = new Unicode();
     while ($lexer->moveNext() && !$lexer->isNextToken(Lexer::T_SET_CLOSE)) {
         $value = null;
         switch (true) {
             case $lexer->isNextTokenAny(array(Lexer::T_SHORT_UNICODE_X, Lexer::T_SHORT_P, Lexer::T_SHORT_X)):
                 $collection[] = $unicode->evaluate($lexer);
                 break;
             case $lexer->isNextTokenAny(array(Lexer::T_LITERAL_CHAR, Lexer::T_LITERAL_NUMERIC)):
                 $collection[] = $lexer->lookahead['value'];
                 break;
             case $lexer->isNextToken(Lexer::T_SET_RANGE):
                 $collection[] = '-';
                 break;
             case $lexer->isNextToken(Lexer::T_ESCAPE_CHAR):
                 $collection[] = '\\';
                 break;
             default:
                 throw new ParserException('Illegal meta character detected in character class');
         }
     }
     /*
             if($lexer->lookahead['type'] === null) {
                 throw new ParserException('Closing character set token not found');
             } */
     return '[' . implode('', $collection) . ']';
 }
 public function testShortX()
 {
     $lexer = new Lexer('\\x64');
     $scope = new Scope();
     $parser = new Unicode();
     $head = new LiteralScope('lit1', $scope);
     $lexer->moveNext();
     $lexer->moveNext();
     $parser->parse($head, $scope, $lexer);
     $result = $head->getLiterals();
     $this->assertEquals('d', $result[0]);
 }