CHKDELIM 1L "23 October 1999" "Version 3.3"

Table of contents


NAME

chkdelim - check delimiter balance

SYNOPSIS

chkdelim [ -? ] [ -author ] [ -BibTeX ] [ -copyright ] [ -error-file filename ] [ -help ] [ -ignore delimiters ] [ -Lisp ] [ -nested ] [ -no-BibTeX ] [ -no-Lisp ] [ -no-nested ] [ -no-Nroff ] [ -no-page-reset ] [ -no-paragraph-reset ] [ -no-quote-check ] [ -no-Scribe ] [ -no-TeX ] [ -no-TeXinfo ] [ -Nroff ] [ -output-file filename ] [ -page-reset ] [ -paragraph-reset ] [ -quote-check ] [ -Scribe ] [ -TeX ] [ -TeXinfo ] [ -version ] [ < infile or file1 file2 file3 ... ] > outfile

DESCRIPTION

chkdelim is a tool for detecting common delimiter errors in electronic documents and computer programs. It filters a list of files, or its standard input if no filenames are provided, matching group delimiters: angle brackets, curly braces, parentheses, square brackets, forward quotes (apostrophes or acutes), backward quotes (graves), quotation marks, and dollar signs (used in the TeX typesetting system).

Warning messages are printed to stdout whenever unbalanced delimiters are found, giving the delimiter and its line, column, and file positions. The output format is recognizable by the GNU emacs M-x compile command, making it easy to parse the warning messages and jump to their locations with the keystrokes C-x `(next-error).

Except in -Scribe mode, a backslash preceding a delimiter prevents it from being recognized as a delimiter. This is a suitable choice for TeX documents, as well as for C-like programming languages and UNIX shells. Use the -ignore option to override the special handling of backslash.

If unbalanced delimiters are needed, it is often possible to insert a matching delimiter in a nearby comment so that the delimiter appears to chkdelim to be properly balanced. This will reduce the number of messages issued, so that the real problems will be more evident.

chkdelim exits with a success code (0 on UNIX) if no warning messages are printed on stdout; otherwise, it exits with a failure code (1 on UNIX).

chkdelim recognizes, and handles transparently on all systems, the three popular flavors of text file line terminators: CR (Macintosh), CR LF (IBM PC DOS and Microsoft Windows), and LF (UNIX).


OPTIONS

Command-line options may be abbreviated to a unique leading prefix, and letter case is not significant. Options affect only the processing of files that follow them on the command line.

Language-specific options (-BibTeX, -Lisp, -Nroff, -Scribe, -TeX, and -TeXinfo), and their negations, should be given before other options, because they reset many internal flags that affect the handling of specific characters.

The leading hyphen that distinguishes an option from a filename may be doubled, for compatibility with GNU and POSIX conventions. Thus, -author and --author are equivalent.

To avoid confusion with options, if a filename begins with a hyphen, it must be disguised by a leading absolute or relative directory path, e.g., /tmp/-foo or ./-foo.

-?
Display a brief help message on stderr, and exit immediately with a success return code. Same as -help.
-author
Display author information on stderr, and exit immediately with a success return code.
-BibTeX
Input is in BibTeX format.

Processing is similar to that for -TeX, with the addition of these features:

  • `@' characters at the start of a line begin a new paragraph, and restart the delimiter checks.
  • Quotation marks are not significant when they are embedded inside two or more brace levels.
-copyright
Display copyright information on stderr, and exit immediately with a success return code.
-error-file filename
Specify an alternate error log file. This is primarily useful on operating systems that fail to provide for redirection of stderr.
-help
Display a brief help message on stderr, and exit immediately with a success return code. Same as -?.
-ignore delimiters
Specify one or more delimiter characters that are to be ignored. In the case of paired delimiters (braces, brackets, parentheses), either, or both, of a pair may be specified.

Since most delimiter characters have special significance to command shells, it will usually be necessary to protect them suitably from shell interpretation, such as with backslashes, or inside quoted strings.

Angle brackets are more commonly used for less-than and greater-than symbols, rather than <paired>, so -ignore \<\> will be a likely chkdelim option on UNIX systems.

When < and > are required in the -ignore argument, they may be represented by L and G (for less-than and greater-than). This avoids the danger of confusion with UNIX and IBM PC DOS input- and output-file redirection, and gets around the lack of support for protecting special characters on IBM PC DOS command lines.

-Lisp
Input is in Lisp syntax. This should be suitable for most Lisp dialects, including Common Lisp, Emacs Lisp, GNU Guile, Portable Standard Lisp, and Scheme.

With this option, single quotes following whitespace or an open parenthesis are ignored, since they are presumably Lisp shorthand for the quote function: (a is equivalent to (a

Backslash quotes the next character, preventing it from being considered as a possible delimiter.

A single quote between letters is ignored.

Angle brackets are ignored, since they are function names in most Lisp dialects.

Files in those Lisp dialects that use a single closing bracket to represent multiple closing parenthesis will generate warnings in such cases.

-nested
Check for properly-nested delimiters. This is the default.
-no-BibTeX
Suppress any -BibTeX option specified earlier on the command line.
-no-Lisp
Suppress any -Lisp option specified earlier on the command line.
-no-nested
Suppress any -nested option specified earlier on the command line. This is sometimes useful to reduce the number of warning messages.
-no-Nroff
Suppress any -Nroff option specified earlier on the command line.
-no-page-reset
Suppress any -page-reset option specified earlier on the command line.
-no-paragraph-reset
Suppress any -paragraph-reset option specified earlier on the command line.
-no-quote-check
Suppress any -quote-check option specified earlier on the command line.
-no-Scribe
Suppress any -Scribe option specified earlier on the command line.
-no-TeX
Suppress any -TeX option specified earlier on the command line.
-no-TeXinfo
Suppress any -TeXinfo option specified earlier on the command line.
-Nroff
Input is in nroff/troff format.

Backslash quotes the next character, preventing it from being considered as a possible delimiter. \*( is recognized so that it does not cause warnings about unbalanced parentheses.

Quote handling is the same as for the -TeX option.

-output-file filename
Specify an alternate output file. This is primarily useful on operating systems that fail to provide for redirection of stdout.
-page-reset
At start of page, indicated by a formfeed character, issue any needed warning messages, and then forget any delimiter imbalances.
-paragraph-reset
At end of paragraph, which is a line that is empty, or contains only whitespace, issue any needed warning messages, and then forget any delimiter imbalances. This option is often useful to limit the number of messages that can appear.
-quote-check
Override the default handling of forward, or close, quote (apostrophe) selected by -BibTeX, -Nroff, -Scribe, -TeX, or -TeXinfo, so that open and close quotes will be expected to occur in pairs, instead of close quote receiving special handling for its use in abbreviations, possessives, and contractions.
-Scribe
Input is in Scribe format.

`@' quotes the next character, preventing it from being considered as a possible delimiter.

Backslash is an ordinary character.

Quote handling is the same as for the -TeX option. In particular, this means that use of legal Scribe commands of the form @NAME'arg' and @NAME`arg` will produce warning messages.

-TeX
Input is in TeX or LaTeX format.

Backslash quotes the next character, preventing it from being considered as a possible delimiter.

Unbackslashed dollar signs must be paired, either $ or $$ for inline and displayed mathematics, and the contents may not include an empty line. Without this option, dollar characters are always ignored.

Forward and backward quotes are checked to verify that they appear in open/close pairs: `...' and ``...'', instead of in the forms `...` and '...' used in computer programming languages.

For -TeX mode only, the special ligatures ?` and !` for Spanish inverted query and exclamation mark are recognized: they do not cause unbalanced-open-quote warnings.

The following special handling of quotes is in effect unless it has been suppressed by a -quote-check command-line option.

Forward quotes between letters or digits are ignored, so that possessives (Alice's) and elisions (O'Neill) do not raise bogus warnings.

A forward quote between a close brace and an s is assumed to be a possessive, as in {Cook}'s Voyage.

Forward quotes between a space and a digit, or beginning-of-line and a digit, are also ignored, so that text like ``Supercomputing '95'' does not raise warnings.

A forward quote preceding a lone s or t is assumed to reflect Dutch use, as in the personal name in 't Hout or the street name A. v. 's Gravesandestraat" .

-TeXinfo
Input is in GNU TeXinfo format.

`@' quotes the next character, preventing it from being considered as a possible delimiter.

Quote handling is the same as for the -TeX option.

-version
Display version information on stderr, and exit immediately with a success return code.

BUGS

In TeX documents, quotation marks "..." should be used only inside verbatim environments, but chkdelim does not recognize such environments, so it will only warn if quotation marks are unbalanced. LaTeX users are advised to employ the lacheck(1) utility to detect incorrect use of quotation marks.

SEE ALSO

lacheck(1).

AUTHOR

Nelson H. F. Beebe, Ph.D.
Center for Scientific Computing
University of Utah
Department of Mathematics, 322 INSCC
155 S 1400 E RM 233
Salt Lake City, UT 84112-0090
USA
Tel: +1 801 581 5254
FAX: +1 801 585 1640, +1 801 581 4148
Email: [email protected], [email protected], [email protected] (Internet)
WWW URL: http://www.math.utah.edu/~beebe

AVAILABILITY

The source code distribution for chkdelim is freely available, and may be found on the World-Wide Web at
http://www.math.utah.edu/pub/misc/index.html#chkdelim
or equivalently, via anonymous ftp at
ftp://ftp.math.utah.edu/pub/misc/chkdelim-x.y.tar.gz ftp://ftp.math.utah.edu/pub/misc/chkdelim-x.y.zip ftp://ftp.math.utah.edu/pub/misc/chkdelim-x.y.zoo
where x.y is a version number.