version 1.7, 2009/02/23 09:46:59 |
version 1.8, 2009/02/23 12:45:19 |
Line 238 where capitalised non-terminals represent nodes. |
|
Line 238 where capitalised non-terminals represent nodes. |
|
.Pp |
.Pp |
Of note are the TEXT nodes following the HEAD, BODY and TAIL nodes of |
Of note are the TEXT nodes following the HEAD, BODY and TAIL nodes of |
the BLOCK production. These refer to punctuation marks. Furthermore, |
the BLOCK production. These refer to punctuation marks. Furthermore, |
although a TEXT node will generally have a non-zero-length string, it |
although a TEXT node will generally have a non-zero-length string, in |
certain cases, such as |
the specific case of |
.Dq \&.Bd \-literal , |
.Sq \&.Bd \-literal , |
an empty line will produce a zero-length string. |
an empty line will produce a zero-length string. |
.\" PARAGRAPH |
.\" PARAGRAPH |
.Pp |
.Pp |
The rule-of-thumb for mapping node types to macros follows: in-line |
The rule-of-thumb for mapping node types to macros follows. In-line |
elements, such as |
elements, such as |
.Dq \&.Em foo , |
.Sq \&.Em foo , |
are classified as ELEMENT nodes, which can only contain text. |
are classified as ELEMENT nodes, which can only contain text. |
Multi-line elements such as |
Multi-line elements, such as |
.Dq \&.Sh |
.Sq \&.Sh , |
are BLOCK elements, where the HEAD constitutes line contents and the |
are BLOCK elements, where the HEAD constitutes line contents and the |
BODY constitutes subsequent lines. In-line elements with matching |
BODY constitutes subsequent lines. In-line elements with matching |
pairs, such as |
pairs, such as |
.Dq \&.So |
.Sq \&.So |
and |
and |
.Dq \&.Sc , |
.Sq \&.Sc , |
are BLOCK elements with no HEAD tag. The only exception to this is |
are BLOCK elements with no HEAD tag. The only exception to this is |
.Dq \&.Eo |
.Sq \&.Eo |
and |
and |
.Dq \&.Ec , |
.Sq \&.Ec , |
which has a HEAD and TAIL node corresponding to the enclosure string. |
which has a HEAD and TAIL node corresponding to the enclosure string. |
TEXT nodes, obviously, constitute text; the ROOT node is the document's |
TEXT nodes, obviously, constitute text, and the ROOT node is the |
root. |
document's root. |
.\" SECTION |
.\" SECTION |
.Sh EXAMPLES |
.Sh EXAMPLES |
The following example reads lines from stdin and parses them, operating |
The following example reads lines from stdin and parses them, operating |