ietf-mta-filters
[Top] [All Lists]

Re: Inline comments?

1999-10-21 17:21:28
samr(_at_)Netscape(_dot_)COM (Sam Robertson) writes:

Obviously the text within and including the /* */ would be ignored as
white space.  I can live with the text: "body" not allowing comments,
and thus not requiring any kind of special processing beyond
dot-stuffing and EOM.

To simplify the lexer's problem a bit, only a # comment is allowed
after "text:".  I really don't want a /**/ comment there, but I'd be
happy to change it to disallow ALL comments.

Here's the change to the nroff source.  Please look at the grammar and 
tell me if I got the bracketed comment production right.

There's nothing Sieve-related going on at the IETF to the best of my
knowledge.  I'll Last Call this real soon now, especially if this is
the only change.

If anyone has any outstanding changes to the vacation spec, I'd like
to know about those as well.

--- sieve.ms.19991021   Thu Oct 21 15:50:54 1999
+++ sieve.ms    Thu Oct 21 17:20:40 1999
@@ -471,10 +471,12 @@
 
 .xx "2.3.     Comments"
 
-Comments begin with a "#" character that is not contained within a string and
-continue until the next CRLF.  Comments are semantically equivalent to
+Two types of comments are offered.  Comments are semantically equivalent to
 whitespace and can be used anyplace that whitespace is (with one exception in
 multi-line strings, as described in the grammar).
+
+Hash comments begin with a "#" character that is not contained within a string
+and continue until the next CRLF.
 .xm
 if size :over 100K { # this is a comment
 .RS
@@ -483,6 +485,18 @@
 }
 .xy
 
+Bracketed comments begin with the token "/*" and end with "*/".
+Bracketed comments may span multiple lines.  Bracketed comments do not
+nest.
+.xm
+if size :over 100K { /* this is a comment
+.RS
+this is still a comment */
+discard /* this is a comment */ ;
+.RE
+}
+.xy
+
 .xx "2.4.     Literal Data"
 
 Literal data means data that is not executed, merely evaluated "as is", to be
@@ -537,8 +551,9 @@
 before each line which begins with a `.'.  When the server interprets the
 script, these extra dots are removed.
 
-Note that a comment or whitespace may occur in between the "text:" and the
-CRLF, but not within the string itself.
+Note that a hashed comment or whitespace may occur in between the "text:" and
+the CRLF, but not within the string itself.  Bracketed comments are not
+allowed here.
 
 .xx "2.4.2.1. String Lists"
 
@@ -1608,11 +1623,22 @@
 described in [ABNF]):
 
 .nf
+bracket-comment = ("/*" *(CHAR-NOT-STAR / ("*" CHAR-NOT-SLASH)) *"*")
+       ;; No */ allowed inside a comment.
+       ;; (No * is allowed unless it is the last character,
+       ;; or unless it is followed by a character that isn't a slash.
+
 CHAR-NOT-DOT = (%x01-2d / %x2f-%xff)
 
 CHAR-NOT-CRLF = (%x01-09 / %x0b-%x0c / %x0e-%xff)
 
-comment = "#" *CHAR-NOT-CRLF CRLF
+CHAR-NOT-SLASH = (%x00-57 / %x58-ff)
+
+CHAR-NOT-STAR = (%x00-51 / %x53-ff)
+
+comment = bracket-comment / hash-comment
+
+hash-comment = ( "#" *CHAR-NOT-CRLF CRLF )
 
 identifier = (ALPHA / "_") *(ALPHA DIGIT "_")
 
@@ -1628,7 +1654,7 @@
 .\" " dirty hack
        ;; note that newlines and other characters are all allowed strings
 
-multi-line = "text:" *(SP / HTAB) (comment / CRLF)
+multi-line = "text:" *(SP / HTAB) (hash-comment / CRLF)
        *((1*CHAR-NOT-DOT *CHAR CRLF) / ("." 1*CHAR-NOT-DOT *CHAR CRLF) /
          (".." *CHAR CRLF) / CRLF)



<Prev in Thread] Current Thread [Next in Thread>