;;; -*- Mode: Emacs-Lisp -*-;;; ilisp-prn.el --;;; ILISP paren handling.;;;;;; This file is part of ILISP.;;; Please refer to the file COPYING for copyrights and licensing;;; information.;;; Please refer to the file ACKNOWLEGDEMENTS for an (incomplete) list;;; of present and past contributors.;;;;;; $Id$;;;%Unbalanced parentheses(defunlisp-skip(end)"Skip past whitespace, comments, backslashed characters and strings.The operation is done in the current buffer as long as we are before END.This does move the point."(if(<(point)end)(let((comment(andcomment-start(string-to-charcomment-start)))(donenil)char)(while(and(<(point)end)(notdone))(skip-chars-forward"\n\t "end)(setqchar(char-after(point)))(cond((eqchar?\")(forward-sexp))((eqcharcomment)(forward-char)(skip-chars-forward"^\n"end))((eqchar?\\)(forward-char2))(t(setqdonet)))))));;;(defunlisp-count-pairs(beginendleft-delimiterright-delimiter)"Return the number of top-level pairs of LEFT-DELIMITER and RIGHT-DELIMITER.Counting is done only between BEGIN and END. If they don't match, the pointwill be placed on the offending entry."(let((old-point(point))(sexp0)left)(goto-charbegin)(lisp-skipend)(while(<(point)end)(let((char(char-after(point))))(cond((or(eqcharleft-delimiter);; For things other than lists(eq(char-after(1-(point)))?\n))(setqsexp(1+sexp))(if(condition-case()(progn(forward-sexp)nil)(errort))(error"Extra %s"(char-to-stringleft-delimiter))))((eqcharright-delimiter)(error"Extra %s"(char-to-stringright-delimiter)))((<(point)end)(forward-char))))(lisp-skipend))(goto-charold-point)sexp));;;(defunfind-unbalanced-region-lisp(startend)"Go to the point where LEFT-DELIMITER and RIGHT-DELIMITER become unbalanced.Point will be on the offending delimiter within the region."(interactive"r")(lisp-count-pairsstartend(string-to-charleft-delimiter)(string-to-charright-delimiter))(if(notilisp-complete)(progn(beep)(message"Delimiters balance"))));;;(defunfind-unbalanced-lisp(arg)"Go to the point where LEFT-DELIMITER and RIGHT-DELIMITER become unbalanced.Point will be on the offending delimiter in the buffer.If called with a prefix, use the current region."(interactive"P")(ifarg(call-interactively'find-unbalanced-region-lisp)(find-unbalanced-region-lisp(point-min)(point-max))));;; end of file -- ilisp-prn.el --