Presentation Tags
Presentation tags are treated as whitespace to the code-generation part of the compiler. The parser notifies interested parties when a presentation tag is discovered, but the compiler ignores that notfication. These tags are used by editors to determine how to display the nearby source code.
Individual presentation tags fit between < and > delimiters, while a set of tags fits between ( and ) delimiters. There must be no whitespace between the opening ( for the set and the opening < for the first tag or between the closing > of the last tag and the closing ) of the set.. For example:
(<chunk
state=expanded, handle=true><comment value=“Find the requested
string.”>)
{
// A lot of detailed processing...
}
(</chunk>)
An editor vendor can make up additional tags for specific needs for that editor. The following table shows the standard presentation tags and how an editor should interpret them:
|
Tag |
Modifier |
Value |
Meaning |
|
chunk |
|
|
These two comment tags delimit a “chunk” of source code that can be expanded or collapsed. Chunks usually correspond to blocks of source code that accomplish a specific part of a larger task. Collapsing these chunks can give the programmer a better high-level view of the general process involved in that larger task. If a comment tag appears in the same set of tags as this chunk tag, its comment will be displayed only when the chunk is collapsed. Chunks can be nested. |
|
|
handle |
true |
A “handle” is a widget that allows the user to expand or collapse the chunk with a single click. This modifier determines whether such a handle is available. The editor should also provide some other means to expand or collapse chunks. |
|
|
state |
expanded |
How to display the chunk |
|
comment |
|
|
Linked or embedded source code comment |
|
|
embed |
|
How to display comment in source code. |
|
|
|
none |
Do not display comment |
|
|
|
value |
Show the text specified by the value modifier or the raw contents of the file linked by the URL modifier. |
|
|
|
icon |
Show an icon representing the comment. The editor should allow the user to choose operations (open, edit, etc.) for the comment’s object when the icon is selected in the source code. |
|
|
|
object |
Embed an editor/player for the comment based on its MIME type |
|
|
mime |
MIME type |
The mime type of the file linked by the URL modifier. |
|
|
URL |
any URL |
The location of the object to be embedded |
|
|
value |
any text |
The text of the comment |
|
tabdef |
|
|
Delimit the definition of a set of tab stops. This allows source code to be formatted consistently for different users without relying on how many space characters each user defines for a tab character. |
|
|
base |
“name" |
The name of another tabdef set on which to base this set. The named tabdef is copied onto this one before any other changes are made with additional tags or modifiers. |
|
|
default |
ni |
Sets the default interval between tab stops for this set. n is a numeric value that tells how far apart the default tab stops are. Use i to measure in inches, m for millimeters, and c for characters. |
|
|
name |
“name" |
Names the tabdef for use later in the source code. |
|
tabadd |
|
|
Add a tabstop to the tabdef currently being defined. |
|
|
align |
left |
How to align text at this tab stop. Use ‘char’ to align to a specific character (decimal point, for example). |
|
|
position |
|
Where the tabstop should go |
|
|
|
here |
Put the tabstop wherever this tag ends up in the source file. This is helpful for lining up long parameter lists in a function call or complex nested expressions that span two or more lines. |
|
|
|
ni |
Place the tabstop at the specified distance from the left margin. |
|
tabrem |
position |
ni |
Remove tabstop from the specified position of the tabdef currently being defined. |
|
tabuse |
name |
“name" |
Delimits source code that is formatted by the tabdef specified by name. |