[antlr-interest] Re: HTML Comments

johnclarke72 johnclarke at hotmail.com
Sun Jun 9 10:56:30 PDT 2002


Thanks.  I am happy to read this.  But if I wanted to do this how 
could it be described in grammar ?

John

> > 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:
> 
>         3.2.4 Comments
> 
>         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
>         comments.
> 
>         Information that appears between comments has no special 
meaning
>         (e.g., character references are not interpreted as such).
> 
>         Note that comments are markup.
> 
> -md


 

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



More information about the antlr-interest mailing list