| Syntax Highlighting |
Article Index for Syntax |
Shopping Highlighting |
Website Links For Syntax |
Information AboutSyntax Highlighting |
| CATEGORIES ABOUT SYNTAX HIGHLIGHTING | |
| user interface techniques | |
| text editor features | |
|
Syntax highlighting is a feature of some Text Editor s that displays text—especially Source Code —in different colors and Font s according to the category of terms. This feature eases writing in a structured language such as a Programming Language or a Markup Language as both structures and Syntax errors are visually distinct. Users can specify the language of the text, such as C , LaTeX , HTML , or the text editor can automatically recognize it based on the file extension. Some text editors can also export the color markup in a format that is suitable for printing or for importing into word-processing and/or text-formatting software; for instance VIM has the command 'Convert to HTML' that generates an HTML version of its syntax highlighting. EXAMPLE Below is a snippet of C++ code which the editor has automatically highlighted based on the syntax: // Allocate all the windows for (int i = 0; i < max; i++) { wins {Link without Title} = new Window(); } In this example, the editor has recognized the Keyword s for, int, and new. It recognized the variable names i, wins, and max and highlighted them accordingly. The comment before the code is also highlighted in a specific manner to distinguish it from working code. When looking at pages and pages of code, syntax highlighting greatly improves the readability and context of the text. The reader can automatically ignore large sections of comments or code, depending on what one desires.Syntax highlighting also helps programmers find errors in their program. Often, most editors highlight string literals in a different color and so one is able to see if they have missed off a closing quotation mark just by looking at the color of the text. Brace-matching is another important feature with many popular editors being able to match up pairs of braces (by highlighting the pair in a different color). This makes it simple to see if a brace has been missed off or where the closing brace is. Most editors with syntax highlighting allow different colors and text styles to be given to dozens of different syntactic categories. Programmers will often heavily customize their settings in an attempt to show as much useful information as possible without making the code difficult to read. |
|
|