Commit 1730d0b6 authored by Robert Strandh's avatar Robert Strandh

Factored out the rules for `html' and `head' so that they now

use add-rule.
parent 48ca0ef4
......@@ -80,12 +80,7 @@
;;;
;;; parser
(defparameter *html-grammar*
(grammar
(html -> (<html> head body </html>)
:<html> <html> :head head :body body :</html> </html>)
(head -> (<head> title </head>)
:<head> <head> :title title :</head> </head>)))
(defparameter *html-grammar* (grammar))
(defun word-is (word string)
(string-equal (coerce (buffer-sequence (buffer word) (start-offset word) (end-offset word)) 'string)
......@@ -279,6 +274,10 @@
(title :initarg :title)
(</head> :initarg :</head>)))
(add-rule (grammar-rule (head -> (<head> title </head>)
:<head> <head> :title title :</head> </head>))
*html-grammar*)
(defmethod display-parse-tree ((entity head) (syntax html-syntax) pane)
(with-slots (<head> title </head>) entity
(display-parse-tree <head> syntax pane)
......@@ -293,6 +292,10 @@
(body :initarg :body)
(</html> :initarg :</html>)))
(add-rule (grammar-rule (html -> (<html> head body </html>)
:<html> <html> :head head :body body :</html> </html>))
*html-grammar*)
(defmethod display-parse-tree ((entity html) (syntax html-syntax) pane)
(with-slots (<html> head body </html>) entity
(display-parse-tree <html> syntax pane)
......
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