Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
checkbrack(1)			     hxtools			   checkbrack(1)

Name
     checkbrack -- check parenthesis and bracket count

Syntax
     checkbrack file...

Description
     Displays  each  line of the file(s), together with their open bracket count
     that is reached at the end of line. Particularly, it  allows  you	to  find
     missing  closing  brackets. This is especially helpful because the Perl in-
     terpreter for example has problems telling you where exactly something went
     wrong.

Example
     $ checkbrack /usr/lib/hxtools/bin/checkbrack | less -S
     #	 () [] {}
     13  0  0  1 foreach my $file (@ARGV) {
     14  0  0  1     if (!-f $file) { next; }
     15  0  0  1     print "Displaying $file...0;
     16  0  0  2     if (!open(IN, "< $file")) {
     17  0  0  2	 print "Error opening $file: $!0;
     18  0  0  2	 next;
     19  0  0  1     }

     The numbers at the front are: line number, number of unclosed  left  paren-
     theses, number of unclosed left square brackets and number of unclosed left
     square braces.

     At  the  end  of  line 19, we would need to close one more brace to make it
     syntactically valid code.

     The interesting thing of this, that if GCC, Perl or whatever outputs an er-
     ror and you do not figure out what it means -- that is often the case  with
     missing  braces  -- run checkbrack on the source file, skip to the end, and
     watch the brace counts.

     Scroll up until the brace counts seem normal (i.e. 0 open braces)	at  out-
     side any function.

See also
     hxtools(7)

hxtools 			   2008-02-06			   checkbrack(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=checkbrack&sektion=1&manpath=FreeBSD+Ports+15.1.quarterly>

home | help