- throw runtime_error(format("Parse error at '%s': expected context identifier", token));
- cur_context->previous = prev_context;
+ throw runtime_error(format("Parse error at '%s': expected stage identifier", token));
+
+ if(cur_stage->type!=SHARED)
+ module->stages.back().previous = cur_stage;
+ cur_stage = &module->stages.back();