scanner_get_stream_size (scanner_info_t *info_p, /**< scanner info block */
                         size_t size) /**< size excluding the stream */
{
  const uint8_t *data_p = ((const uint8_t *) info_p) + size;
  const uint8_t *data_p_start = data_p;

  while (data_p[0] != SCANNER_STREAM_TYPE_END)
  {
    switch (data_p[0] & SCANNER_STREAM_TYPE_MASK)
    {
      case SCANNER_STREAM_TYPE_VAR:
#if JERRY_ESNEXT
      case SCANNER_STREAM_TYPE_LET:
      case SCANNER_STREAM_TYPE_CONST:
      case SCANNER_STREAM_TYPE_LOCAL:
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
      case SCANNER_STREAM_TYPE_IMPORT:
#endif /* JERRY_MODULE_SYSTEM */
      case SCANNER_STREAM_TYPE_ARG:
#if JERRY_ESNEXT
      case SCANNER_STREAM_TYPE_ARG_VAR:
      case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG:
      case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR:
#endif /* JERRY_MODULE_SYSTEM */
      case SCANNER_STREAM_TYPE_ARG_FUNC:
#if JERRY_ESNEXT
      case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_FUNC:
#endif /* JERRY_ESNEXT */
      case SCANNER_STREAM_TYPE_FUNC:
      {
        break;
      }
      default:
      {
        JERRY_ASSERT ((data_p[0] & SCANNER_STREAM_TYPE_MASK) == SCANNER_STREAM_TYPE_HOLE
                      || SCANNER_STREAM_TYPE_IS_ARGUMENTS (data_p[0] & SCANNER_STREAM_TYPE_MASK));
        data_p++;
        continue;
      }
    }

    data_p += 3;

    if (data_p[-3] & SCANNER_STREAM_UINT16_DIFF)
    {
      data_p++;
    }
    else if (data_p[-1] == 0)
    {
      data_p += sizeof (const uint8_t *);
    }
  }

  return size + 1 + (size_t) (data_p - data_p_start);
} /* scanner_get_stream_size */
scanner_get_stream_size (scanner_info_t *info_p,  
                         size_t size)  
{
  const uint8_t *data_p = ((const uint8_t *) info_p) + size;
  const uint8_t *data_p_start = data_p;

  while (data_p[0] != SCANNER_STREAM_TYPE_END)
  {
    switch (data_p[0] & SCANNER_STREAM_TYPE_MASK)
    {
      case SCANNER_STREAM_TYPE_VAR:
#if JERRY_ESNEXT
      case SCANNER_STREAM_TYPE_LET:
      case SCANNER_STREAM_TYPE_CONST:
      case SCANNER_STREAM_TYPE_LOCAL:
#endif  
#if JERRY_MODULE_SYSTEM
      case SCANNER_STREAM_TYPE_IMPORT:
#endif  
      case SCANNER_STREAM_TYPE_ARG:
#if JERRY_ESNEXT
      case SCANNER_STREAM_TYPE_ARG_VAR:
      case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG:
      case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR:
#endif  
      case SCANNER_STREAM_TYPE_ARG_FUNC:
#if JERRY_ESNEXT
      case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_FUNC:
#endif  
      case SCANNER_STREAM_TYPE_FUNC:
      {
        break;
      }
      default:
      {
        JERRY_ASSERT ((data_p[0] & SCANNER_STREAM_TYPE_MASK) == SCANNER_STREAM_TYPE_HOLE
                      || SCANNER_STREAM_TYPE_IS_ARGUMENTS (data_p[0] & SCANNER_STREAM_TYPE_MASK));
        data_p++;
        continue;
      }
    }

    data_p += 3;

    if (data_p[-3] & SCANNER_STREAM_UINT16_DIFF)
    {
      data_p++;
    }
    else if (data_p[-1] == 0)
    {
      data_p += sizeof (const uint8_t *);
    }
  }

  return size + 1 + (size_t) (data_p - data_p_start);
}  