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