Up Next
Go up to 6 Comments and Annotations
Go forward to 6.2 Annotations

6.1 Comments

A comment starts with `%%'. It is terminated either by another `%%' on the same line, or by a subsequent line that starts with some symbol other than `%%' (ignoring spaces). Thus the usual pattern is:

CASL symbols...%% first comment line...
%% maybe more comment lines...
%% last comment line... %% CASL symbols...

allowing also a short comment to occur in the middle of a line:

CASL symbols...%% short comment... %% CASL symbols...

A comment applies to the longest preceding complete construct (ignoring intervening separators such as semicolons), if there is one, and otherwise to the smallest enclosing construct. Thus a comment between BASIC-ITEMs in a list thus applies to just the preceding BASIC-ITEM (rather than to the whole preceding list) regardless of whether it comes before or after the separating semicolon. A comment at the start of the list applies to the whole list. An exception to the above is a comment that finishes with `:', which always applies to the longest following complete construct.

The body of comment is generally input as plain (ISO Latin-1) text. CASL syntax within comments is indicated by `<CASL>...</CASL>' (each line still starting with `%%'); such syntax is parsed and displayed as usual, but with each line in its display prefixed by `%%'. (The `<...>...</...>' notation for delimiting constructs comes from SGML and HTML; the `/' in the closing delimiter may be read suggestively as "over".)

Instructions to formatters can be embedded in comments in the same way as CASL syntax, using the name of the formatting language instead of `CASL' in the delimiters `<CASL>...</CASL>'. Thus for LaTeX, one uses `<latex>...</latex>'; other envisaged formatters are for HTML and RTF. Each formatter ignores the instructions for the alternative formatters.

Formatting languages cannot be nested: the start of a new language implies the end of the current one. The name of the language may be omitted in the terminator, if desired, writing merely `</>'. The end of a comment implicitly terminates the current language.

Typically, one may want to specify special instructions for one or more particular formatters, leaving all other formatters to display some plain text as best they can; this may be written e.g. `<latex>...<html>...<other>...</>', thus:

... %% This is a fancy comment using <latex>\LaTeX<other>LaTeX</>
    %% and continuing with plain text

Text that is `commented-out' in a CASL specification is indicated by a comment of the form `%%<ignore>...</ignore>'; it is not shown at all in the display format. Note that one has to use `%%<ignore>...</ignore>%%' when the commented-out text is to be followed by CASL symbols on the same line. The terminating `</ignore>' may as usual be abbreviated to `</>'.


CoFI Document: CASL/SyntaxIssues --Version 0.99-- 17 February 1998.
Comments to cofi-language@brics.dk

Up Next