could bracket matching ignore commented code?

Ideas for new features

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
crassius
Posts: 24
Joined: Fri Jul 18, 2003 7:08 pm

could bracket matching ignore commented code?

Post by crassius »

Could there be an option added to allow the bracket matching to ignore brackets found in code that is commented out? The comments seem to be defined well enough in the .syn file, but when commenting out a few lines during testing, it becomes impossible to match actual brackets across the commented portions of code.

Perhaps this could be a configurable option that could be turned on/off as needed?
crassius
Posts: 24
Joined: Fri Jul 18, 2003 7:08 pm

need comment recognition fixed for this to work

Post by crassius »

Ignoring matching brackets within comments probably isn't doable until the .syn file can actually recognize all the comments rather than just those that begin in column 1. The Perl5.syn file is broken this way.
crassius
Posts: 24
Joined: Fri Jul 18, 2003 7:08 pm

Perl5.syn is working now

Post by crassius »

Had a moment, so tried a regex in my .syn file.

Changing:
SingleComment = #
to:
SingleComment = .*#

now has comments being properly found in Perl, so we can again consider whether bracket matching should ignore extra brackets located within sections of commented out code.
crassius
Posts: 24
Joined: Fri Jul 18, 2003 7:08 pm

it wasn't regex :(

Post by crassius »

I thought that adding the regex made the comments work, but it turns out that they work both with or without it as long as comments after the beginning of a line start with a <space> char. That seems good enough, even though the space isn't required by Perl, so may take a lot of reformating of old files. It *should* still allow brackets to be ignored within comments too.
User avatar
bloodbaz
Posts: 7
Joined: Thu Sep 11, 2003 11:03 pm

Post by bloodbaz »

:o
I think this isn't important to try and do in TextPad.
When Brackets *do* appear in comments they are normally self contained which should mean that Match Brackets should jump past the comment stuff. If mismatched bracks do appear in the Comments (even though it doesn't affect code), you may as well match up the comment internal brackets anyway. What saiid that it was just code that should be pracket matched?

Blood Baz
Post Reply