const Operator Operator::operators[] =
{
- { "[", 2, BINARY, LEFT_TO_RIGHT },
- { "(", 2, POSTFIX, LEFT_TO_RIGHT },
- { ".", 2, BINARY, LEFT_TO_RIGHT },
- { "++", 2, POSTFIX, LEFT_TO_RIGHT },
- { "--", 2, POSTFIX, LEFT_TO_RIGHT },
- { "++", 3, PREFIX, RIGHT_TO_LEFT },
- { "--", 3, PREFIX, RIGHT_TO_LEFT },
- { "+", 3, PREFIX, RIGHT_TO_LEFT },
- { "-", 3, PREFIX, RIGHT_TO_LEFT },
- { "~", 3, PREFIX, RIGHT_TO_LEFT },
- { "!", 3, PREFIX, RIGHT_TO_LEFT },
- { "*", 4, BINARY, ASSOCIATIVE },
- { "/", 4, BINARY, LEFT_TO_RIGHT },
- { "%", 4, BINARY, LEFT_TO_RIGHT },
- { "+", 5, BINARY, ASSOCIATIVE },
- { "-", 5, BINARY, LEFT_TO_RIGHT },
- { "<<", 6, BINARY, LEFT_TO_RIGHT },
- { ">>", 6, BINARY, LEFT_TO_RIGHT },
- { "<", 7, BINARY, LEFT_TO_RIGHT },
- { ">", 7, BINARY, LEFT_TO_RIGHT },
- { "<=", 7, BINARY, LEFT_TO_RIGHT },
- { ">=", 7, BINARY, LEFT_TO_RIGHT },
- { "==", 8, BINARY, LEFT_TO_RIGHT },
- { "!=", 8, BINARY, LEFT_TO_RIGHT },
- { "&", 9, BINARY, ASSOCIATIVE },
- { "^", 10, BINARY, ASSOCIATIVE },
- { "|", 11, BINARY, ASSOCIATIVE },
- { "&&", 12, BINARY, ASSOCIATIVE },
- { "^^", 13, BINARY, ASSOCIATIVE },
- { "||", 14, BINARY, ASSOCIATIVE },
- { "?", 15, TERNARY, RIGHT_TO_LEFT },
- { ":", 15, TERNARY, RIGHT_TO_LEFT },
- { "=", 16, BINARY, RIGHT_TO_LEFT },
- { "+=", 16, BINARY, RIGHT_TO_LEFT },
- { "-=", 16, BINARY, RIGHT_TO_LEFT },
- { "*=", 16, BINARY, RIGHT_TO_LEFT },
- { "/=", 16, BINARY, RIGHT_TO_LEFT },
- { "%=", 16, BINARY, RIGHT_TO_LEFT },
- { "<<=", 16, BINARY, RIGHT_TO_LEFT },
- { ">>=", 16, BINARY, RIGHT_TO_LEFT },
- { "&=", 16, BINARY, RIGHT_TO_LEFT },
- { "^=", 16, BINARY, RIGHT_TO_LEFT },
- { "|=", 16, BINARY, RIGHT_TO_LEFT },
- { ",", 17, BINARY, LEFT_TO_RIGHT },
- { { 0 }, 18, NO_OPERATOR, LEFT_TO_RIGHT }
+ { "[", "]", 2, BINARY, LEFT_TO_RIGHT },
+ { "(", ")", 2, POSTFIX, LEFT_TO_RIGHT },
+ { ".", { }, 2, POSTFIX, LEFT_TO_RIGHT },
+ { "++", { }, 2, POSTFIX, LEFT_TO_RIGHT },
+ { "--", { }, 2, POSTFIX, LEFT_TO_RIGHT },
+ { "++", { }, 3, PREFIX, RIGHT_TO_LEFT },
+ { "--", { }, 3, PREFIX, RIGHT_TO_LEFT },
+ { "+", { }, 3, PREFIX, RIGHT_TO_LEFT },
+ { "-", { }, 3, PREFIX, RIGHT_TO_LEFT },
+ { "~", { }, 3, PREFIX, RIGHT_TO_LEFT },
+ { "!", { }, 3, PREFIX, RIGHT_TO_LEFT },
+ { "*", { }, 4, BINARY, ASSOCIATIVE },
+ { "/", { }, 4, BINARY, LEFT_TO_RIGHT },
+ { "%", { }, 4, BINARY, LEFT_TO_RIGHT },
+ { "+", { }, 5, BINARY, ASSOCIATIVE },
+ { "-", { }, 5, BINARY, LEFT_TO_RIGHT },
+ { "<<", { }, 6, BINARY, LEFT_TO_RIGHT },
+ { ">>", { }, 6, BINARY, LEFT_TO_RIGHT },
+ { "<", { }, 7, BINARY, LEFT_TO_RIGHT },
+ { ">", { }, 7, BINARY, LEFT_TO_RIGHT },
+ { "<=", { }, 7, BINARY, LEFT_TO_RIGHT },
+ { ">=", { }, 7, BINARY, LEFT_TO_RIGHT },
+ { "==", { }, 8, BINARY, LEFT_TO_RIGHT },
+ { "!=", { }, 8, BINARY, LEFT_TO_RIGHT },
+ { "&", { }, 9, BINARY, ASSOCIATIVE },
+ { "^", { }, 10, BINARY, ASSOCIATIVE },
+ { "|", { }, 11, BINARY, ASSOCIATIVE },
+ { "&&", { }, 12, BINARY, ASSOCIATIVE },
+ { "^^", { }, 13, BINARY, ASSOCIATIVE },
+ { "||", { }, 14, BINARY, ASSOCIATIVE },
+ { "?", ":", 15, TERNARY, RIGHT_TO_LEFT },
+ { "=", { }, 16, BINARY, RIGHT_TO_LEFT },
+ { "+=", { }, 16, BINARY, RIGHT_TO_LEFT },
+ { "-=", { }, 16, BINARY, RIGHT_TO_LEFT },
+ { "*=", { }, 16, BINARY, RIGHT_TO_LEFT },
+ { "/=", { }, 16, BINARY, RIGHT_TO_LEFT },
+ { "%=", { }, 16, BINARY, RIGHT_TO_LEFT },
+ { "<<=", { }, 16, BINARY, RIGHT_TO_LEFT },
+ { ">>=", { }, 16, BINARY, RIGHT_TO_LEFT },
+ { "&=", { }, 16, BINARY, RIGHT_TO_LEFT },
+ { "^=", { }, 16, BINARY, RIGHT_TO_LEFT },
+ { "|=", { }, 16, BINARY, RIGHT_TO_LEFT },
+ { ",", { }, 17, BINARY, LEFT_TO_RIGHT },
+ { { 0 }, { }, 18, NO_OPERATOR, LEFT_TO_RIGHT }
};
const Operator &Operator::get_operator(const string &token, Type type)