Page 1 of 1

could bracket matching ignore commented code?

Posted: Wed Sep 03, 2003 5:48 pm
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?

need comment recognition fixed for this to work

Posted: Wed Sep 03, 2003 9:28 pm
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.

Perl5.syn is working now

Posted: Thu Sep 04, 2003 9:56 pm
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.

it wasn't regex :(

Posted: Thu Sep 04, 2003 10:15 pm
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.

Posted: Thu Sep 11, 2003 11:17 pm
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