Example #1
0
        public bool DoIf(CodeString Line, CodeString MLine, PreprocConditionMode CondMode, out bool Result)
        {
            if (IsInDefBlock)
            {
                var Plugin = new PluginForGlobals(Container);
                Plugin.GetPlugin <TypeMngrPlugin>().RetType      = Container.GlobalContainer.CommonIds.Boolean;
                Plugin.GetPlugin <PreProcPlugin>().IfDef         = CondMode != PreprocConditionMode.Normal;
                Plugin.GetPlugin <EvaluatorPlugin>().MustBeConst = true;

                var Node = Expressions.CreateExpression(MLine, Plugin);
                if (Node != null)
                {
                    var CNode = Node as ConstExpressionNode;
                    Result = CondMode == PreprocConditionMode.IfNotDef ? !CNode.Bool : CNode.Bool;
                    return(true);
                }
                else
                {
                    Result = true;
                    return(false);
                }
            }

            Result = true;
            return(true);
        }
Example #2
0
        public bool DoIf(CodeString Line, CodeString MLine, PreprocConditionMode CondMode)
        {
            bool Result;

            if (!DoIf(Line, MLine, CondMode, out Result))
            {
                return(false);
            }

            Conditions.Add(new PreprocessorCondition(Line, Result));
            return(true);
        }
Example #3
0
        public bool DoElseIf(CodeString Line, CodeString MLine, PreprocConditionMode CondMode)
        {
            if (!DoElse(Line))
            {
                return(false);
            }

            var Last = Conditions.Count - 1;
            var Cond = Conditions[Last];

            if (Cond.Value)
            {
                Cond.Declaration = Line;
                if (!DoIf(Line, MLine, CondMode, out Cond.Value))
                {
                    return(false);
                }

                Conditions[Last] = Cond;
            }

            return(true);
        }