Analyze() public method

Analyze the text. Fills the error and token lists.
public Analyze ( ) : void
return void
Ejemplo n.º 1
0
        public void Analyze_OK01()
        {
            const string text = "  service test\r\n  {\r\n rpc test1 (test2) returns (test3);\r\n}\r\n";

              var lex = new Lexer(text);

              lex.Analyze();

              Assert.AreEqual(7, lex.Tokens.Count);
              Assert.AreEqual(0, lex.Errors.Count);
              Assert.AreEqual(18, lex.Index);
        }
Ejemplo n.º 2
0
        public void Analyze_NOK01()
        {
            const string text = "\r\n  service test\r\n  {\r\n rpx test1 (test2) returns (test3);\r\n}\r\n" + // rpx instead of rpc
                          "  service test\r\n  {\r\n rpc test1 (test2) returns (test3);\r\n}\r\n";

              var lex = new Lexer(text);

              lex.Analyze();

              Assert.AreEqual(9, lex.Tokens.Count);
              Assert.AreEqual(11, lex.Errors.Count);
              Assert.AreEqual(37, lex.Index);
        }