Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Brace matcher

Status
Not open for further replies.

gnubie

Programmer
Apr 16, 2002
103
0
0
US
Hi,

Anyone know of a Perl script brace/bracket matcher? I've been looking for an extra or missing brace in some complex Perl script and I just can't spot it.

Thanks.
 
hmmm. did you try perl -d yourscript?
 
Yes, I did. I get the same error message about the missing brace as without the
Code:
-d
.

Update: The problem was NOT due to a missing brace or bracket as the compiler diagnostic indicated. It turned out to be a closing here-is tag that was INDENTED. Ouch!

I'm still interested in locating a Perl brace matcher script, if you know of one.
 
When using 'vi', if you are sitting on one brace, % will jump to the matching brace.

Yes, I still spend a lot of time in vi. I find that I can make better time if I don't have to use a mouse (take my hands away from the keyboard). I am a dinosaur.

UltraEdit does brace matching also. 'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
gnubie: out of curiosity, what would you expect a brace matcher to do? I ask because I have played around with this in the past but could never figure out what exactly I wanted the script to do. I realized that it would take a sophiticated parser to tell you which brace is missing. The best that I could come up with was a script that assigns a unique number/letter code to each brace that pairs it with another brace with the same code, but it was still difficult to track down missing braces. I was wondering what you had in mind?

jaa
 
justice41: the script would just tell you what braces it matches. You would compare what the script thinks with what you expect. It can't really tell which brace is mising.

Typically, it works like the one described above. You place the cursor over a open brace, hit a command key, and the cursor moves to the brace it thinks should close the open brace. With GUIs, the area between the open and closed is usually highlighted (appears selected).

If the selected area doesn't reach close brace you expected, you have an extra brace, and if it goes beyond the brace, you have a missing brace.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top