;;; -*- mode: Lisp; Syntax: Common-Lisp; -*- ;;; ;;; Copyright (c) 2009 by the authors. ;;; ;;; See LICENCE for details. (in-package :hu.dwim.projectional-editor) ;;;;;; ;;; Projection (def (projection e) document->document () ()) ;;;;;; ;;; Construction (def (function e) make-projection/document->document () (make-projection 'document->document)) ;;;;;; ;;; Construction (def (macro e) document->document () '(make-projection/document->document)) ;;;;;; ;;; Printer (def printer document->document (projection recursion input input-reference output-reference) (declare (ignore projection)) (bind ((typed-input-reference `(the ,(form-type input) ,input-reference)) (typed-output-reference `(the ,(form-type input) ,output-reference)) (input-content (content-of input)) (iomap (recurse-printer recursion input-content `(content-of ,typed-input-reference) `(content-of ,typed-output-reference))) (output-content (output-of iomap)) (input-selection (selection-of input)) (output-selection (when input-selection (block selection (map-forward iomap input-selection (lambda (iomap output-reference) (declare (ignore iomap)) (return-from selection output-reference)))))) (output (make-document output-content :selection output-selection))) (make-iomap/recursive input output (list (make-iomap/object input input-reference output output-reference) iomap)))) ;;;;;; ;;; Reader (def reader document->document (projection recursion input input-reference output-reference) (declare (ignore projection)) (recurse-reader recursion input input-reference output-reference))