Guest User

Untitled

a guest
Oct 10th, 2015
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. auto op = node->children()[1]->text();
  2. int32_t opID = -1;
  3. if(false) {}
  4. #define OP(sign, text) else if(op == #sign) opID = text
  5. OP(+,0);
  6. OP(-,1);
  7. OP(*,2);
  8. OP(/,3);
  9. OP(%,4);
  10. // comparisons
  11. OP(=, 5);
  12. OP(=/=, 6);
  13. OP(<, 7);
  14. OP(<=, 8);
  15. OP(>, 9);
  16. OP(>=, 10);
  17. #undef OP
  18. else throwSemanticError(node, "Unsupported operator.");
Advertisement
Add Comment
Please, Sign In to add comment