FACTOID # 61: Indonesia contains the most known mammal species - and the most mammal species under threat.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Syntax highlighting
HTML syntax highlighting
HTML syntax highlighting

Syntax highlighting is a feature of some text editors that displays text—especially source code—in different colors and fonts 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. Some editors also integrate syntax highlighting with other features, such as spell checking or code folding. Image File history File links Html-source-code3. ... HTML, an initialism of Hypertext Markup Language, is the predominant markup language for web pages. ... Notepad is the standard text editor for Microsoft Windows A text editor is a piece of computer software for editing plain text. ... Source code (commonly just source or code) is any series of statements written in some human-readable computer programming language. ... “Font” redirects here. ... A programming language is an artificial language that can be used to control the behavior of a machine, particularly a computer. ... A specialized markup language using SGML is used to write the electronic version of the Oxford English Dictionary. ... A syntax error refers to a mistake in a statements syntax. ... In computing terms, a spelling checker (also spell checker) is a software program designed to verify the spelling of words in a file, helping a user ensure his/her spelling is correct. ... Code folding is a feature of some text editors, program source code editors and IDEs that allows the user to selectively hide and display sections of a currently-edited file as a part of routine edit operations. ...

Contents

Practical considerations

Syntax highlighting is one strategy to improve the readability and context of the text; especially for code that spans several pages. The reader can easily ignore large sections of comments or code, depending on what one desires.


Syntax highlighting also helps programmers find errors in their program. For example, most editors highlight string literals in a different color. Consequently, spotting a missing delimiter is much easier because of the contrasting color of the text.Brace matching is another important feature with many popular editors. This makes it simple to see if a brace has been left out or locate the match of the brace the cursor is on by highlighting the pair in a different color. A string literal is the representation of a string value within the source code of a computer program. ... A string literal is the representation of a string value within the source code of a computer program. ... For technical reasons, :) and some similar combinations starting with : redirect here. ...


Some text editors can also export the color markup in a format that is suitable for printing or for importing into word-processing or other kinds of text-formatting software; for instance a HTML, colorized LaTeX, PostScript or RTF version of its syntax highlighting. For the literary term, see Postscript. ... The Rich Text Format (often abbreviated to RTF) is a proprietary document file format developed by Microsoft in 1987 for cross-platform document interchange. ...


At least one commentator has argued that syntax highlighting encourages programmers to skim through code without making an effort of understanding it, and that, for typographical reasons, highlighted code is actually less legible than plain code.[1] A specimen of roman typefaces by William Caslon Typography is the art and techniques of type design, modifying type glyphs, and arranging type. ...


Document class

For editors that support more than one language, the user 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 or by scanning contents of the file. C is a general-purpose, block structured, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. ... This article is about the typesetting system. ... HTML, an initialism of Hypertext Markup Language, is the predominant markup language for web pages. ...


One approach for supporting syntax highlighting for multiple languages is the use of "Document classes". Each separate language constitutes a separate "class" of document. Each "class" can be associated with a specific set of syntax coloring rules. This approach affords a certain degree of flexibility for multi-language editors, but there are some potential limitations as well.


For example, sometimes a user may want to:

  • treat a single document as belonging to more than just one document class (for example when editing an HTML file that contains embedded Javascript code).
  • edit a language that does not belong to a recognized class (for example when editing source code for an obscure or relatively new programming language).

Some multi-language editors that use the "Document class" method sometimes provide additional features that specifically address these limitations. HTML, an initialism of Hypertext Markup Language, is the predominant markup language for web pages. ... JavaScript is a scripting language most often used for client-side web development. ...


Syntax elements

Most editors with syntax highlighting allow different colors and text styles to be given to dozens of different lexical sub-elements of syntax. These include keywords, comments, control-flow statements, variables, and other elements. Programmers often heavily customize their settings in an attempt to show as much useful information as possible without making the code difficult to read.


Example

Below is a snippet of syntax highlighted C++ code: It has been suggested that this article or section be merged with Snippet management. ... C++ (pronounced see plus plus, IPA: ) is a general-purpose programming language with high-level and low-level capabilities. ...

 // Allocate all the windows for (int i = 0; i < max; i++) { wins[i] = new Window(); } 

In this example, the editor has recognized the keywords for, int, and new. It recognized the variable names i, wins, and max and highlighted them accordingly. The comment at the beginning is also highlighted in a specific manner to distinguish it from working code. In computer programming, a keyword is a word or identifier that has a particular meaning to the programming language. ... In computer science and mathematics, a variable (pronounced ) (sometimes called an object or identifier in computer science) is a symbolic representation used to denote a quantity or expression. ... An illustration of Java source code with prologue comments indicated in red and inline comments in green. ...


History and limitations

The Live Parsing Editor (LEXX or LPEX) was written for the computerization of the Oxford English Dictionary in 1985 and was probably the first to use color syntax highlighting. Its live parsing capability allowed user-supplied parsers to be added to the editor, for text, programs, data file, etc. See: LEXX – A programmable structured editor, Cowlishaw, M. F., IBM Journal of Research and Development, Vol 31, No. 1, 1987, IBM Reprint order number G322-0151 The Oxford English Dictionary print set The Oxford English Dictionary (OED) is a dictionary published by the Oxford University Press (OUP), and is the most successful dictionary of the English language, (not to be confused with the one-volume Oxford Dictionary of English, formerly New Oxford Dictionary of English, of...


Since most text editors highlight syntax based on complex pattern matching heuristics rather than actually implementing a parser for each possible language, which could be prohibitively complex, the highlighting is almost never completely accurate. Moreover, depending on the pattern matching algorithms, the highlighting "engine" can become very slow for certain types of language structures. Some editors overcome this problem by not always parsing the whole file but rather just the visible area, sometimes scanning backwards in the text up to a limited number of lines for "syncing". In computer science, pattern matching is the act of checking for the presence of the constituents of a given pattern. ... For heuristics in computer science, see heuristic (computer science) Heuristic is the art and science of discovery and invention. ... An example of parsing a mathematical expression. ...


See the Programming features section of the Comparison of text editors article for a list of some editors that have syntax highlighting. This article provides a basic feature comparison for several text editors. ... This article provides a basic feature comparison for several text editors. ...


References

  1. ^ Linus Åkesson (2007-08-26). A case against syntax highlighting. Retrieved on 2007-08-28.

  Results from FactBites:
 
Plugins/Syntax Highlighting « WordPress Codex (555 words)
Highlight the syntax of the code using the GeSHi Library.
Highlight the syntax of the code in your posts using the GeSHi Library, be it HTML, CSS, ASP, PHP, JAVA or SQL.
Simple Syntax Highlighter is activated with a [syntax,filename,language] tag in a post or a page.
Syntax Highlighting (2424 words)
The Configure Syntax Highlighting command is used to specify the information needed by Boxer to perform on-screen Color Syntax Highlighting and Color Syntax Printing and for its other syntax-related features.
The Configure Syntax Highlighting command can be used to edit any of the pre-defined syntax information, or to define the syntax for new languages.
Syntax Highlighting command to quickly disable syntax highlighting for all languages.
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.