Ejemplo n.º 1
0
        public virtual void StartWhenConditionClause(List <TypeCobol.Compiler.CodeElements.CodeElement> conditions)
        {
            Enter(new WhenGroup(), null);// enter WHEN group
            foreach (var cond in conditions)
            {
                TypeCobol.Compiler.CodeElements.WhenCondition condition = null;
                if (cond is TypeCobol.Compiler.CodeElements.WhenSearchCondition)
                {
                    TypeCobol.Compiler.CodeElements.WhenSearchCondition whensearch =
                        cond as TypeCobol.Compiler.CodeElements.WhenSearchCondition;
                    condition = new WhenCondition();
                    whensearch.ApplyPropertiesToCE(condition);

                    condition.SelectionObjects    = new EvaluateSelectionObject[1];
                    condition.SelectionObjects[0] = new EvaluateSelectionObject();
                    condition.SelectionObjects[0].BooleanComparisonVariable = new BooleanValueOrExpression(whensearch.Condition);

                    var conditionNameConditionOrSwitchStatusCondition = whensearch.Condition as ConditionNameConditionOrSwitchStatusCondition;
                    if (conditionNameConditionOrSwitchStatusCondition != null)
                    {
                        condition.StorageAreaReads = new List <StorageArea>
                        {
                            conditionNameConditionOrSwitchStatusCondition.ConditionReference
                        }
                    }
                    ;
                }
                else
                {
                    condition = cond as TypeCobol.Compiler.CodeElements.WhenCondition;
                }
                Enter(new When(condition), condition);
                Exit();
            }
            Exit();                           // exit WHEN group
            Enter(new Then(), conditions[0]); // enter THEN
        }
Ejemplo n.º 2
0
 public override void EnterWhenConditionClause(ProgramClassParser.WhenConditionClauseContext context)
 {
     Enter(new WhenGroup(), context);// enter WHEN group
     foreach(var ctxt in context.whenEvaluateCondition()) {
         WhenCondition condition;
         if (ctxt == null) {
             condition = null;
         } else
         if (ctxt.WhenSearchCondition() != null) {
             var whensearch = (WhenSearchCondition)ctxt.WhenSearchCondition().Symbol;
             condition = new WhenCondition();
             condition.SelectionObjects = new EvaluateSelectionObject[1];
             condition.SelectionObjects[0] = new EvaluateSelectionObject();
             condition.SelectionObjects[0].BooleanComparisonVariable = new BooleanValueOrExpression(whensearch.Condition);
         } else {
             condition = (WhenCondition)ctxt.WhenCondition().Symbol;
         }
         Enter(new When(condition), context);
         Exit();
     }
     Exit();// exit WHEN group
     Enter(new Then(), context);// enter THEN
 }