OSDN Git Service

2006-09-30 Brooks Moses <bmoses@stanford.edu>
[pf3gnuchains/gcc-fork.git] / gcc / fortran / matchexp.c
index e4bf44e..b319c24 100644 (file)
@@ -1,5 +1,6 @@
 /* Expression parser.
-   Copyright (C) 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006 Free Software Foundation,
+   Inc.
    Contributed by Andy Vaught
 
 This file is part of GCC.
@@ -122,6 +123,26 @@ next_operator (gfc_intrinsic_op t)
 }
 
 
+/* Call the INTRINSIC_PARENTHESES function.  This is both
+   used explicitly, as below, or by resolve.c to generate
+   temporaries.  */
+gfc_expr *
+gfc_get_parentheses (gfc_expr *e)
+{
+  gfc_expr *e2;
+
+  e2 = gfc_get_expr();
+  e2->expr_type = EXPR_OP;
+  e2->ts = e->ts;
+  e2->rank = e->rank;
+  e2->where = e->where;
+  e2->value.op.operator = INTRINSIC_PARENTHESES;
+  e2->value.op.op1 = e;
+  e2->value.op.op2 = NULL;
+  return e2;
+}
+
+
 /* Match a primary expression.  */
 
 static match
@@ -166,18 +187,7 @@ match_primary (gfc_expr ** result)
   if(!gfc_numeric_ts(&e->ts))
     *result = e;
   else
-    {
-      gfc_expr *e2 = gfc_get_expr();
-
-      e2->expr_type = EXPR_OP;
-      e2->ts = e->ts;
-      e2->rank = e->rank;
-      e2->where = where;
-      e2->value.op.operator = INTRINSIC_PARENTHESES;
-      e2->value.op.op1 = e;
-      e2->value.op.op2 = NULL;
-      *result = e2;
-    }
+    *result = gfc_get_parentheses (e);
 
   if (m != MATCH_YES)
     {