[climacs-cvs] CVS update: climacs/lisp-syntax.lisp climacs/climacs.asd climacs/gui.lisp climacs/packages.lisp climacs/syntax.lisp

Robert Strandh rstrandh at common-lisp.net
Mon May 30 07:25:15 UTC 2005


Update of /project/climacs/cvsroot/climacs
In directory common-lisp.net:/tmp/cvs-serv12579

Modified Files:
	climacs.asd gui.lisp packages.lisp syntax.lisp 
Added Files:
	lisp-syntax.lisp 
Log Message:
Alternative syntax for editing common lisp (called "Lisp").

I have not completely lost hope of making the Earley-based syntax
module fast enough, but as of now I don't know how.

This syntax module provides an incremental resynchronizing LR parser
for Common Lisp.  It is fast enough the parse tree for the entire
buffer is kept updated, as opposed to just for what is visible in the
CLIM pane. 

Ultimately, I hope to factor out the parts that are not specific to
Lisp into a different module, perhaps the existing syntax.lisp file.
I'll be interested in your opinions. 


Date: Mon May 30 09:25:14 2005
Author: rstrandh



Index: climacs/climacs.asd
diff -u climacs/climacs.asd:1.29 climacs/climacs.asd:1.30
--- climacs/climacs.asd:1.29	Mon May 23 03:00:24 2005
+++ climacs/climacs.asd	Mon May 30 09:25:13 2005
@@ -65,6 +65,7 @@
    "html-syntax"
    "prolog-syntax"
    "ttcn3-syntax"
+   "lisp-syntax"
    "gui"
    ;;---- optional ----
    "testing/rt"


Index: climacs/gui.lisp
diff -u climacs/gui.lisp:1.140 climacs/gui.lisp:1.141
--- climacs/gui.lisp:1.140	Thu May 26 10:31:53 2005
+++ climacs/gui.lisp	Mon May 30 09:25:13 2005
@@ -270,7 +270,11 @@
 		 (motion-before-beginning ()
 		   (beep) (display-message "Beginning of buffer"))
 		 (motion-after-end ()
-		   (beep) (display-message "End of buffer")))
+		   (beep) (display-message "End of buffer"))
+		 (no-expression ()
+		   (beep) (display-message "No expression around point"))
+		 (no-such-operation ()
+		   (beep) (display-message "Operation unavailable for syntax")))
 	       (setf (previous-command *standard-output*)
 		     (if (consp command)
 			 (car command)
@@ -1375,6 +1379,33 @@
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; 
+;;; For testing purposes
+
+(define-named-command com-reset-profile ()
+  (sb-profile:reset))
+
+(define-named-command com-report-profile ()
+  (sb-profile:report))
+
+(define-named-command com-recompile ()
+  (asdf:operate 'asdf:load-op :climacs))
+
+(define-named-command com-backward-expression ((count 'integer :prompt "Number of expressions"))
+  (declare (ignore count))
+  (let* ((pane (current-window))
+	 (point (point pane))
+	 (syntax (syntax (buffer pane))))
+    (backward-expression point syntax)))
+
+(define-named-command com-forward-expression ((count 'integer :prompt "Number of expresssions"))
+  (declare (ignore count))
+  (let* ((pane (current-window))
+	 (point (point pane))
+	 (syntax (syntax (buffer pane))))
+    (forward-expression point syntax)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; 
 ;;; Global and dead-escape command tables
 
 (make-command-table 'global-climacs-table :errorp nil)
@@ -1459,6 +1490,9 @@
 (global-set-key #\Backspace `(com-backward-delete-object ,*numeric-argument-marker*))
 
 (global-set-key '(:insert) 'com-toggle-overwrite-mode)
+
+(global-set-key '(#\b :control :meta) `(com-backward-expression ,*numeric-argument-marker*))
+(global-set-key '(#\f :control :meta) `(com-forward-expression ,*numeric-argument-marker*))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; 


Index: climacs/packages.lisp
diff -u climacs/packages.lisp:1.62 climacs/packages.lisp:1.63
--- climacs/packages.lisp:1.62	Sat May  7 00:32:28 2005
+++ climacs/packages.lisp	Mon May 30 09:25:13 2005
@@ -103,7 +103,9 @@
 	   #:parse-stack-top #:target-parse-tree #:parse-state-empty-p
 	   #:parse-stack-next #:parse-stack-symbol
 	   #:parse-stack-parse-trees #:map-over-parse-trees
+	   #:no-such-operation #:no-expression
            #:syntax-line-indentation
+	   #:forward-expression #:backward-expression
 	   #:redisplay-pane-with-syntax
 	   #:beginning-of-paragraph #:end-of-paragraph))
 
@@ -149,6 +151,11 @@
   (:shadow "ATOM" "CLOSE" "EXP" "INTEGER" "OPEN" "VARIABLE"))
 
 (defpackage :climacs-cl-syntax
+  (:use :clim-lisp :clim :climacs-buffer :climacs-base 
+	:climacs-syntax :flexichain :climacs-pane)
+  (:export))
+
+(defpackage :climacs-lisp-syntax
   (:use :clim-lisp :clim :climacs-buffer :climacs-base 
 	:climacs-syntax :flexichain :climacs-pane)
   (:export))


Index: climacs/syntax.lisp
diff -u climacs/syntax.lisp:1.50 climacs/syntax.lisp:1.51
--- climacs/syntax.lisp:1.50	Thu May 26 10:31:53 2005
+++ climacs/syntax.lisp	Mon May 30 09:25:13 2005
@@ -25,6 +25,20 @@
 (defclass syntax (name-mixin)
   ((buffer :initarg :buffer :reader buffer)))
 
+(define-condition no-such-operation (simple-error)
+  ()
+  (:report (lambda (condition stream)
+	     (format stream "Operation unavailable for this syntax")))
+  (:documentation "This condition is signaled whenever an attempt is
+made to execute an operation that is unavailable for the particular syntax" ))
+
+(define-condition no-expression (simple-error)
+  ()
+  (:report (lambda (condition stream)
+	     (format stream "No expression at point")))
+  (:documentation "This condition is signaled whenever an attempt is
+made to execute a by-experssion motion command and no expression is available." ))
+
 (defgeneric update-syntax (buffer syntax))
 
 (defgeneric update-syntax-for-display (buffer syntax from to))
@@ -33,6 +47,10 @@
   (:documentation "Return the correct indentation for the line containing
 the mark, according to the specified syntax."))
 
+(defgeneric forward-expression (mark syntax))
+
+(defgeneric backward-expression (mark syntax))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
 ;;; Syntax completion
@@ -124,6 +142,12 @@
 (defmethod syntax-line-indentation (mark tab-width (syntax basic-syntax))
   (declare (ignore mark tab-width))
   0)
+
+(defmethod forward-expression (mark syntax)
+  (error 'no-such-operation))
+
+(defmethod backward-expression (mark syntax)
+  (error 'no-such-operation))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;




More information about the Climacs-cvs mailing list