Bracket matching, also known as brace matching or parentheses matching, is a syntax highlighting feature of certain text editors and integrated development environments that highlights matching sets of brackets (square brackets, curly brackets, or parentheses) in languages such as Java, JavaScript, and C++ 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 bracket is left out, for instance, the compiler will not know that the end of a block of code has been reached. Bracket matching is particularly useful when many nested if statements, program loops, etc. are involved.

Implementations

edit

Vim's % command does bracket matching,[1] and NetBeans has bracket matching built-in.[2] Bracket matching can also be a tool for code navigation. In Visual Studio[3] C++ 6.0, bracket matching behavior was set to ignore brackets found in comments. In VSC 7.0, its behavior was changed to compute commented brackets.[4] IntelliJ IDEA's Ruby on Rails plugin also enables bracket matching.[5] It has been proposed that Perl 5 be modified to facilitate bracket matching.[6] The Microsoft 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

edit

In this example, the user has just typed the closing curly brace '}' defining a code block, and that brace and its corresponding opening brace are both highlighted.

for (int i = 0; i < 10; i++)
{
    System.out.println(i);
}

See also

edit

References

edit
  1. ^ Norm Matloff's Text-Editor Web Page for Programming Students
  2. ^ "Overview (Editor Braces Matching)". Archived from the original on 2012-05-25. Retrieved 2008-03-09.
  3. ^ Automatic Brace Matching in Visual Studio
  4. ^ Feedback: braces matching behavior
  5. ^ "IntelliJ IDEA supports Ruby and Ruby on Rails | AjaxLine". Archived from the original on 2010-09-22. Retrieved 2008-03-09.
  6. ^ Brace-matching for Perl Regular Expressions – perl6

📚 Artikel Terkait di Wikipedia

Visual Studio Code

programming languages. This basic support includes syntax highlighting, bracket matching, code folding, and configurable snippets. Visual Studio Code also ships

Bulge bracket

Bulge bracket banks are the world's largest global investment banks, serving mostly large corporations, institutional investors and governments. The descriptor

Bracket clock

to power them, they continued to be made in the bracket style. Often they are composed of two matching pieces created as an ensemble: the clock and its

Programmer

include color syntax highlighting, auto indentation, auto-complete, bracket matching, syntax check, and allows plug-ins. These features aid the users during

Glob (programming)

implementation, which provides a glob-matching function on strings, uses a replace-as-RegExp implementation as above. The bracket syntax happens to be covered

Cerioporus squamosus

pheasant's back analogy derives from the pattern of colors on the bracket matching that of a pheasant's back. Dryad's saddle is an annual mushroom commonly

Cloud9 IDE

automatic code completion for snippets and identifiers, parenthesis and bracket matching, a debugger, and a gutter where line numbers and errors or warnings

Oracle SQL Developer

databases. Oracle SQL Developer supports automatic tabs, code insight, bracket matching and syntax coloring for PL/SQL. Future versions of Oracle SQL Developer