3. How the file is divided into declarations
Rules U1-U5 decide to which declaration every line belongs. The count of recognised and unrecognised lines depends on them.
| No. | Rule |
|---|---|
| U1 | A line that contains only spaces is blank; a line that contains only a comment is a comment. Blank lines and comments belong to no declaration and do not interrupt one |
| U2 | Every other line that does not begin inside a string opens a new declaration, except in cases U4 and U5 |
| U3 | A line that begins inside a string opened on a previous line belongs to the declaration of that string, even if it is blank or contains -- |
| U4 | A line that begins with VERIFY or with VERBAL continues the previous declaration if that declaration begins with GUARANTEE or ASSUME; otherwise it opens a new declaration, which is recognised only as the VERIFY field of an extension (section 4.11) |
| U5 | A line that does not begin inside a string continues the previous declaration if the latter has remained open: (a) it has an unclosed parenthesis (, [ or {, or (b) its last token, excluding the comment, calls for a continuation: one of the symbols : , := = <> < <= > >= + - * / ^ -> ;, or one of the words THEN WITHIN AND OR IMPLIES NOT IN. The exception is a line whose first token is @, END or a word that opens a declaration in section 5 (for example GUARANTEE, SCENARIO, BIND, KIND, REPEAT): such a line always opens a new declaration. Blank lines and comments between the two lines do not interrupt the continuation (U1) |
The first word of a declaration states its type. A keyword that is not the first of the line opens nothing: it is part of the current declaration.
Example, with the lines numbered:
1 GUARANTEE g1: VERBAL "A press
2 switches on the light" ← U3: inside the string
3 -- note ← U1: comment, does not interrupt
4 VERIFY BY JUDGEMENT "the operator" ← U4: continues g1
5 this line is made up ← U2: new declaration
Lines 1, 2 and 4 are a single declaration.
Continuation (U5). The words that always open a declaration, and therefore never continue the
previous one, are: CSC, ENTITY, REFINEMENT, BINDING, VERIFICATION, PROFILE, EXTENSION, END, STATUS,
IMPORT, PURPOSE, TYPE, CAPABILITY, EVENT, STATE, DEFINE, GUARANTEE, ASSUME, SCENARIO, REPEAT,
OFFERS, USES, COMPOSED, VARIANT, BIND, MEANS, KIND, LEVEL, PARAMS, FORM, MEANING, REDUCES,
SOURCE, and the symbol @. In this way an unclosed parenthesis or an operator at the end of a line does not absorb a
following declaration or the END of a block. Only the declaration left open is unrecognised, and the rest of the file is
read as before. VERIFY and VERBAL follow U4.
1 GUARANTEE g2: WHENEVER pressione THEN ← ends with THEN: remains open
2 accesa WITHIN 1 s ← U5: continues g2
3 GUARANTEE g3: WHENEVER pressione ← does not call for a continuation
4 THEN accesa WITHIN 1 s ← U2: new declaration, unrecognised
5 GUARANTEE g4: ALWAYS (accesa AND ← open parenthesis
6 END ← END: opens a new declaration; g4 is unrecognised
Lines 1 and 2 are a single declaration, recognised. Line 4 is a declaration on its own, unrecognised, and line 3, left incomplete, is unrecognised. Line 5 is unrecognised because the parenthesis remains open; line 6 closes the block.
A recognised declaration makes all its lines recognised; an unrecognised declaration makes all its lines unrecognised.

