Files
pineapple-notepad/3rdparty/lexilla545/lexilla/test/examples/pascal/CodeFolding.pas.folded

81 lines
2.4 KiB
Plaintext

0 400 0 // tests for code folding
1 400 0
0 400 0 // multi line comments
2 400 0 + {
0 401 0 | line1
0 401 0 | line2
0 401 0 | }
1 400 0
0 400 0 // begin .. end
2 400 0 + begin
0 401 0 | some commands
0 401 0 | end;
1 400 0
2 400 0 + record test
0 401 0 | var1: type1;
0 401 0 | var2: type2;
0 401 0 | end; //record
1 400 0
0 400 0 //asm
2 400 0 + asm
0 401 0 | some statement
0 401 0 | end; //asm
1 400 0
0 400 0 //try (from https://wiki.freepascal.org/Try)
2 400 0 + try
0 401 0 | // code that might generate an exception
0 401 0 | except
0 401 0 | // will only be executed in case of an exception
0 401 0 | on E: EDatabaseError do
0 401 0 | ShowMessage( 'Database error: '+ E.ClassName + #13#10 + E.Message );
0 401 0 | on E: Exception do
0 401 0 | ShowMessage( 'Error: '+ E.ClassName + #13#10 + E.Message );
0 401 0 | end;
1 400 0
0 400 0 //try nested (from https://wiki.freepascal.org/Try)
2 400 0 + try
2 401 0 + try
0 402 0 | // code dealing with database that might generate an exception
0 402 0 | except
0 402 0 | // will only be executed in case of an exception
0 402 0 | on E: EDatabaseError do
0 402 0 | ShowMessage( 'Database error: '+ E.ClassName + #13#10 + E.Message );
0 402 0 | on E: Exception do
0 402 0 | ShowMessage( 'Error: '+ E.ClassName + #13#10 + E.Message );
0 402 0 | end;
0 401 0 | finally
0 401 0 | // clean up database-related resources
0 401 0 | end;
1 400 0
0 400 0 //case
2 400 0 + case x of
0 401 0 | 1: do something;
0 401 0 | 2: do some other thing;
0 401 0 | else
0 401 0 | do default;
0 401 0 | end; //case
1 400 0
0 400 0 //if then else
0 400 0 if x=y then
0 400 0 do something;
0 400 0 else
0 400 0 do some other thing;
1 400 0
0 400 0 //for loop
0 400 0 for i:=1 to 10 do
0 400 0 writeln(i)
1 400 0
0 400 0 //do until
0 400 0 repeat
0 400 0 write(a);
0 400 0 i:=i+1;
0 400 0 until i>10;
1 400 0
0 400 0 //preprocessor if, else, endif
0 400 0 {$DEFINE label}
2 400 0 + {$IFDEF label}
0 401 0 | command 1
0 401 0 | {$ELSE}
0 401 0 | command 2
0 401 0 | {$ENDIF}
1 400 0