diff options
author | 2000-10-30 14:53:43 +0000 | |
---|---|---|
committer | 2000-10-30 14:53:43 +0000 | |
commit | e09aad88fb9c92b7e10483e8c44fbf9d45b8a232 (patch) | |
tree | ca51dcf1a15658cfabca66aa01a1efa2b0ba6f2c /generic/proof-utils.el | |
parent | c5f30e41c3e1cbd50dbb9e3c5cf868a571a4b6b8 (diff) |
*** empty log message ***
Diffstat (limited to 'generic/proof-utils.el')
-rw-r--r-- | generic/proof-utils.el | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/generic/proof-utils.el b/generic/proof-utils.el index e09dea34..942acd42 100644 --- a/generic/proof-utils.el +++ b/generic/proof-utils.el @@ -672,50 +672,5 @@ If RETURNNOPATH is non-nil, return PROGNAME even if we can't find a full path." (setq autoload-package-name "proof") (setq generated-autoload-file "proof-autoloads.el") -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; The following function removes comments from a string. Nested -;; comments should work. Warning the length of the resulting -;; string is reduced, it may be better to replace comments by -;; white spaces - -(defun proof-remove-comment (str) - "proof-remove-comment str: return the string str with all comments removed. Nested comments should work." - (if (and str proof-comment-start-regexp proof-comment-end-regexp) - (let - ((astr "") ; the result string - (regexp1 (concat "\\(\"\\)\\|\\(" - proof-comment-start-regexp "\\)\\|\\(" - proof-comment-end-regexp "\\)")) - (regexp2 (concat "\\(\"\\)")) - (pos 0) ; position of the previous match - (mpos 0) ; position of the current match - (lpos 0) ; start of the substring not in a comment and not - ; yet in astr - (lvl 0) ; number of level of comments - (in-string nil) ; are we in a string - ) - (while mpos - (setq mpos - (proof-string-match (if in-string regexp2 regexp1) str pos)) - (cond - ((match-string 1 str) - (setq pos (+ mpos 1) in-string (not in-string))) - ((match-string 2 str) - (progn - (if (= lvl 0) - (setq astr (concat astr - (substring str lpos mpos)))) - (setq pos (+ mpos 1) lvl (+ lvl 1)))) - ((match-string 3 str) - (progn - (setq pos (+ mpos 1) lvl (- lvl 1)) - (if (< lvl 0) (error "End comment not closing a start comment")) - (if (= lvl 0) - (setq lpos - (+ mpos (length (match-string 2 str))))))))) - (setq astr (concat astr (substring str pos))) - astr))) - ;; End of proof-utils.el (provide 'proof-utils)
\ No newline at end of file |