Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- expr : expr '+' ident | ident
- std::wstring ShiftIdent() {
- auto ident = current_token->codepoints; // for example
- current_token++;
- return ident;
- }
- void ShiftPlus() {
- current_token++;
- }
- T ShiftExpr() {
- switch(current_token->type) {
- case ident:
- ShiftIdent();
- break;
- default:
- error();
- }
- while(true) {
- switch(current_token->type) {
- case '+':
- ShiftPlus();
- auto some_var = ShiftIdent();
- break;
- default:
- auto action = [&] () -> T {
- // somestuff, which can use some_var
- };
- return action();
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement