[climacs-cvs] CVS update: climacs/buffer-en.html climacs/buffer.html climacs/html-syntax.lisp

Robert Strandh rstrandh at common-lisp.net
Mon Apr 11 06:27:16 UTC 2005


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

Modified Files:
	buffer-en.html buffer.html html-syntax.lisp 
Log Message:
Modified html lexer to return end-tag-start when it sees `</', and
start-tag-start when it sees `<' followed by something other than
slash.  Slash is no longer a specific lexeme, just a delimiter like
the others. 


Date: Mon Apr 11 08:27:13 2005
Author: rstrandh

Index: climacs/buffer-en.html
diff -u climacs/buffer-en.html:1.3 climacs/buffer-en.html:1.4
--- climacs/buffer-en.html:1.3	Thu Dec 16 07:29:01 2004
+++ climacs/buffer-en.html	Mon Apr 11 08:27:12 2005
@@ -1,8 +1,9 @@
-<HTML><TITLE> Second semester master </TITLE>
+<HTML lang=en>
+<head><TITLE> Second semester master </TITLE></head>
 <BODY>
-<a "href="buffer.html">Version française</a>
+<p><a href="buffer.html">Version française</a></p>
 <h1> Programming project 2004 - 2005 </h1>
-<br><hr><br>
+<hr>
 
 <ul> 
 <li> <h3> Title:  </h3> 
@@ -33,9 +34,9 @@
 ISO-latin-1, while still allowing all Unicode characters to be
 present, the physical representation consists of a 2-3-tree (which
 might be supplied) of lines of text, each line being represented by a
-flexichain of characters (the implementation of which will be supplied).<p>
+flexichain of characters (the implementation of which will be supplied).</p>
+
 
-<br>
 <li><h3> Required hardware and software:</h3>
 <p>A PC with GNU/Linux.  A recent version (at least 0.8.17) of the
 SBCL system (a free implementation of Common Lisp), GNU Emacs, SLIME 
@@ -43,7 +44,7 @@
 
 <br>
 <li> <h3> Bibliographic- and web references: :</h3>
-<P>
+
 <ul>
 <li><a href="climacs-en.html">Description of the Climacs project</a>
 <li><a href="buffer.text">Description of the "buffer" protocol</a></li>
@@ -57,7 +58,7 @@
 <li><a href="http://www.finseth.com/craft/">The Craft of Text Editing
     by Craig A. Finseth</a></li>
 </ul>
-</p>
+
 </ul>
 
 </BODY></HTML>


Index: climacs/buffer.html
diff -u climacs/buffer.html:1.4 climacs/buffer.html:1.5
--- climacs/buffer.html:1.4	Mon Apr 11 08:12:22 2005
+++ climacs/buffer.html	Mon Apr 11 08:27:12 2005
@@ -1,4 +1,4 @@
-<HTML><HEAD><TITLE> Master 2ème semestre</TITLE></HEAD>
+<HTML lang=fr><HEAD><TITLE> Master 2ème semestre</TITLE></HEAD>
 <BODY>
 <p><a href="buffer-en.html">English version</a></p>
 <h1> Projets de Programmation 2004 - 2005 </h1>
@@ -44,7 +44,7 @@
 
 <br>
 <li> <h3> Références bibliographiques et http: :</h3>
-<P>
+
 <ul>
 <li><a href="climacs.html">Description du projet Climacs</a>
 <li><a href="buffer.text">Description du protocole "buffer"</a></li>
@@ -58,7 +58,7 @@
 <li><a href="http://www.finseth.com/craft/">The Craft of Text Editing
     by Craig A. Finseth</a></li>
 </ul>
-</p>
+
 </ul>
 
 </BODY></HTML>


Index: climacs/html-syntax.lisp
diff -u climacs/html-syntax.lisp:1.28 climacs/html-syntax.lisp:1.29
--- climacs/html-syntax.lisp:1.28	Mon Apr 11 08:12:22 2005
+++ climacs/html-syntax.lisp	Mon Apr 11 08:27:13 2005
@@ -48,9 +48,9 @@
   ((state :initarg :state)))
 
 (defclass start-lexeme (html-lexeme) ())
-(defclass tag-start (html-lexeme) ())
+(defclass start-tag-start (html-lexeme) ())
+(defclass end-tag-start (html-lexeme) ())
 (defclass tag-end (html-lexeme) ())
-(defclass slash (html-lexeme) ())
 (defclass word (html-lexeme) ())
 (defclass delimiter (html-lexeme) ())
 
@@ -60,9 +60,12 @@
   (flet ((fo () (forward-object scan)))
     (let ((object (object-after scan)))
       (case object
-	(#\< (fo) (make-instance 'tag-start))
+	(#\< (fo) (cond ((or (end-of-buffer-p scan)
+			     (not (eql (object-after scan) #\/)))
+			 (make-instance 'start-tag-start))
+			(t (fo)
+			   (make-instance 'end-tag-start))))
 	(#\> (fo) (make-instance 'tag-end))
-	(#\/ (fo) (make-instance 'slash))
 	(t (cond ((alphanumericp object)
 		  (loop until (end-of-buffer-p scan)
 			while (alphanumericp (object-after scan))
@@ -94,8 +97,8 @@
      (defclass ,name (html-tag) ())
 
      (add-html-rule
-      (,name -> (tag-start
-		 (word (and (= (end-offset tag-start) (start-offset word))
+      (,name -> (start-tag-start
+		 (word (and (= (end-offset start-tag-start) (start-offset word))
 			    (word-is word ,string)))
 		 (tag-end (= (end-offset word) (start-offset tag-end))))))))
 
@@ -104,9 +107,8 @@
      (defclass ,name (html-tag) ())
 
      (add-html-rule
-      (,name -> (tag-start
-		 (slash (= (end-offset tag-start) (start-offset slash)))
-		 (word (and (= (end-offset slash) (start-offset word))
+      (,name -> (end-tag-start
+		 (word (and (= (end-offset end-tag-start) (start-offset word))
 			    (word-is word ,string)))
 		 (tag-end (= (end-offset word) (start-offset tag-end))))))))
 
@@ -383,12 +385,12 @@
    (attributes :initarg :attributes)
    (end :initarg :end)))
 
-(add-html-rule (<a> -> (tag-start
-			(word (and (= (end-offset tag-start) (start-offset word))
+(add-html-rule (<a> -> (start-tag-start
+			(word (and (= (end-offset start-tag-start) (start-offset word))
 				   (word-is word "a")))
 			<a>-attributes
 			tag-end)
-		    :start tag-start :name word :attributes <a>-attributes :end tag-end))
+		    :start start-tag-start :name word :attributes <a>-attributes :end tag-end))
 
 (defmethod display-parse-tree ((entity <a>) (syntax html-syntax) pane)
   (with-slots (start name attributes end) entity
@@ -435,12 +437,12 @@
    (attributes :initarg :attributes)
    (end :initarg :end)))
 
-(add-html-rule (<p> -> (tag-start
-			(word (and (= (end-offset tag-start) (start-offset word))
+(add-html-rule (<p> -> (start-tag-start
+			(word (and (= (end-offset start-tag-start) (start-offset word))
 				   (word-is word "p")))
 			common-attributes
 			tag-end)
-		    :start tag-start :name word :attributes common-attributes :end tag-end))
+		    :start start-tag-start :name word :attributes common-attributes :end tag-end))
 
 (defmethod display-parse-tree ((entity <p>) (syntax html-syntax) pane)
   (with-slots (start name attributes end) entity
@@ -473,12 +475,12 @@
    (attributes :initarg :attributes)
    (end :initarg :end)))
 
-(add-html-rule (<li> -> (tag-start
-			 (word (and (= (end-offset tag-start) (start-offset word))
+(add-html-rule (<li> -> (start-tag-start
+			 (word (and (= (end-offset start-tag-start) (start-offset word))
 				    (word-is word "li")))
 			 common-attributes
 			 tag-end)
-		     :start tag-start
+		     :start start-tag-start
 		     :name word
 		     :attributes common-attributes
 		     :end tag-end))
@@ -517,12 +519,12 @@
    (attributes :initarg :attributes)
    (end :initarg :end)))
 
-(add-html-rule (<ul> -> (tag-start
-			 (word (and (= (end-offset tag-start) (start-offset word))
+(add-html-rule (<ul> -> (start-tag-start
+			 (word (and (= (end-offset start-tag-start) (start-offset word))
 				    (word-is word "ul")))
 			 common-attributes
 			 tag-end)
-		     :start tag-start
+		     :start start-tag-start
 		     :name word
 		     :attributes common-attributes
 		     :end tag-end))
@@ -628,12 +630,12 @@
    (attributes :initarg :attributes)
    (end :initarg :end)))
 
-(add-html-rule (<html> -> (tag-start
-			   (word (and (= (end-offset tag-start) (start-offset word))
+(add-html-rule (<html> -> (start-tag-start
+			   (word (and (= (end-offset start-tag-start) (start-offset word))
 				      (word-is word "html")))
 			   <html>-attributes
 			   tag-end)
-		       :start tag-start :name word :attributes <html>-attributes :end tag-end))
+		       :start start-tag-start :name word :attributes <html>-attributes :end tag-end))
 
 (defmethod display-parse-tree ((entity <html>) (syntax html-syntax) pane)
   (with-slots (start name attributes end) entity




More information about the Climacs-cvs mailing list