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

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

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

            TestHelpers.TestStatementParserWithError(input, @"(1, 1) Expecting statement.");
        }
Example #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'");
        }
Example #5
0
        public void SyntaxError05()
        {
            string input = @"while true begin end;";

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

            TestHelpers.TestStatementParserWithError(input, @"(1, 10) Expecting ')'.");
        }
Example #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.");
        }
Example #8
0
        public void SyntaxError03()
        {
            string input = @"if true then";

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

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

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

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

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

            TestHelpers.TestExpressionParserWithError(input, @"(1, 1) Invalid numeric constant.");
        }
Example #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.");
        }
Example #16
0
        public void LexError04()
        {
            string input = @"'aaaa";

            TestHelpers.TestExpressionParserWithError(input, @"(1, 1) Unexpected end of line looking for end of string.");
        }
Example #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.");
        }
Example #18
0
        public void SyntaxError04()
        {
            string input = @"1 +";

            TestHelpers.TestExpressionParserWithError(input, @"(1, 4) Expecting expression.");
        }
Example #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'");
        }
Example #20
0
        public void SyntaxError06()
        {
            string input = @"if true do begin end;";

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

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

            TestHelpers.TestStatementParserWithError(input, @"(1, 21) Unexpected end of file looking for 'end'.");
        }
Example #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.");
        }