Guest User

Untitled

a guest
Feb 1st, 2012
63
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. expr : expr[ var_name ] '+' ident[ other_var_name ] ( some_action(var_name, other_var_name)) | ident[ third_var ] (some_other_action(third_var))
  2.  
  3. std::wstring ShiftIdent() {
  4. auto ident = current_token->codepoints; // for example
  5. current_token++;
  6. return ident;
  7. }
  8.  
  9. void ShiftPlus() {
  10. current_token++;
  11. }
  12.  
  13. T ShiftExpr() {
  14. T t;
  15. switch(current_token->type) {
  16. case ident:
  17. auto internal_var = ShiftIdent();
  18. {
  19. auto&& third_var = internal_var;
  20. t = some_other_action(third_var);
  21. }
  22. while(true) {
  23. switch(current_token->type) {
  24. case '+':
  25. ShiftPlus();
  26. switch(current_token->type) {
  27. case ident:
  28. auto&& other_var_name = ShiftIdent();
  29. {
  30. auto&& var_name = t;
  31. t = some_action(var_name, other_var_name));
  32. };
  33. continue;
  34. default:
  35. error();
  36. }
  37. break;
  38. };
  39. }
  40. break;
  41. default:
  42. error();
  43. }
  44. return std::move(t);
  45. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×