1 /*
   2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 package jdk.test.lib.jittester;
  25 
  26 // all unary and binary operator kinds
  27 public enum OperatorKind {
  28     COMPOUND_ADD("+=",   1),
  29     COMPOUND_SUB("-=",   1),
  30     COMPOUND_MUL("*=",   1),
  31     COMPOUND_DIV("-=",   1),
  32     COMPOUND_MOD("%=",   1),
  33     COMPOUND_AND("&=",   1),
  34     COMPOUND_OR ("|=",   1),
  35     COMPOUND_XOR("^=",   1),
  36     COMPOUND_SHR(">>=",  1),
  37     COMPOUND_SHL("<<=",  1),
  38     COMPOUND_SAR(">>>=", 1),
  39     ASSIGN      ("=",    1),
  40     OR          ("||",   3),
  41     BIT_OR      ("|",    5),
  42     BIT_XOR     ("^",    6),
  43     AND         ("&&",   7),
  44     BIT_AND     ("&",    7),
  45     EQ          ("==",   8),
  46     NE          ("!=",   8),
  47     GT          (">",    9),
  48     LT          ("<",    9),
  49     GE          (">=",   9),
  50     LE          ("<=",   9),
  51     SHR         (">>",  10),
  52     SHL         ("<<",  10),
  53     SAR         (">>>", 10),
  54     ADD         ("+",   11),
  55     STRADD      ("+",   11),
  56     SUB         ("-",   11),
  57     MUL         ("*",   12),
  58     DIV         ("/",   12),
  59     MOD         ("%",   12),
  60     NOT         ("!",   14),
  61     BIT_NOT     ("~",   14),
  62     UNARY_PLUS  ("+",   14),
  63     UNARY_MINUS ("-",   14),
  64     PRE_DEC     ("--",  15, true),
  65     POST_DEC    ("--",  15, false),
  66     PRE_INC     ("++",  16, true),
  67     POST_INC    ("++",  16, false),
  68     ;
  69 
  70     public final String text;
  71     public final int priority;
  72     public final boolean isPrefix; // used for unary operators
  73 
  74     private OperatorKind(String text, int priority) {
  75         this(text, priority, true);
  76     }
  77 
  78     private OperatorKind(String text, int priority, boolean isPrefix) {
  79         this.text = text;
  80         this.priority = priority;
  81         this.isPrefix = isPrefix;
  82     }
  83 }