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()); }
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()); }
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()); }