tan  0.0.1
precedence.h
1 #ifndef __TAN_SRC_AST_PRECEDENCE_H__
2 #define __TAN_SRC_AST_PRECEDENCE_H__
3 
4 namespace tanlang {
5 
6 /**
7  * \brief Operator precedence as enums. The higher the value, the higher the precedence
8  */
9 enum PrecedenceLevel {
10  PREC_LOWEST = 0, //
11  PREC_LITERAL = 10, // "string" 1.0 2
12  PREC_ASSIGN = 90, // = *= /= %= += -= <<= >>= &= ^= |=
13  PREC_LOGICAL_OR = 110, // ||
14  PREC_LOGICAL_AND = 120, // &&
15  PREC_COMPARISON = 130, // < <= > >= == != === !== ~=
16  PREC_RANGE = 135, // ..< ...
17  PREC_TERM = 140, // + - | ^
18  PREC_FACTOR = 150, // * / % &
19  PREC_CAST = 155, // as
20  PREC_SHIFT = 160, // << >>
21  PREC_UNARY = 170, // + - ! ~
22  PREC_CALL = 200, // . ( [
23  PREC_HIGHEST = 500,
24 };
25 
26 } // namespace tanlang
27 
28 #endif //__TAN_SRC_AST_PRECEDENCE_H__