1.\" Copyright (c) 1989, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)vgrindefs.5 8.1 (Berkeley) 6/6/93 33.\" 34.Dd June 6, 1993 35.Dt VGRINDEFS 5 36.Os BSD 4.2 37.Sh NAME 38.Nm vgrindefs 39.Nd language definition data base for 40.Xr vgrind 1 41.Sh SYNOPSIS 42.Nm vgrindefs 43.Sh DESCRIPTION 44The 45.Nm vgrindefs 46file 47contains all language definitions for 48.Xr vgrind 1 . 49The data base is 50very similar to 51.Xr termcap 5 . 52.Sh FIELDS 53The following table names and describes each field. 54.Pp 55.Bl -column Namexxx Tpexxx 56.Sy Name Type Description 57.It "pb str regular expression for start of a procedure" 58.It "bb str regular expression for start of a lexical block" 59.It "be str regular expression for the end of a lexical block" 60.It "cb str regular expression for the start of a comment" 61.It "ce str regular expression for the end of a comment" 62.It "sb str regular expression for the start of a string" 63.It "se str regular expression for the end of a string" 64.It "lb str regular expression for the start of a character constant" 65.It "le str regular expression for the end of a character constant" 66.It "tl bool present means procedures are only defined at the top lexical level" 67.It "oc bool present means upper and lower case are equivalent" 68.It "kw str a list of keywords separated by spaces" 69.El 70.Pp 71.Sh EXAMPLES 72The following entry, which describes the C language, is 73typical of a language entry. 74.Bd -literal 75C|c:\ 76:pb=^\ed?*?\ed?\ep\ed?\e(\ea?\e):bb={:be=}:cb=/*:ce=*/:sb=":se=\ee":\e 77:lb=':le=\ee':tl:\e 78:kw=asm auto break case char continue default do double else enum\e 79extern float for fortran goto if int long register return short\e 80sizeof static struct switch typedef union unsigned while #define\e 81#else #endif #if #ifdef #ifndef #include #undef # define else endif\e 82if ifdef ifndef include undef: 83.Ed 84.Pp 85Note that the first field is just the language name (and any variants 86of it). Thus the C language could be specified to 87.Xr vgrind 1 88as "c" or "C". 89.Pp 90Entries may continue onto multiple lines by giving a \e as the last 91character of a line. 92Capabilities in 93.Nm vgrindefs 94are of two types: 95Boolean capabilities which indicate that the language has 96some particular feature 97and string 98capabilities which give a regular expression or 99keyword list. 100.Sh REGULAR EXPRESSIONS 101.Nm Vgrindefs 102uses regular expression which are very similar to those of 103.Xr ex 1 104and 105.Xr lex 1 . 106The characters `^', `$', `:' and `\e' 107are reserved characters and must be 108"quoted" with a preceding 109.Ql \e 110if they 111are to be included as normal characters. 112The metasymbols and their meanings are: 113.Bl -tag -width indent 114.It $ 115the end of a line 116.It \&^ 117the beginning of a line 118.It \ed 119a delimiter (space, tab, newline, start of line) 120.It \ea 121matches any string of symbols (like .* in lex) 122.It \ep 123matches any alphanumeric name. In a procedure definition (pb) the string 124that matches this symbol is used as the procedure name. 125.It () 126grouping 127.It \&| 128alternation 129.It ? 130last item is optional 131.It \ee 132preceding any string means that the string will not match an 133input string if the input string is preceded by an escape character (\e). 134This is typically used for languages (like C) which can include the 135string delimiter in a string by escaping it. 136.El 137.Pp 138Unlike other regular expressions in the system, these match words 139and not characters. Hence something like "(tramp|steamer)flies?" 140would match "tramp", "steamer", "trampflies", or "steamerflies". 141.Sh KEYWORD LIST 142The keyword list is just a list of keywords in the language separated 143by spaces. If the "oc" boolean is specified, indicating that upper 144and lower case are equivalent, then all the keywords should be 145specified in lower case. 146.Sh FILES 147.Bl -tag -width /usr/share/misc/vgrindefs -compact 148.It Pa /usr/share/misc/vgrindefs 149File containing terminal descriptions. 150.El 151.Sh SEE ALSO 152.Xr vgrind 1 , 153.Xr troff 1 154.Sh HISTORY 155The 156.Nm 157file format appeared in 158.Bx 4.2 . 159