| 1 |
cl-heredoc - Common Lisp reader heredoc dispatcher |
| 2 |
================================================== |
| 3 |
cl-heredoc is an implementation of "here documents" [1] that allow the user to |
| 4 |
embed literal strings into code or data without any need for quoting, something |
| 5 |
that is missing in both ANSI CL and popular implementations. |
| 6 |
|
| 7 |
cl-heredoc is completely written in Common Lisp and licensed under the |
| 8 |
GPLv3+[2]. Please see the file COPYING in the top-level directory of the |
| 9 |
distribution tarball or see the link at [2] if you didn't receive a copy along |
| 10 |
with this file. |
| 11 |
|
| 12 |
|
| 13 |
Usage |
| 14 |
===== |
| 15 |
cl-heredoc primarily exports a single function, READ-HEREDOC, that is meant to |
| 16 |
be used with the CL reader by attaching it to a dispatch character, e.g. |
| 17 |
|
| 18 |
CL-USER> (set-dispatch-macro-character #\# #\> #'cl-heredoc:read-heredoc) |
| 19 |
CL-USER> #>eof>Write whatever (you) "want", |
| 20 |
no matter how many lines or what characters until |
| 21 |
the magic end sequence has been reached!eof |
| 22 |
|
| 23 |
Will read everything starting after "#>eof>" until the given sequence, here |
| 24 |
"eof", is found and return the result as a string. The enclosed text is not |
| 25 |
subject to any kind of evaluation and needs no quoting. |
| 26 |
If used in a non-interactive fashion, i.e. outside the REPL, an error will be |
| 27 |
signaled if EOF is reached. |
| 28 |
|
| 29 |
The underlying function READ-UNTIL-MATCH may also be used directly: It takes two |
| 30 |
arguments, a stream and a termination string and will read from the stream until |
| 31 |
the terminating sequence is found. Everything read so far excluding the |
| 32 |
terminator is returned as a string. |
| 33 |
|
| 34 |
|
| 35 |
Links and References |
| 36 |
==================== |
| 37 |
Homepage: http://www.cliki.net/cl-heredoc |
| 38 |
Hacking: http://github.com/e-user/cl-heredoc |
| 39 |
|
| 40 |
[1] http://en.wikipedia.org/wiki/Here_document |
| 41 |
[2] http://www.gnu.org/licenses/gpl-3.0-standalone.html |
| 42 |
|
| 43 |
|
| 44 |
-------------------------------------------------------------------------------- |
| 45 |
Copyright (C) 2009, 2010 Alexander Kahl <[email protected]> |
| 46 |
This file is part of cl-heredoc. |
| 47 |
cl-heredoc is free software; you can redistribute it and/or modify |
| 48 |
it under the terms of the GNU General Public License as published by |
| 49 |
the Free Software Foundation; either version 3 of the License, or |
| 50 |
(at your option) any later version. |
| 51 |
|
| 52 |
cl-heredoc is distributed in the hope that it will be useful, |
| 53 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 54 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 55 |
GNU General Public License for more details. |
| 56 |
|
| 57 |
You should have received a copy of the GNU General Public License |
| 58 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |