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