To skip comment-like sequences in strings, you need to parse both strings and comments (and anything else that might contain something that looks like a string or looks like a comment). Most likely with something like:
/$comment|$string/g
I tend to end up parsing with code like:
while( ! /\G$/gc ) { if( /\G$comment/gc ) { ... } elsif( /\G$string/gc ) { ... } elsif( /\G$neither/gc ) {
- tye
In reply to Re: Comments detected in strings (|)
by tye
in thread Comments detected in strings
by astroboy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |