Esempio n. 1
0
        public void SyntaxError26()
        {
            string input = @"var a : integer; begin a := 1;;;; a := 1 a := 2 end.";

            TestHelpers.TestCompileProgramWithError(input, @"(1, 42) Expecting ';'.");
        }
Esempio n. 2
0
        public void LexError01()
        {
            string input = @"~";

            TestHelpers.TestExpressionParserWithError(input, @"(1, 1) Unexpected character.");
        }
Esempio n. 3
0
        public void SyntaxError01()
        {
            string input = @"";

            TestHelpers.TestStatementParserWithError(input, @"(1, 1) Expecting statement.");
        }
Esempio n. 4
0
        public void SyntaxError23()
        {
            string input = @"procedure a(a : 'test'); begin ; end begin ; end.";

            TestHelpers.TestCompileProgramWithError(input, @"(1, 17) Expecting  'integer', 'string', 'boolean', or 'array'");
        }
Esempio n. 5
0
        public void SyntaxError05()
        {
            string input = @"while true begin end;";

            TestHelpers.TestStatementParserWithError(input, @"(1, 12) Expecting 'do'.");
        }
Esempio n. 6
0
        public void SyntaxError07()
        {
            string input = @"if (true then begin end;";

            TestHelpers.TestStatementParserWithError(input, @"(1, 10) Expecting ')'.");
        }
Esempio n. 7
0
        public void SyntaxError19()
        {
            string input = @"procedure a; var a : array['test'] of integer; begin ; end begin ; end.";

            TestHelpers.TestCompileProgramWithError(input, @"(1, 28) Expecting numeric constant.");
        }
Esempio n. 8
0
        public void SyntaxError03()
        {
            string input = @"if true then";

            TestHelpers.TestStatementParserWithError(input, @"(1, 13) Expecting statement.");
        }
Esempio n. 9
0
        public void SyntaxError16()
        {
            string input = @"procedure ; begin ; end begin ; end. unexpected";

            TestHelpers.TestCompileProgramWithError(input, @"(1, 11) Expecting procedure or function name.");
        }
Esempio n. 10
0
        public void SyntaxError18()
        {
            string input = @"procedure a; var : integer; begin ; end begin ; end.";

            TestHelpers.TestCompileProgramWithError(input, @"(1, 18) Expecting variable name.");
        }
Esempio n. 11
0
 public void SyntaxError15()
 {
     TestHelpers.TestCompileProgramWithError(string.Empty, @"(1, 1) Unexpected end of file looking for main block.");
 }
Esempio n. 12
0
        public void SyntaxError14()
        {
            string input = @"procedure a; begin ; end begin ; end. unexpected";

            TestHelpers.TestCompileProgramWithError(input, @"(1, 39) Expecting end of file.");
        }
Esempio n. 13
0
        public void SyntaxError13()
        {
            string input = @"procedure a; begin ; end a;";

            TestHelpers.TestCompileProgramWithError(input, @"(1, 26) Expecting 'function', 'procedure', or 'begin'.");
        }
Esempio n. 14
0
        public void LexError03()
        {
            string input = @"2222222222222222222222";

            TestHelpers.TestExpressionParserWithError(input, @"(1, 1) Invalid numeric constant.");
        }
Esempio n. 15
0
        public void SyntaxError20()
        {
            string input = @"procedure a; var a : array of integer; begin ; end begin ; end.";

            TestHelpers.TestCompileProgramWithError(input, @"(1, 28) Expecting array subrange.");
        }
Esempio n. 16
0
        public void LexError04()
        {
            string input = @"'aaaa";

            TestHelpers.TestExpressionParserWithError(input, @"(1, 1) Unexpected end of line looking for end of string.");
        }
Esempio n. 17
0
        public void SyntaxError21()
        {
            string input = @"procedure a(a : array[0..9] of integer); begin ; end begin ; end.";

            TestHelpers.TestCompileProgramWithError(input, @"(1, 22) Not expecting array subrange here.");
        }
Esempio n. 18
0
        public void SyntaxError04()
        {
            string input = @"1 +";

            TestHelpers.TestExpressionParserWithError(input, @"(1, 4) Expecting expression.");
        }
Esempio n. 19
0
        public void SyntaxError22()
        {
            string input = @"procedure a(a : array of array); begin ; end begin ; end.";

            TestHelpers.TestCompileProgramWithError(input, @"(1, 26) Expecting  'integer', 'string', or 'boolean'");
        }
Esempio n. 20
0
        public void SyntaxError06()
        {
            string input = @"if true do begin end;";

            TestHelpers.TestStatementParserWithError(input, @"(1, 9) Expecting 'then'.");
        }
Esempio n. 21
0
        public void SyntaxError02()
        {
            string input = @"if";

            TestHelpers.TestStatementParserWithError(input, @"(1, 3) Expecting expression.");
        }
Esempio n. 22
0
        public void SyntaxError09()
        {
            string input = @"if true then begin ;";

            TestHelpers.TestStatementParserWithError(input, @"(1, 21) Unexpected end of file looking for 'end'.");
        }
Esempio n. 23
0
        public void SyntaxError12()
        {
            string input = @"procedure a; begin ; end var i : integer; begin ; end.";

            TestHelpers.TestCompileProgramWithError(input, @"(1, 30) Global variables must be declared before the first function or procedure.");
        }