- Brace matching
Brace matching, or parentheses matching, is a
syntax highlighting feature of certaintext editor s andintegrated development environment s that highlights matching sets of braces in languages such as Java andC++ that use them. The purpose is to help the programmer navigate through the code and also spot any improper matching, which would cause the program to not compile or malfunction. If a closing brace is left out, for instance, the compiler will not know that the end of the class definition has been reached. Brace matching is particularly useful when many nestedif statement s,program loop s, etc. are involved.Implementations
Vim's % command does brace matching, [ [http://heather.cs.ucdavis.edu/~matloff/ProgEdit/ProgEdit.html#L2314 Norm Matloff's Text-Editor Web Page for Programming Students ] ] and
NetBeans has brace matching built-in. [ [http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-editor-bracesmatching/overview-summary.html Overview (Editor Braces Matching) ] ] Brace matching can also be a tool for code navigation. InVisual Studio [ [http://msdn.microsoft.com/en-us/library/be94e8aw.aspx Automatic Brace Matching in Visual Studio] ] C++ 6.0, brace matching behavior was set to ignore braces found into comments. In VSC 7.0, its behavior was changed to compute commented braces. [ [http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100587 Feedback: braces matching behavior ] ] IntelliJ IDEA'sRuby on Rails plugin also enables braces matching. [ [http://www.ajaxline.com/node/344 IntelliJ IDEA supports Ruby and Ruby on Rails | AjaxLine ] ] It has been proposed thatPerl 5 be modified to facilitate braces matching. [ [http://dev.perl.org/perl6/rfc/145.html Brace-matching for Perl Regular Expressions - perl6 ] ] TheMicrosoft Excel 2003 formula bar has parentheses matching. Its implementation shows all the pairs of parentheses as different colors, so it is possible to easily analyze them all at once.Example
for (int i = 0; i < 10; i++){:System.out.println(i);}
References
Wikimedia Foundation. 2010.