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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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