Comment (computer programming): Difference between revisions

Content deleted Content added
Syntax extension: Vim configuration is significantly different from extending the syntax of the language
Support documentation generation: move in info from a different section
Line 118:
Some [[programming tools]] write metadata into the code as comments.<ref>See e.g., {{cite book |last=Wynne-Powell |first=Rod |year=2008 |title=Mac OS X for Photographers: Optimized Image Workflow for the Mac User |page=243 |publisher=Focal Press |___location=Oxford |isbn=978-0-240-52027-8 |url=https://archive.org/details/macosxforphotogr0000wynn}}</ref> For example, a [[version control]] tool might write metadata such as author, date and version number into each file when it's commited to the repository.<ref>See e.g., {{cite book |last=Berlin |first=Daniel |year=2006 |title=Practical Subversion, Second Edition |page=168 |publisher=APress |___location=Berkeley |isbn=978-1-59059-753-8}}</ref>
 
=== Integrate with development tools ===
===Support documentation generation===
Sometimes information stored in comments is used by development tools other than the translator {{endash}} the primary tool that consumes the code. This information may include metadata (often used by a documentation generator) or tool configuration.
 
Some [[source code editor]]s support configuration via metadata in comments.<ref>{{cite book |last=Lamb |first=Linda |year=1998 |title=Learning the VI Editor |publisher=O'Reilly & Associates |___location=Sebastopol |isbn=978-1-56592-426-0 |url=https://archive.org/details/learningvieditor00lamb}}</ref> One particular example is the ''modeline'' feature of [[Vim (text editor)|Vim]] which configures tab character handling. For example:
 
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
 
===Support documentation generation===
An [[API]] [[documentation generator]] parses information from a codebase to generate API documentation. Many support reading information from comments, often parsing metadata, to control the content and formatting of the resulting document.