public override void EnterBreak_stat(langParser.Break_statContext context) { RuleContext rule = context.Parent; while (rule != context.my_if) { if (rule.GetType().Name == "While_statContext") { this.current_space.add_instruction(new PopStack(this.current_space)); } rule = rule.Parent; //remove all of the while conditional values from expression stack } if (!(context.Parent is langParser.ElsexContext)) { this.current_space.add_instruction(new PopStack(this.current_space)); // remomve the value of the if conditional expression from expression_stack } }
public override void ExitBreak_stat(langParser.Break_statContext context) { this.current_space.add_instruction(null); context.my_if.jumps.Add(this.current_space.number_of_instruction() - 1); }