non-terminating regex match

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Apr 3 09:14:47 EDT 2008


En Wed, 02 Apr 2008 13:01:59 -0300, Maurizio Vitale  
<mav at cuma.polymath-solutions.lan> escribió:

> The intention is to match C++ identifiers, with or without namespace
> qualification, with or without arguments (e.g. variables, functions and
> macros).
> The following should be accepted:
>     main
>     main(int,char**)
>     ::main
>     std::cout
>     ::std::cout
>     NDEBUG

What about foo(int(*f)(int)) ?
You can't match a function definition with a regular expression alone, due  
to the nested (). The r.e. can recognize an identifier; you can later see  
whether there is a ( and scan up to the matching ).

-- 
Gabriel Genellina




More information about the Python-list mailing list