xref: /freebsd/usr.bin/vgrind/vgrindefs.5 (revision 28445a638f8b0550e5b1db7ea3a75c4c6f84066b)
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 "ab	str	regular expression for the start of an alternate comment"
58.It "ae	str	regular expression for the end of an alternate comment"
59.It "pb	str	regular expression for start of a procedure"
60.It "bb	str	regular expression for start of a lexical block"
61.It "be	str	regular expression for the end of a lexical block"
62.It "cb	str	regular expression for the start of a comment"
63.It "ce	str	regular expression for the end of a comment"
64.It "sb	str	regular expression for the start of a string"
65.It "se	str	regular expression for the end of a string"
66.It "lb	str	regular expression for the start of a character constant"
67.It "le	str	regular expression for the end of a character constant"
68.It "nc	str	regular expression for a non-comment (see below)"
69.It "tl	bool	present means procedures are only defined at the top lexical level"
70.It "oc	bool	present means upper and lower case are equivalent"
71.It "kw	str	a list of keywords separated by spaces"
72.El
73.Pp
74Non-comments are required to describe a certain context where a
75sequence that would normally start a comment loses its special
76meaning.  A typical example for this can be found in Perl, where
77comments are normally starting with
78.Ql # ,
79while the string
80.Ql $#
81is an operator on an array.
82.Sh EXAMPLES
83The following entry, which describes the C language, is
84typical of a language entry.
85.Bd -literal
86C|c:\
87:pb=^\ed?*?\ed?\ep\ed?\e(\ea?\e):bb={:be=}:cb=/*:ce=*/:sb=":se=\ee":\e
88:lb=':le=\ee':tl:\e
89:kw=asm auto break case char continue default do double else enum\e
90extern float for fortran goto if int long register return short\e
91sizeof static struct switch typedef union unsigned while #define\e
92#else #endif #if #ifdef #ifndef #include #undef # define else endif\e
93if ifdef ifndef include undef:
94.Ed
95.Pp
96Note that the first field is just the language name (and any variants
97of it).  Thus the C language could be specified to
98.Xr vgrind 1
99as "c" or "C".
100.Pp
101Entries may continue onto multiple lines by giving a \e as the last
102character of a line.
103Capabilities in
104.Nm vgrindefs
105are of two types:
106Boolean capabilities which indicate that the language has
107some particular feature
108and string
109capabilities which give a regular expression or
110keyword list.
111.Sh REGULAR  EXPRESSIONS
112.Nm Vgrindefs
113uses regular expression which are very similar to those of
114.Xr ex 1
115and
116.Xr lex 1 .
117The characters `^', `$', `:' and `\e'
118are reserved characters and must be
119"quoted" with a preceding
120.Ql \e
121if they
122are to be included as normal characters.
123The metasymbols and their meanings are:
124.Bl -tag -width indent
125.It $
126the end of a line
127.It \&^
128the beginning of a line
129.It \ed
130a delimiter (space, tab, newline, start of line)
131.It \ea
132matches any string of symbols (like .* in lex)
133.It \ep
134matches any alphanumeric name.  In a procedure definition (pb) the string
135that matches this symbol is used as the procedure name.
136.It ()
137grouping
138.It \&|
139alternation
140.It ?
141last item is optional
142.It \ee
143preceding any string means that the string will not match an
144input string if the input string is preceded by an escape character (\e).
145This is typically used for languages (like C) which can include the
146string delimiter in a string by escaping it.
147.El
148.Pp
149Unlike other regular expressions in the system,  these match words
150and not characters.  Hence something like "(tramp|steamer)flies?"
151would match "tramp", "steamer", "trampflies", or "steamerflies".
152.Sh KEYWORD  LIST
153The keyword list is just a list of keywords in the language separated
154by spaces.  If the "oc" boolean is specified, indicating that upper
155and lower case are equivalent, then all the keywords should be
156specified in lower case.
157.Sh FILES
158.Bl -tag -width /usr/share/misc/vgrindefs -compact
159.It Pa /usr/share/misc/vgrindefs
160File containing terminal descriptions.
161.El
162.Sh SEE ALSO
163.Xr vgrind 1 ,
164.Xr troff 1
165.Sh HISTORY
166The
167.Nm
168file format appeared in
169.Bx 4.2 .
170