Download Free Pascal Language Reference Guide
Transcript
CHAPTER 1. PASCAL TOKENS
The following are valid ways of nesting comments:
{ Comment 1 (* comment 2 *) }
(* Comment 1 { comment 2 } *)
{ comment 1 // Comment 2 }
(* comment 1 // Comment 2 *)
// comment 1 (* comment 2 *)
// comment 1 { comment 2 }
The last two comments must be on one line. The following two will give errors:
// Valid comment { No longer valid comment !!
}
and
// Valid comment (* No longer valid comment !!
*)
The compiler will react with a ’invalid character’ error when it encounters such constructs, regardless
of the -Mturbo switch.
Remark: In TP and Delphi mode, nested comments are not allowed, for maximum compatibility with
existing code for those compilers.
1.3
Reserved words
Reserved words are part of the Pascal language, and as such, cannot be redefined by the programmer.
Throughout the syntax diagrams they will be denoted using a bold typeface. Pascal is not case
sensitive so the compiler will accept any combination of upper or lower case letters for reserved
words.
We make a distinction between Turbo Pascal and Delphi reserved words. In TP mode, only the Turbo
Pascal reserved words are recognised, but the Delphi ones can be redefined. By default, Free Pascal
recognises the Delphi reserved words.
1.3.1
Turbo Pascal reserved words
The following keywords exist in Turbo Pascal mode
absolute
and
array
asm
begin
case
const
constructor
destructor
div
do
downto
else
end
file
for
function
goto
if
implementation
in
inherited
inline
interface
label
mod
nil
not
object
of
on
operator
or
packed
procedure
program
record
reintroduce
repeat
self
set
shl
12
shr
string
then
to
type
unit
until
uses
var
while
with
xor