For comment...
*Rules*
-
The term *column number*, as used here, is defined as the number of
preceding UCS4 code points that occur to the left of the token on the same
line, without regard to comments.
-
At any point where a left curly brace is required by the grammar, one
will be inserted by the lexer if the expected '{' is missing. A '{' inserted
in this fashion is said to be *implicit*. A '{' obtained from the input
stream is said to *explicit*.
An opening '{' signals the beginning of a *layout item sequence*, which
is a sequence of layout items separated by semicolons (';').
-
At any *implied close brace position*:
-
If the current open brace was implicit, a '}' is inserted.
-
If the current open brace was explicit and the last token processed
was not '}', an error is signalled.
-
After an opening '{', if the following token is *not* preceded by an
implied close brace position, it starts a layout item. The column number of
this token defines the *layout item sequence indent level* for the
containing layout item sequence. A stack of such indent levels associated
with the opening and closing of curly braces is maintained by the lexer.
-
Lines consisting entirely of white space and lines whose first
non-whitespace token occurs at an indentation *greater than* the current
item indent level are treated as continuation lines; no special processing
for these lines occurs.
-
Lines whose first non-whitespace token occurs at a column *equal to* the
current layout item, and whose first token is not ';' or '}', will have a
semicolon inserted *unless* the previously encountered token was a
semicolon, this has the effect of terminating the current layout item and
starting a new one.
-
Lines whose first non-whitespace token occurs at a column *less than* the
current item indent level, and whose first token is not '}', are deemed to
be preceded by an implied close brace position for as long as the current
indent level is greater than that of the token. The implied close brace
processing occurs before this token is consumed.
-
When a '}' (whether or not inserted) is encountered, the current item
indent level reverts to the item indent level that was in effect prior to
the matching '{'
-
An implicit '{' must be matched by an implicit '}'. Similarly, an
explicit '{' must be matched by an explicit '}'. If this requirement is
violated, an error is signalled.
These rules are applied iteratively until no action is taken. For example,
an out-dented line can potentially cause multiple implicit '}' insertions
and a ';' insertion.
*Syntactically Implied Close Brace Positions
*The token in is preceded by a syntactically implied close brace position.
there may turn out to be other such examples, but this is the only one I
have identified so far.*
*
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev