match
gfc_match_interface (void)
{
    char name[GFC_MAX_SYMBOL_LEN + 1];
    interface_type type;
    gfc_symbol *sym;
    gfc_intrinsic_op operator;
    match m;

    m = gfc_match_space ();

    if (gfc_match_generic_spec (&type, name, &operator) == MATCH_ERROR)
        return MATCH_ERROR;


    /* If we're not looking at the end of the statement now, or if this
       is not a nameless interface but we did not see a space, punt.  */
    if (gfc_match_eos () != MATCH_YES
            || (type != INTERFACE_NAMELESS
                && m != MATCH_YES))
    {
        gfc_error
        ("Syntax error: Trailing garbage in INTERFACE statement at %C");
        return MATCH_ERROR;
    }

    current_interface.type = type;

    switch (type)
    {
    case INTERFACE_GENERIC:
        if (gfc_get_symbol (name, NULL, &sym))
            return MATCH_ERROR;

        if (!sym->attr.generic
                && gfc_add_generic (&sym->attr, sym->name, NULL) == FAILURE)
            return MATCH_ERROR;

        current_interface.sym = gfc_new_block = sym;
        break;

    case INTERFACE_USER_OP:
        current_interface.uop = gfc_get_uop (name);
        break;

    case INTERFACE_INTRINSIC_OP:
        current_interface.op = operator;
        break;

    case INTERFACE_NAMELESS:
        break;
    }

    return MATCH_YES;
}
Пример #2
0
static match
match_defined_operator (gfc_user_op **result)
{
  char name[GFC_MAX_SYMBOL_LEN + 1];
  match m;

  m = gfc_match_defined_op_name (name, 0);
  if (m != MATCH_YES)
    return m;

  *result = gfc_get_uop (name);
  return MATCH_YES;
}