Subsections
In this chapter we describe all the pascal reserved words, as well as the
various ways to denote strings, numbers, identifiers etc.
Free Pascal allows all characters, digits and some special ASCII symbols
in a Pascal source file.
Recognised symbols
The following characters have a special meaning:
+ - * / = < > [ ] . , ( ) : ^ @ { } $ #
and the following character pairs too:
<= >= := += -= *= /= (* *) (. .) //
When used in a range specifier, the character pair (. is equivalent to
the left square bracket [. Likewise, the character pair .) is
equivalent to the right square bracket ].
When used for comment delimiters, the character pair (* is equivalent
to the left brace { and the character pair *) is equivalent
to the right brace }.
These character pairs retain their normal meaning in string expressions.
Free Pascalsupports the use of nested comments. The following constructs are valid
comments:
(* This is an old style comment *)
{ This is a Turbo Pascal comment }
// This is a Delphi comment. All is ignored till the end of the line.
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 -So switch.
Reserved words are part of the Pascal language, and cannot be redefined.
They will be denoted as this throughout the syntax
diagrams. Reserved words can be typed regardless of case, i.e. Pascal is
case insensitive.
We make a distinction between Turbo Pascal and Delphi reserved words, since
with the -So switch, only the Turbo Pascal reserved words are
recognised, and the Delphi ones can be redefined. By default, Free Pascal
recognises the Delphi reserved words.
The following keywords exist in Turbo Pascal mode
The Delphi (II) reserved words are the same as the pascal ones, plus the
following ones:
On top of the Turbo Pascal and Delphi reserved words, Free Pascalalso considers
the following as reserved words:
The following is a list of all modifiers. Contrary to Delphi, Free Pascaldoesn't
allow you to redefine these modifiers.
Remark: Predefined types such as Byte, Boolean and constants
such as maxint are not reserved words. They are
identifiers, declared in the system unit. This means that you can redefine
these types. You are, however, not encouraged to do this, as it will cause
a lot of confusion.
Identifiers denote constants, types, variables, procedures and functions,
units, and programs. All names of things that you define are identifiers.
An identifier consists of 255 significant characters (letters, digits and
the underscore character), from which the first must be an alphanumeric
character, or an underscore (_)
The following diagram gives the basic syntax for identifiers.
Identifiers
Numbers are denoted in decimal notation. Real (or decimal) numbers are
written using engeneering notation (e.g. 0.314E1).
Free Pascalsupports hexadecimal format the same way as Turbo Pascal does. To
specify a constant value in hexadecimal format, prepend it with a dollar
sign ($). Thus, the hexadecimal $FF equals 255 decimal.
In addition to the support for hexadecimal notation, Free Pascalalso supports
binary notation. You can specify a binary number by preceding it with a
percent sign (%). Thus, 255 can be specified in binary notation
as %11111111.
The following diagrams show the syntax for numbers.
Numbers
Labels can be digit sequences or identifiers.
Label
Remark: Note that you must specify the -Sg switch before you can use labels.
By default, Free Pascaldoesn't support label and goto statements.
A character string (or string for short) is a sequence of zero or more
characters from the ASCII character set, enclosed by single quotes, and on 1
line of the program source.
A character set with nothing between the quotes ('') is an empty
string.
Character strings
root
2000-09-24