help-flex
[Top][All Lists]
Advanced

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

Re: Nested comments


From: john43
Subject: Re: Nested comments
Date: Wed, 2 Jul 2003 14:30:49 -0400

>I implemented nested [* ... *] comments by the code 
below, but it turns out
>to be slow with many nestings, and I do not know why. 
Is there a way to
>make it faster?
>

Probably not by much, but you can try this:

<comment>{
    ([^\*\[]|"["[^*]|"*"[^\]])+   { }
    "["|"*"  { }
    "[*"  ++comment_level;
    "*]"  {
        --comment_level;
        if (comment_level == 0) {
            BEGIN(INITIAL);
        }
      }
    <<EOF>> { ... }
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]