match
gfc_match_generic_spec (interface_type * type,
                        char *name,
                        gfc_intrinsic_op *operator)
{
    char buffer[GFC_MAX_SYMBOL_LEN + 1];
    match m;
    gfc_intrinsic_op i;

    if (gfc_match (" assignment ( = )") == MATCH_YES)
    {
        *type = INTERFACE_INTRINSIC_OP;
        *operator = INTRINSIC_ASSIGN;
        return MATCH_YES;
    }

    if (gfc_match (" operator ( %o )", &i) == MATCH_YES)
    {   /* Operator i/f */
        *type = INTERFACE_INTRINSIC_OP;
        *operator = fold_unary (i);
        return MATCH_YES;
    }

    if (gfc_match (" operator ( ") == MATCH_YES)
    {
        m = gfc_match_defined_op_name (buffer, 1);
        if (m == MATCH_NO)
            goto syntax;
        if (m != MATCH_YES)
            return MATCH_ERROR;

        m = gfc_match_char (')');
        if (m == MATCH_NO)
            goto syntax;
        if (m != MATCH_YES)
            return MATCH_ERROR;

        strcpy (name, buffer);
        *type = INTERFACE_USER_OP;
        return MATCH_YES;
    }

    if (gfc_match_name (buffer) == MATCH_YES)
    {
        strcpy (name, buffer);
        *type = INTERFACE_GENERIC;
        return MATCH_YES;
    }

    *type = INTERFACE_NAMELESS;
    return MATCH_YES;

syntax:
    gfc_error ("Syntax error in generic specification at %C");
    return MATCH_ERROR;
}
Esempio n. 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;
}