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