public override void EnterStop_stat(langParser.Stop_statContext context) { RuleContext rule = context.Parent; while (rule != context.my_while) { if (rule.GetType().Name == "IifContext" || rule.GetType().Name == "Else_ifContext") { this.current_space.add_instruction(new PopStack(this.current_space)); } rule = rule.Parent; //remove all of the if conditional values from expression stack } this.current_space.add_instruction(new PopStack(this.current_space)); // remomve the value of the if conditional expression from expression_stack }
public override void ExitStop_stat(langParser.Stop_statContext context) { this.current_space.add_instruction(null); context.my_while.breaks.Add(this.current_space.number_of_instruction() - 1); }