Commit ec2a58b9 authored by Robert Strandh's avatar Robert Strandh

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.
parent f6a1ef3f
<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 @@ buffer when few of them are outside of the range defined by
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 @@ SBCL system (a free implementation of Common Lisp), GNU Emacs, SLIME
<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 @@ SBCL system (a free implementation of Common Lisp), GNU Emacs, SLIME
<li><a href="http://www.finseth.com/craft/">The Craft of Text Editing
by Craig A. Finseth</a></li>
</ul>
</p>
</ul>
</BODY></HTML>
<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 @@ McCLIM</p>
<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 @@ McCLIM</p>
<li><a href="http://www.finseth.com/craft/">The Craft of Text Editing
by Craig A. Finseth</a></li>
</ul>
</p>
</ul>
</BODY></HTML>
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment