[mcclim-cvs] CVS mcclim/Drei

thenriksen thenriksen at common-lisp.net
Thu Dec 27 15:22:54 UTC 2007


Update of /project/mcclim/cvsroot/mcclim/Drei
In directory clnet:/tmp/cvs-serv15485/Drei

Modified Files:
	lisp-syntax.lisp packages.lisp 
Log Message:
Added a few more facilities to Lisp syntax.


--- /project/mcclim/cvsroot/mcclim/Drei/lisp-syntax.lisp	2007/12/23 18:17:55	1.41
+++ /project/mcclim/cvsroot/mcclim/Drei/lisp-syntax.lisp	2007/12/27 15:22:54	1.42
@@ -1469,6 +1469,8 @@
 (define-form-predicate form-simple-vector-p (simple-vector-form))
 
 (define-form-predicate comment-p (comment))
+(define-form-predicate line-comment-p (line-comment-form))
+(define-form-predicate long-comment-p (long-comment-form))
 
 (defgeneric form-at-top-level-p (form)
   (:documentation "Return NIL if `form' is not a top-level-form,
@@ -1523,6 +1525,25 @@
                (when (typep comment 'incomplete-long-comment-form)
                  (< (1+ (start-offset comment)) offset)))))))
 
+(defun in-line-comment-p (syntax mark-or-offset)
+  "Return true if `mark-or-offset' is inside a Lisp line
+comment."
+  (as-offsets ((offset mark-or-offset))
+    (let ((comment (in-type-p syntax mark-or-offset 'line-comment-form)))
+      (when comment
+        (< (start-offset comment) offset)))))
+
+(defun in-long-comment-p (syntax mark-or-offset)
+  "Return true if `mark-or-offset' is inside a Lisp
+long comment."
+  (as-offsets ((offset mark-or-offset))
+    (let ((comment (in-type-p syntax mark-or-offset 'long-comment-form)))
+      (and comment
+           (or (if (typep comment 'complete-long-comment-form)
+                   (< (1+ (start-offset comment)) offset
+                      (1- (end-offset comment)))
+                   (< (1+ (start-offset comment)) offset)))))))
+
 (defun in-character-p (syntax mark-or-offset)
   "Return true if `mark-or-offset' is inside a Lisp character lexeme."
   (as-offsets ((offset mark-or-offset))
@@ -1670,16 +1691,20 @@
 beginning of (precedes) the children of the enclosing list. False
 if there is no enclosing list. True if the list has no children."
   (as-offsets ((offset mark-or-offset))
-   (let ((enclosing-list (list-at-mark syntax offset)))
-     (and enclosing-list (at-beginning-of-children-p enclosing-list offset)))))
+    (let ((enclosing-list (list-at-mark syntax offset)))
+      (and enclosing-list (at-beginning-of-children-p enclosing-list offset)))))
 
 (defun structurally-at-end-of-list-p (syntax mark-or-offset)
   "Return true if `mark-or-offset' structurally is at the end
 of (is preceded by) the children of the enclosing list. False if
 there is no enclosing list. True of the list has no children."
   (as-offsets ((offset mark-or-offset))
-   (let ((enclosing-list (list-at-mark syntax offset)))
-     (and enclosing-list (at-end-of-children-p enclosing-list offset)))))
+    (let ((enclosing-list (list-at-mark syntax offset)))
+      (and enclosing-list (at-end-of-children-p enclosing-list offset)))))
+
+(defun comment-at-mark (syntax mark-or-offset)
+  "Return the comment at `mark-or-offset'."
+  (in-type-p syntax mark-or-offset 'comment))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
--- /project/mcclim/cvsroot/mcclim/Drei/packages.lisp	2007/12/27 13:39:25	1.25
+++ /project/mcclim/cvsroot/mcclim/Drei/packages.lisp	2007/12/27 15:22:54	1.26
@@ -518,7 +518,7 @@
            #:form-comma-p #:form-comma-at-p #:form-comma-dot-p
            #:form-character-p
            #:form-simple-vector-p
-           #:comment-p
+           #:comment-p #:line-comment-p #:long-comment-p
            #:form-at-top-level-p
 
            ;; Querying form data
@@ -530,6 +530,8 @@
            ;; Querying about state at mark
            #:in-string-p
            #:in-comment-p
+           #:in-line-comment-p
+           #:in-long-comment-p
            #:in-character-p
            #:location-at-beginning-of-form
            #:location-at-end-of-form
@@ -537,6 +539,11 @@
            #:at-end-of-list-p
            #:at-beginning-of-string-p
            #:at-end-of-string-p
+           #:at-beginning-of-children-p
+           #:at-end-of-children-p
+           #:structurally-at-beginning-of-children-p
+           #:structurally-at-end-of-children-p
+           #:comment-at-mark
 
            ;; Lambda list classes.
            #:lambda-list




More information about the Mcclim-cvs mailing list