Exemple #1
0
        public void ExpressionCountAndOr()
        {
            string code = "((x > 2) && (y>2) || (b))";

            LookAheadLangParser parser = LookAheadLangParser.CreateCppParser(TestUtil.GetTextStream(code));

            BlockAnalyzer analyzer = new BlockAnalyzer(parser);

            Assert.AreEqual(2, analyzer.CalcNumExpressionConditions());
        }
Exemple #2
0
        public void ExpressionCounterConsumes()
        {
            string code = "(x)\r\n" +
                          "more";

            LookAheadLangParser parser = LookAheadLangParser.CreateCppParser(TestUtil.GetTextStream(code));

            BlockAnalyzer analyzer = new BlockAnalyzer(parser);

            analyzer.CalcNumExpressionConditions();

            Assert.AreEqual("more", parser.NextKeyword());
        }
Exemple #3
0
        public void ConditionalExpressionEmbeddedCalls()
        {
            string code = "" +
                          "(x != this.parser.PeekNext()) \r\n" +
                          "this.parser.NextKeyword()";

            LookAheadLangParser parser   = LookAheadLangParser.CreateCppParser(TestUtil.GetTextStream(code));
            BlockAnalyzer       analyzer = new BlockAnalyzer(parser);

            analyzer.CalcNumExpressionConditions();

            Assert.AreEqual("this.parser.NextKeyword", parser.NextKeyword());
        }