Pristine Ack-5.5
[Ack-5.5.git] / util / cpp / expr.c
1 /* $Id: expr.c,v 1.4 1994/06/24 10:18:13 ceriel Exp $ */
2 /*
3  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4  * See the copyright notice in the ACK home directory, in the file "Copyright".
5  */
6 /* OPERATOR HANDLING */
7
8 #include        "Lpars.h"
9
10 int
11 rank_of(oper)
12         int oper;
13 {
14         /*      The rank of the operator oper is returned.
15         */
16         switch (oper)   {
17         default:
18                 return 0;
19         case '(':
20                 return 1;
21         case '!':
22                 return 2;
23         case '*':
24         case '/':
25         case '%':
26                 return 3;
27         case '+':
28         case '-':
29                 return 4;
30         case LEFT:
31         case RIGHT:
32                 return 5;
33         case '<':
34         case '>':
35         case LESSEQ:
36         case GREATEREQ:
37                 return 6;
38         case EQUAL:
39         case NOTEQUAL:
40                 return 7;
41         case '&':
42                 return 8;
43         case '^':
44                 return 9;
45         case '|':
46                 return 10;
47         case AND:
48                 return 11;
49         case OR:
50                 return 12;
51         case '?':
52         case ':':
53                 return 13;
54         case ',':
55                 return 15;
56         }
57         /*NOTREACHED*/
58 }