Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- auto op = node->children()[1]->text();
- int32_t opID = -1;
- if(false) {}
- #define OP(sign, text) else if(op == #sign) opID = text
- OP(+,0);
- OP(-,1);
- OP(*,2);
- OP(/,3);
- OP(%,4);
- // comparisons
- OP(=, 5);
- OP(=/=, 6);
- OP(<, 7);
- OP(<=, 8);
- OP(>, 9);
- OP(>=, 10);
- #undef OP
- else throwSemanticError(node, "Unsupported operator.");
Advertisement
Add Comment
Please, Sign In to add comment