private static bool If(CodeProcessorContext context, Stream data, TokenStream nodes, bool useExistingState = false)
        {
            while (!LineBreak(data))
            {
                Whitespace(context, data, nodes);
                if (!Comment(context, data))
                {
                    break;
                }
            }

            TokenStream expression         = new TokenStream();
            Lazy <HashSet <UInt32> > stack = new Lazy <HashSet <UInt32> >();

            while (!LineBreak(context, data, expression))
            {
                ProcessNoComments(context, data, expression, stack, true);
            }

            int result; if (useExistingState)

            {
                result = context.States.Pop();
            }

            else
            {
                result = 0;
            }

            if (result >= 4)
            {
                result = 2;
            }

            result |= (PreprocessorEvaluator.Evaluate(expression) ? 0 : 1);

            CheckState(context, nodes, result);
            return(true);
        }
Exemple #2
0
        private static void If(CodeProcessorContext context, ConditionToken token, TokenStream nodes, bool useExistingState)
        {
            TokenStream expression         = new TokenStream();
            Lazy <HashSet <UInt32> > stack = new Lazy <HashSet <UInt32> >();

            while (!LineBreak(context, token.Condition, expression))
            {
                ProcessNoComments(context, token.Condition, expression, stack, true);
            }

            int result; if (useExistingState)

            {
                result = context.States.Pop();
            }

            else
            {
                result = 0;
            }

            if (result >= 4)
            {
                result = 2;
            }

            result |= (PreprocessorEvaluator.Evaluate(expression) ? 0 : 1);
            CheckState(context, nodes, result);

            if (nodes.CanWrite && token.Child != null)
            {
                GetResult(context, token.Child as PreprocessorToken, nodes);
            }

            EndCondition(context, token.Next, nodes);
        }