[Prev][Next][Index][Thread]

Re: Production 21 (and others)



Michael has the rule for comments:

   "<!--*"([-*]|("-"("*""-"?)*[-*])|(("*""-"?)+[-*]))*("*"|"-*")+"-->"

using flex as a test lexer, I tried the following successfully.

   "<!--*"([^*]|("*"[^-])|("*-"[^-])|("*--"[^>]))*"*-->" 

I used the following as test data:

  <!--**-->
  <!--* I am a comment *-->
  <!--* * *- *-- *-->
  <!--* * -* --* --*> *-->
  <!--*
     -- This is a big ugly comment -- 
     *-- This is a big ugly comment --*
     --* This is a big ugly comment *--
     <--* This is a big ugly comment *--->
     <--* This is a big ugly comment *->
  *-->


Follow-Ups: References: