Guest User

Untitled

a guest
Feb 1st, 2012
59
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. expr : expr '+' ident | ident
  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. switch(current_token->type) {
  15. case ident:
  16. ShiftIdent();
  17. break;
  18. default:
  19. error();
  20. }
  21. while(true) {
  22. switch(current_token->type) {
  23. case '+':
  24. ShiftPlus();
  25. auto some_var = ShiftIdent();
  26. break;
  27. default:
  28. auto action = [&] () -> T {
  29. // somestuff, which can use some_var
  30. };
  31. return action();
  32. };
  33. }
  34. }
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.

×