The cl-interpol Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-interpol Reference Manual

This is the cl-interpol Reference Manual, version 0.2.7, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Sep 15 03:51:59 2022 GMT+0.

Table of Contents


1 Introduction


CL-INTERPOL - String interpolation for Common Lisp

CL-INTERPOL is a library for Common Lisp which modifies the reader so that you can have interpolation within strings similar to Perl or Unix Shell scripts. It also provides various ways to insert arbitrary characters into literal strings even if your editor/IDE doesn't support them. Here's an example:

(named-readtables:in-readtable :interpol-syntax)


(let ((a 42))
    #?"foo: \xC4\N{Latin capital letter U with diaeresis}\nbar: ${a}")
"foo: ÄÜ
bar: 42"

CL-INTERPOL comes with a BSD-style license so you can basically do with it whatever you want.

Complete documentation for CL-INTERPOL can be found in the docs directory or at the project documentation site


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-interpol

License

BSD-2-Clause

Version

0.2.7

Dependencies
  • cl-unicode (system).
  • named-readtables (system).
Source

cl-interpol.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 cl-interpol/cl-interpol.asd

Source

cl-interpol.asd.

Parent Component

cl-interpol (system).

ASDF Systems

cl-interpol.

Packages

cl-interpol-asd.


3.1.2 cl-interpol/packages.lisp

Source

cl-interpol.asd.

Parent Component

cl-interpol (system).

Packages

cl-interpol.


3.1.3 cl-interpol/specials.lisp

Dependency

packages.lisp (file).

Source

cl-interpol.asd.

Parent Component

cl-interpol (system).

Public Interface
Internals

3.1.4 cl-interpol/util.lisp

Dependency

specials.lisp (file).

Source

cl-interpol.asd.

Parent Component

cl-interpol (system).

Internals

3.1.5 cl-interpol/alias.lisp

Dependency

util.lisp (file).

Source

cl-interpol.asd.

Parent Component

cl-interpol (system).


Previous: , Up: Lisp   [Contents][Index]

3.1.6 cl-interpol/read.lisp

Dependency

alias.lisp (file).

Source

cl-interpol.asd.

Parent Component

cl-interpol (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

4.1 cl-interpol-asd

Source

cl-interpol.asd.

Use List
  • asdf/interface.
  • common-lisp.

Previous: , Up: Packages   [Contents][Index]

4.2 cl-interpol

Source

packages.lisp.

Nickname

interpol

Use List
  • cl-ppcre.
  • cl-unicode.
  • common-lisp.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


Next: , Previous: , Up: Public Interface   [Contents][Index]

5.1.1 Special variables

Special Variable: *inner-delimiters*

Legal delimiters for interpolation with #$ and #@.

Package

cl-interpol.

Source

specials.lisp.

Special Variable: *interpolate-format-directives*

Whether to allow ~X(...) as format control directives in interpolated strings.

Package

cl-interpol.

Source

specials.lisp.

Special Variable: *list-delimiter*

What is inserted between the elements of a list which is interpolated by #@.

Package

cl-interpol.

Source

specials.lisp.

Special Variable: *optional-delimiters-p*

Whether text following $ or @ should interpolate even without a following delimiter. Lexical variables are handled correctly, but the rules are somewhat complex – see the docs for details.

Package

cl-interpol.

Source

specials.lisp.

Special Variable: *outer-delimiters*

Legal outer delimiters for CL-INTERPOL strings.

Package

cl-interpol.

Source

specials.lisp.


5.1.2 Macros

Macro: disable-interpol-syntax ()

Restore readtable which was active before last call to ENABLE-INTERPOL-SYNTAX. If there was no such call, the standard readtable is used.

Package

cl-interpol.

Source

read.lisp.

Macro: enable-interpol-syntax (&rest %enable-interpol-syntax-args)

Enable CL-INTERPOL reader syntax.

Package

cl-interpol.

Source

read.lisp.


Previous: , Up: Public Interface   [Contents][Index]

5.1.3 Ordinary functions

Function: interpol-reader (*stream* char arg &key recursive-p)

The actual reader function for the ’sub-character’ #?.

This function can be used directly outside of a read table by passing ‘recursive-p‘ as NIL.

Package

cl-interpol.

Source

read.lisp.


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Special variables

Special Variable: *hyperdoc-base-uri*
Package

cl-interpol.

Source

specials.lisp.

Special Variable: *pair-level*
Package

cl-interpol.

Source

specials.lisp.

Special Variable: *previous-readtables*

A stack which holds the previous readtables that have been pushed here by ENABLE-INTERPOL-SYNTAX.

Package

cl-interpol.

Source

specials.lisp.

Special Variable: *readtable-copy*

Bound to the current readtable if it has to be temporarily modified.

Package

cl-interpol.

Source

specials.lisp.

Special Variable: *regex-delimiters*

Outer delimiters which automatically enable regex mode.

Package

cl-interpol.

Source

specials.lisp.

Special Variable: *saw-backslash*

Whether we have to re-process an L or U because it closes several scopes.

Package

cl-interpol.

Source

specials.lisp.

Special Variable: *start-char*

Bound to the opening outer delimiter while parsing a string.

Package

cl-interpol.

Source

specials.lisp.

Special Variable: *stream*

Bound to the stream which is read from while parsing a string.

Package

cl-interpol.

Source

specials.lisp.

Special Variable: *term-char*

Bound to the closing outer delimiter while parsing a string.

Package

cl-interpol.

Source

specials.lisp.

Special Variable: *unicode-aliases*

A hash table which maps Unicode aliases to their real names.

Package

cl-interpol.

Source

specials.lisp.

Special Variable: quell-warnings-form

A declaration form to quiet warnings about unbound variables within a lexical environment.

Package

cl-interpol.

Source

read.lisp.


5.2.2 Macros

Macro: defvar-unbound (variable-name documentation)

Like DEFVAR, but the variable will be unbound rather than getting an initial value. This is useful for variables which should have no global value but might have a dynamically bound value.

Package

cl-interpol.

Source

specials.lisp.

Macro: peek-char* ()

Convenience macro because we always peek at the same string with the same arguments.

Package

cl-interpol.

Source

util.lisp.

Macro: read-char* ()

Convenience macro because we always read from the same string with the same arguments.

Package

cl-interpol.

Source

util.lisp.

Macro: signal-reader-error (format-control &rest format-arguments)

Like ERROR but signals a SIMPLE-READER-ERROR for the stream *STREAM*.

Package

cl-interpol.

Source

util.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.3 Ordinary functions

Function: %disable-interpol-syntax ()

Internal function used to restore previous readtable.

Package

cl-interpol.

Source

read.lisp.

Function: %enable-interpol-syntax (&key modify-*readtable*)

Internal function used to enable reader syntax and store current readtable on stack.

Package

cl-interpol.

Source

read.lisp.

Function: copy-readtable* ()

Returns a copy of the readtable which was current when INTERPOL-READER was invoked. Memoizes its result.

Package

cl-interpol.

Source

util.lisp.

Function: get-char-from-unicode-name ()

Parses and returns a named character after "\N" has already been read. This function reads from *STREAM*.

Package

cl-interpol.

Source

read.lisp.

Function: get-end-delimiter (start-delimiter delimiters &key errorp)

Find the closing delimiter corresponding to the opening delimiter START-DELIMITER in a list DELIMITERS which is formatted like *OUTER-DELIMITERS*. If ERRORP is true, signal an error if none was found, otherwise return NIL.

Package

cl-interpol.

Source

util.lisp.

Function: get-number (&key radix max)

Reads and consumes the number *STREAM* is currently looking at and returns it. Returns NIL if no number could be identified. RADIX is used as in PARSE-INTEGER. If MAX is not NIL we’ll read at most the next MAX characters.

Package

cl-interpol.

Source

read.lisp.

Function: hyperdoc-lookup (symbol type)
Package

cl-interpol.

Source

specials.lisp.

Function: inner-reader (regex-mode extended-mode quote-mode case-mode &key recursive-p)

Helper function for INTERPOL-READER which does all the work. May call itself recursively.

Package

cl-interpol.

Source

read.lisp.

Function: lower-case-p* (char)

Whether CHAR is a character which has case and is lowercase.

Package

cl-interpol.

Source

util.lisp.

Function: make-char-from-code (number)

Create character from char-code NUMBER. NUMBER can be NIL which is interpreted as 0.

Package

cl-interpol.

Source

util.lisp.

Function: make-collector ()

Create an empty string which can be extended by VECTOR-PUSH-EXTEND.

Package

cl-interpol.

Source

util.lisp.

Function: never-name-char-p (c)
Package

cl-interpol.

Source

read.lisp.

Function: normal-name-char-p (c)
Package

cl-interpol.

Source

read.lisp.

Function: nsubvec (sequence start &optional end)

Return a subvector by pointing to location in original vector.

Package

cl-interpol.

Source

util.lisp.

Function: read-form (&key recursive-p)

Reads and returns one or more Lisp forms from *STREAM* if the character we’re looking at is a valid inner delimiter. Otherwise returns NIL.

Package

cl-interpol.

Source

read.lisp.

Function: read-format-directive ()

Reads and returns a format directive (as a string) along with one or more lisp forms (as per read-form).

Package

cl-interpol.

Source

read.lisp.

Function: read-longest-name ()
Package

cl-interpol.

Source

read.lisp.

Function: read-optional-delimited ()

Read the stuff following an optional delimiter, returning a form that tries to deal correctly with lexical variables.

Package

cl-interpol.

Source

read.lisp.

Function: read-while (predicate &key max)

Reads characters from *STREAM* while PREDICATE returns a true value for each character. Returns at most MAX characters if MAX is true.

Package

cl-interpol.

Source

read.lisp.

Function: resolve-unicode-name (name)

Tries to return a character which was encoded as \N<NAME>.

Package

cl-interpol.

Source

read.lisp.

Function: string-list-to-string (string-list)

Concatenates a list of strings to one string.

Package

cl-interpol.

Source

util.lisp.

Function: unescape-char (regex-mode)

Convert the characters(s) on *STREAM* following a backslash into a character which is returned. This function is to be called when the backslash has already been consumed.

Package

cl-interpol.

Source

read.lisp.


5.2.4 Conditions

Condition: simple-reader-error

A reader error which can be signalled by ERROR.

Package

cl-interpol.

Source

util.lisp.

Direct superclasses
  • reader-error.
  • simple-condition.

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   %  
C   D   E   F   G   H   I   L   M   N   P   R   S   U  
Index Entry  Section

%
%disable-interpol-syntax: Private ordinary functions
%enable-interpol-syntax: Private ordinary functions

C
copy-readtable*: Private ordinary functions

D
defvar-unbound: Private macros
disable-interpol-syntax: Public macros

E
enable-interpol-syntax: Public macros

F
Function, %disable-interpol-syntax: Private ordinary functions
Function, %enable-interpol-syntax: Private ordinary functions
Function, copy-readtable*: Private ordinary functions
Function, get-char-from-unicode-name: Private ordinary functions
Function, get-end-delimiter: Private ordinary functions
Function, get-number: Private ordinary functions
Function, hyperdoc-lookup: Private ordinary functions
Function, inner-reader: Private ordinary functions
Function, interpol-reader: Public ordinary functions
Function, lower-case-p*: Private ordinary functions
Function, make-char-from-code: Private ordinary functions
Function, make-collector: Private ordinary functions
Function, never-name-char-p: Private ordinary functions
Function, normal-name-char-p: Private ordinary functions
Function, nsubvec: Private ordinary functions
Function, read-form: Private ordinary functions
Function, read-format-directive: Private ordinary functions
Function, read-longest-name: Private ordinary functions
Function, read-optional-delimited: Private ordinary functions
Function, read-while: Private ordinary functions
Function, resolve-unicode-name: Private ordinary functions
Function, string-list-to-string: Private ordinary functions
Function, unescape-char: Private ordinary functions

G
get-char-from-unicode-name: Private ordinary functions
get-end-delimiter: Private ordinary functions
get-number: Private ordinary functions

H
hyperdoc-lookup: Private ordinary functions

I
inner-reader: Private ordinary functions
interpol-reader: Public ordinary functions

L
lower-case-p*: Private ordinary functions

M
Macro, defvar-unbound: Private macros
Macro, disable-interpol-syntax: Public macros
Macro, enable-interpol-syntax: Public macros
Macro, peek-char*: Private macros
Macro, read-char*: Private macros
Macro, signal-reader-error: Private macros
make-char-from-code: Private ordinary functions
make-collector: Private ordinary functions

N
never-name-char-p: Private ordinary functions
normal-name-char-p: Private ordinary functions
nsubvec: Private ordinary functions

P
peek-char*: Private macros

R
read-char*: Private macros
read-form: Private ordinary functions
read-format-directive: Private ordinary functions
read-longest-name: Private ordinary functions
read-optional-delimited: Private ordinary functions
read-while: Private ordinary functions
resolve-unicode-name: Private ordinary functions

S
signal-reader-error: Private macros
string-list-to-string: Private ordinary functions

U
unescape-char: Private ordinary functions

Jump to:   %  
C   D   E   F   G   H   I   L   M   N   P   R   S   U  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
Q   S  
Index Entry  Section

*
*hyperdoc-base-uri*: Private special variables
*inner-delimiters*: Public special variables
*interpolate-format-directives*: Public special variables
*list-delimiter*: Public special variables
*optional-delimiters-p*: Public special variables
*outer-delimiters*: Public special variables
*pair-level*: Private special variables
*previous-readtables*: Private special variables
*readtable-copy*: Private special variables
*regex-delimiters*: Private special variables
*saw-backslash*: Private special variables
*start-char*: Private special variables
*stream*: Private special variables
*term-char*: Private special variables
*unicode-aliases*: Private special variables

Q
quell-warnings-form: Private special variables

S
Special Variable, *hyperdoc-base-uri*: Private special variables
Special Variable, *inner-delimiters*: Public special variables
Special Variable, *interpolate-format-directives*: Public special variables
Special Variable, *list-delimiter*: Public special variables
Special Variable, *optional-delimiters-p*: Public special variables
Special Variable, *outer-delimiters*: Public special variables
Special Variable, *pair-level*: Private special variables
Special Variable, *previous-readtables*: Private special variables
Special Variable, *readtable-copy*: Private special variables
Special Variable, *regex-delimiters*: Private special variables
Special Variable, *saw-backslash*: Private special variables
Special Variable, *start-char*: Private special variables
Special Variable, *stream*: Private special variables
Special Variable, *term-char*: Private special variables
Special Variable, *unicode-aliases*: Private special variables
Special Variable, quell-warnings-form: Private special variables

Jump to:   *  
Q   S