From 75e9cc28c7defa01da3ec173de376159586bcc8a Mon Sep 17 00:00:00 2001 From: "waldemar%netscape.com" Date: Tue, 14 Jan 2003 22:19:35 +0000 Subject: [PATCH] Added note statement git-svn-id: svn://10.0.0.236/trunk@136327 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/js2/semantics/Calculus.lisp | 10 ++++++---- mozilla/js2/semantics/CalculusMarkup.lisp | 12 ++++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/mozilla/js2/semantics/Calculus.lisp b/mozilla/js2/semantics/Calculus.lisp index c09b2e8c403..7055e462cd4 100644 --- a/mozilla/js2/semantics/Calculus.lisp +++ b/mozilla/js2/semantics/Calculus.lisp @@ -65,7 +65,7 @@ #+mcl (dolist (indent-spec '((? . 1) (apply . 1) (funcall . 1) (declare-action . 5) (production . 3) (rule . 2) (function . 2) (define . 2) (deftag . 1) (defrecord . 1) (deftype . 1) (tag . 1) (%text . 1) - (var . 2) (const . 2) (rwhen . 1) (while . 1) (for-each . 2) + (assert . 1) (var . 2) (const . 2) (rwhen . 1) (while . 1) (for-each . 2) (new . 1) (set-field . 1) (:narrow . 1) (:select . 1))) (pushnew indent-spec ccl:*fred-special-indent-alist* :test #'equal)) @@ -4773,10 +4773,11 @@ ; (// . ) -; A one-paragraph comment using the given . +; (note . ) +; A one-paragraph comment using the given . The note form precedes the text with the keyword 'note'. (defun scan-// (world type-env rest-statements last special-form &rest text) (unless text - (error "// should have non-empty text")) + (error "// or note should have non-empty text")) (let ((text2 (scan-expressions-in-comment world type-env text))) (multiple-value-bind (rest-codes rest-live rest-annotated-stmts) (scan-statements world type-env rest-statements last) (values rest-codes @@ -4837,7 +4838,7 @@ ; can contain the entry (:assertion) to depict . (defun scan-assert (world type-env rest-statements last special-form condition-expr &rest text) (unless text - (error "assert should have non-empty text")) + (setq text '((:assertion) ";"))) (let ((text2 (scan-expressions-in-comment world type-env text))) (multiple-value-bind (condition-code condition-annotated-expr true-type-env false-type-env) (scan-condition world type-env condition-expr) @@ -5559,6 +5560,7 @@ (:statement (// scan-// depict-//) + (note scan-// depict-note) (/* scan-/* depict-//) (*/ scan-*/ depict-*/) (bottom scan-bottom depict-bottom) diff --git a/mozilla/js2/semantics/CalculusMarkup.lisp b/mozilla/js2/semantics/CalculusMarkup.lisp index 0f3fa3775aa..f766c06c9f9 100644 --- a/mozilla/js2/semantics/CalculusMarkup.lisp +++ b/mozilla/js2/semantics/CalculusMarkup.lisp @@ -67,7 +67,8 @@ while for each do return throw try catch - case of)) + case of + note)) ; Emit markup for one of the semantic keywords, as specified by keyword-symbol. ; space can be either nil, :before, or :after to indicate space placement. @@ -1120,6 +1121,13 @@ (depict-text-paragraph markup-stream last-paragraph-style text))) +; (note . ) +(defun depict-note (markup-stream world semicolon last-paragraph-style &rest text) + (declare (ignore world semicolon)) + (depict-division-style (markup-stream :wrap) + (depict-text-paragraph markup-stream last-paragraph-style (list* '(:keyword note) " " text)))) + + ; (*/) ; These should have been filtered out by scan-/*, so any that remain are errors. (defun depict-*/ (markup-stream world semicolon last-paragraph-style) @@ -1142,7 +1150,7 @@ (declare (ignore semicolon)) (let ((*assertion-depictor* #'(lambda (markup-stream) (depict-expression markup-stream world condition-annotated-expr %expr%)))) (depict-division-style (markup-stream :wrap) - (depict-text-paragraph markup-stream last-paragraph-style text)))) + (depict-text-paragraph markup-stream last-paragraph-style (list* '(:keyword note) " " text))))) ; (:assertion) (defun depict-assertion (markup-stream)