[antlr-interest] HTML Comments

mike dillon md5 at embody.org
Sun Jun 9 10:47:27 PDT 2002

begin johnclarke72 quotation:
> What is the best approach to writing a grammar for comments in HTML
> that permits you to add comments in it ?  eg :
> <!-- <!-- Comment --> -->

FYI: this is not actually allowed with HTML comments; they cannot be
nested. The "outer" comment ends with the *first* "-->".

Excerpt from http://www.w3.org/TR/REC-html40/intro/sgmltut.html#h-3.2.4:


        HTML comments have the following syntax:

          <!-- this is a comment -->
          <!-- and so is this one,
              which occupies more than one line -->

        White space is not permitted between the markup declaration open
        delimiter("<!") and the comment open delimiter ("--"), but is
        permitted between the comment close delimiter ("--") and the
        markup declaration close delimiter (">"). A common error is to
        include a string of hyphens ("---") within a comment. Authors
        should avoid putting two or more adjacent hyphens inside

        Information that appears between comments has no special meaning
        (e.g., character references are not interpreted as such).

        Note that comments are markup.



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the antlr-interest mailing list