public override Object VisitIf([NotNull] MFSHParser.IfContext context) { const String fcn = "VisitIf"; this.TraceMsg(context, fcn); ConditionalBlock conditionalBlock = new ConditionalBlock(this.SourceName, context.Start.Line); this.PushState(conditionalBlock); MIConditional.Condition condition = new MIConditional.Condition(); condition.State = (MIConditional.CState) this.Visit(context.condition()); conditionalBlock.AddCondition(condition); return(null); }
public override Object VisitElse([NotNull] MFSHParser.ElseContext context) { const String fcn = "VisitElse"; this.TraceMsg(context, fcn); ConditionalBlock conditionalBlock = this.Current as ConditionalBlock; if (conditionalBlock == null) { this.Error(fcn, context.Start.Line.ToString(), $"Error '#else' found with no starting '#if'"); } MIConditional.Condition condition = new MIConditional.Condition(); condition.State = new MIConditional.CStateTrue(); conditionalBlock.AddCondition(condition); return(null); }
public void AddCondition(MIConditional.Condition condition) { // We want all items parsed to go into Macro.items. this.Conditional.Conditions.Add(condition); this.Items = condition.Items; }