help-flex
[Top][All Lists]
Advanced

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

RE: Nested comments


From: Thurn, Martin
Subject: RE: Nested comments
Date: Wed, 2 Jul 2003 12:09:08 -0700

Read Jeff Friedl's book, especially chapter 6, and then ask again if you
still need help

Mastering Regular Expressions, Second Edition
http://www.amazon.com/exec/obidos/ASIN/0596002890/thestarwarscol06

--
 - - Martin 'Kingpin' Thurn 

> -----Original Message-----
> From: address@hidden [mailto:address@hidden
> Sent: Wednesday, July 02, 2003 2:31 PM
> To: Hans Aberg
> Cc: flex list
> Subject: Re: Nested comments
> 
> 
> >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>> { ... }
> }
> 
> 
> _______________________________________________
> Help-flex mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-flex
> 




reply via email to

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