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