Skip to main content

2.2 Lexical Elements, Separators, and Delimiters

danger

This Reference Manual output has not been verified, and may contain omissions or errors. Report any problems on the tracking issue

Static Semantics

1

The text of a program consists of the texts of one or more compilations. The text of each compilation is a sequence of separate lexical elements. Each lexical element is formed from a sequence of characters, and is either a delimiter, an identifier, a reserved word, a numeric_literal, a character_literal, a string_literal, or a comment. The meaning of a program depends only on the particular sequences of lexical elements that form its compilations, excluding comments.

2/3

The text of a compilation is divided into lines. In general, the representation for an end of line is implementation defined. However, a sequence of one or more format_effectors other than the character whose code point is 16#09# (CHARACTER TABULATION) signifies at least one end of line.

2.a
implementation defined

The representation for an end of line.

3/2

[In some cases an explicit separator is required to separate adjacent lexical elements.] A separator is any of a separator_space, a format_effector, or the end of a line, as follows:

4/2
  • A separator_space is a separator except within a comment, a string_literal, or a character_literal.
  • 5/3
  • The character whose code point is 16#09# (CHARACTER TABULATION) is a separator except within a comment.
  • 6
  • The end of a line is always a separator.
7

One or more separators are allowed between any two adjacent lexical elements, before the first of each compilation, or after the last. At least one separator is required between an identifier, a reserved word, or a numeric_literal and an adjacent identifier, reserved word, or numeric_literal.

7.1/3

One or more other_format characters are allowed anywhere that a separator is[; any such characters have no effect on the meaning of an Ada program].

8/2

A delimiter is either one of the following characters:

9/5

& ' ( ) * + , – . / : ; < = > @ [ ] |

10

or one of the following compound delimiters each composed of two adjacent special characters

11

=> .. ** := /= >= <= << >> <>

12

Each of the special characters listed for single character delimiters is a single delimiter except if this character is used as a character of a compound delimiter, or as a character of a comment, string_literal, character_literal, or numeric_literal.

13

The following names are used when referring to compound delimiters:

Implementation Requirements

14

delimiter name=>arrow..double dot**double star, exponentiate:=assignment (pronounced: “becomes”)/=inequality (pronounced: “not equal”)>=greater than or equal<=less than or equal<<left label bracket>>right label bracket<>boxAn implementation shall support lines of at least 200 characters in length, not counting any characters used to signify the end of a line. An implementation shall support lexical elements of at least 200 characters in length. The maximum supported line length and lexical element length are implementation defined.

14.a
implementation defined

Maximum supported line length and lexical element length.

14.b
discussion

From URG recommendation.

Wording Changes from Ada 95

14.c/3

The wording was updated to use the new character categories defined in the preceding subclause.

Extensions to Ada 2005

14.d/3
correction

Clarified that other_format characters are allowed anywhere that separators are allowed. This was intended in Ada 2005, but didn't actually make it into the wording.

Wording Changes from Ada 2012

14.e/5

Added square brackets and the target_name symbol (see 5.2.1) to the list of delimiters.