#| -*-Scheme-*-
-$Id: paredit.scm,v 1.5 2006/06/27 18:43:59 riastradh Exp $
+$Id: paredit.scm,v 1.6 2006/07/03 19:05:02 riastradh Exp $
This code is written by Taylor R. Campbell and placed in the Public
Domain. All warranties are disclaimed.
(buffer-start (current-buffer)))
point)))
-;++ These are wrong, but, argh, I don't think Edwin preserves enough
-;++ information to make them right.
-
-(define (parse-state-end-of-sexp state)
- (forward-one-sexp (forward-one-sexp (parse-state-last-sexp state))))
-
-(define (parse-state-start-of-sexp state)
- (backward-one-sexp (parse-state-end-of-sexp state)))
-
(define (insert-sexp-pair open close sexps #!optional mark)
(define (insert-space end? mark)
#| -*-Scheme-*-
-$Id: syntax.scm,v 1.93 2004/11/19 16:59:27 cph Exp $
+$Id: syntax.scm,v 1.94 2006/07/03 19:05:02 riastradh Exp $
Copyright 1987,1989,1991,1992,1996,1997 Massachusetts Institute of Technology
Copyright 1998,1999,2000,2001,2002,2004 Massachusetts Institute of Technology
;; COMMENT-START is valid when COMMENT-STATE is not #f.
(comment-state #f read-only #t)
(quoted? #f read-only #t)
+ (start-of-sexp #f)
(last-sexp #f)
(containing-sexp #f)
(location #f)
(parse-state-quoted? state)
(not (= (parse-state-depth state) 0))))
+(define (parse-state-end-of-sexp state)
+ (cond ((parse-state-start-of-sexp state)
+ => forward-one-sexp)
+ (else #f)))
+
(define (forward-to-sexp-start mark end)
(parse-state-location (parse-partial-sexp mark end 0 #t)))
(mark-index end)
target-depth stop-before? old-state)))
;; Convert the returned indices to marks.
+ (if (parse-state-start-of-sexp state)
+ (set-parse-state-start-of-sexp!
+ state
+ (make-mark group (parse-state-start-of-sexp state))))
(if (parse-state-last-sexp state)
(set-parse-state-last-sexp!
state
/* -*-C-*-
-$Id: syntax.c,v 1.30 2005/07/16 03:46:42 cph Exp $
+$Id: syntax.c,v 1.31 2006/07/03 19:05:02 riastradh Exp $
Copyright 1987,1988,1989,1991,1993,1996 Massachusetts Institute of Technology
Copyright 2000,2004,2005 Massachusetts Institute of Technology
FAST_VECTOR_SET (result, 3, (BOOLEAN_TO_OBJECT (quoted)));
FAST_VECTOR_SET
(result, 4,
+ (((level -> last) == NULL)
+ ? SHARP_F
+ : (LONG_TO_UNSIGNED_FIXNUM ((SCAN_TO_INDEX (level -> last)) - 1))));
+ FAST_VECTOR_SET
+ (result, 5,
(((level -> previous) == NULL)
? SHARP_F
: (LONG_TO_UNSIGNED_FIXNUM ((SCAN_TO_INDEX (level -> previous)) - 1))));
FAST_VECTOR_SET
- (result, 5,
+ (result, 6,
(((level == level_start) || (((level - 1) -> last) == NULL))
? SHARP_F
: (LONG_TO_UNSIGNED_FIXNUM
((SCAN_TO_INDEX ((level - 1) -> last)) - 1))));
FAST_VECTOR_SET
- (result, 6, (LONG_TO_UNSIGNED_FIXNUM (SCAN_TO_INDEX (start))));
+ (result, 7, (LONG_TO_UNSIGNED_FIXNUM (SCAN_TO_INDEX (start))));
FAST_VECTOR_SET
- (result, 7,
+ (result, 8,
((in_comment == 0)
? SHARP_F
: (LONG_TO_UNSIGNED_FIXNUM (SCAN_TO_INDEX (comment_start)))));