Re: Comment delimiters

Daniel W. Connolly (connolly@hal.com)
Tue, 15 Nov 94 13:43:30 EST

In message <9411151159.aa02626@dali.scocan.sco.COM>, Murray Maloney writes:
>>From my reading of the SGML Handbook, white space
>would not be allowed between the -- (com) and the > (mdc).
>See section 10.3 on pages 390-391 of the Handbook.
>
>However, I think that Dan wrote this sentence
>and I trust that he has verified that it is correct.

Yeah, I wrote it, and I have since found out that it
is sort of incomplete. It describes a subset of the
full SGML comment syntax. The relevant productions, from
ISO8879 are:

[91] comment declaration = mdo,(comment,(s|comment)*)?,mdc
[92] comment = com,SGML character*,com

In the reference concrete syntax, that's

comment declaration = "<!",(comment,(s|comment)*)?,">"
comment = "--",SGML character*,"--"

so some examples are:

<!>
<! >
<!---->
<!---- >
<!-- -->
<!--<xxx>-->
<!--<xxx>-- -- a-bc -->
<!--<xxx>-- -- abc -- -- def -- >

you get the idea?

I don't know what's the best way to describe that in prose. I'll leave
that to the writers ;-)

In perl, I'd write:

/<!(--([^-]|(-[^-]))*--\s*)*>/

Dan