2016-01-28 14:52:40 +01:00
|
|
|
/** @file
|
|
|
|
|
*
|
|
|
|
|
* @par History
|
|
|
|
|
*/
|
2016-02-11 22:54:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __OPERATOR_H
|
|
|
|
|
#define __OPERATOR_H
|
|
|
|
|
|
|
|
|
|
#include "tokens.h"
|
2016-02-19 19:26:35 +01:00
|
|
|
namespace Pol
|
|
|
|
|
{
|
|
|
|
|
namespace Bscript
|
|
|
|
|
{
|
|
|
|
|
enum Precedence
|
|
|
|
|
{
|
|
|
|
|
PREC_PAREN = 14,
|
2020-04-23 19:12:04 -07:00
|
|
|
PREC_UNARY_OPS = 13,
|
|
|
|
|
PREC_MULT = 12,
|
|
|
|
|
PREC_PLUS = 11,
|
|
|
|
|
PREC_ELVIS = 10,
|
2016-02-19 19:26:35 +01:00
|
|
|
PREC_LESSTHAN = 9,
|
|
|
|
|
PREC_BSLEFT = 8,
|
|
|
|
|
PREC_BSRIGHT = 8,
|
|
|
|
|
PREC_BITAND = 8,
|
|
|
|
|
PREC_BITXOR = 7,
|
|
|
|
|
PREC_BITOR = 6,
|
|
|
|
|
PREC_EQUALTO = 5,
|
|
|
|
|
PREC_LOGAND = 4,
|
|
|
|
|
PREC_LOGOR = 3,
|
|
|
|
|
PREC_ASSIGN = 1,
|
|
|
|
|
PREC_COMMA = 0,
|
|
|
|
|
PREC_DEPRECATED = 0,
|
|
|
|
|
PREC_TERMINATOR = -1
|
|
|
|
|
};
|
2016-02-11 22:54:43 +01:00
|
|
|
|
2016-02-19 19:26:35 +01:00
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
char code[16];
|
2016-02-11 22:54:43 +01:00
|
|
|
|
2016-02-19 19:26:35 +01:00
|
|
|
BTokenId id;
|
|
|
|
|
Precedence precedence;
|
|
|
|
|
BTokenType type;
|
|
|
|
|
bool ambig; // if true, part of it matches part of another
|
|
|
|
|
bool deprecated;
|
|
|
|
|
} Operator;
|
|
|
|
|
}
|
2016-02-11 22:54:43 +01:00
|
|
|
}
|
|
|
|
|
#endif
|