This is non-trivial with regular expressions, as there's too much statefulness to handle. If you really want to pursue this path, you probably have to use regexes to find individual potential tokens and write your own state machine to handle transitions and backtracking. Once you've done that, you've basically written your own grammar engine.
I recommend the use of a grammar, whether Parse::RecDecent for Perl 5 or perhaps Parrot's PGE/PCT combination. The latter has an implementation of C99 in progress in languages/c99/ that might be instructive.
In reply to Re: Help Creating a Code Filter
by chromatic
in thread Help Creating a Code Filter
by chon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |