lexer_unchecked_hex_to_character (const uint8_t **source_p) /**< [in, out] current source position */
{
  lit_code_point_t result = 0;
  const uint8_t *char_p = *source_p;
  uint32_t length = (char_p[-1] == LIT_CHAR_LOWERCASE_U) ? 4 : 2;

#if JERRY_ESNEXT
  if (char_p[0] == LIT_CHAR_LEFT_BRACE)
  {
    length = 0;
    char_p++;
  }
#endif /* JERRY_ESNEXT */

  while (true)
  {
    uint32_t byte = *char_p++;

    result <<= 4;

    if (byte >= LIT_CHAR_0 && byte <= LIT_CHAR_9)
    {
      result += byte - LIT_CHAR_0;
    }
    else
    {
      JERRY_ASSERT ((byte >= LIT_CHAR_LOWERCASE_A && byte <= LIT_CHAR_LOWERCASE_F)
                    || (byte >= LIT_CHAR_UPPERCASE_A && byte <= LIT_CHAR_UPPERCASE_F));

      result += LEXER_TO_ASCII_LOWERCASE (byte) - (LIT_CHAR_LOWERCASE_A - 10);
    }

    JERRY_ASSERT (result <= LIT_UNICODE_CODE_POINT_MAX);

#if JERRY_ESNEXT
    if (length == 0)
    {
      if (*char_p != LIT_CHAR_RIGHT_BRACE)
      {
        continue;
      }
      *source_p = char_p + 1;
      return result;
    }
#endif /* JERRY_ESNEXT */

    if (--length == 0)
    {
      *source_p = char_p;
      return result;
    }
  }
} /* lexer_unchecked_hex_to_character */
lexer_unchecked_hex_to_character (const uint8_t **source_p)  
{
  lit_code_point_t result = 0;
  const uint8_t *char_p = *source_p;
  uint32_t length = (char_p[-1] == LIT_CHAR_LOWERCASE_U) ? 4 : 2;

#if JERRY_ESNEXT
  if (char_p[0] == LIT_CHAR_LEFT_BRACE)
  {
    length = 0;
    char_p++;
  }
#endif  

  while (true)
  {
    uint32_t byte = *char_p++;

    result <<= 4;

    if (byte >= LIT_CHAR_0 && byte <= LIT_CHAR_9)
    {
      result += byte - LIT_CHAR_0;
    }
    else
    {
      JERRY_ASSERT ((byte >= LIT_CHAR_LOWERCASE_A && byte <= LIT_CHAR_LOWERCASE_F)
                    || (byte >= LIT_CHAR_UPPERCASE_A && byte <= LIT_CHAR_UPPERCASE_F));

      result += LEXER_TO_ASCII_LOWERCASE (byte) - (LIT_CHAR_LOWERCASE_A - 10);
    }

    JERRY_ASSERT (result <= LIT_UNICODE_CODE_POINT_MAX);

#if JERRY_ESNEXT
    if (length == 0)
    {
      if (*char_p != LIT_CHAR_RIGHT_BRACE)
      {
        continue;
      }
      *source_p = char_p + 1;
      return result;
    }
#endif  

    if (--length == 0)
    {
      *source_p = char_p;
      return result;
    }
  }
}  