The trivial-escapes Reference Manual

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

The trivial-escapes Reference Manual

This is the trivial-escapes Reference Manual, version 1.2.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 06:03:02 2022 GMT+0.

Table of Contents


1 Introduction

TRIVIAL-ESCAPES Quicklisp License Build Status Coverage Status

Copyright (c) 2017 William Yao

Description and usage

Ever been annoyed by the fact that Common Lisp doesn't interpret escape characters the same way that literally every other programming language does? Hey, me too!

So I wrote this library.

It provides a readtable (four, actually) that lets you write strings like this:

CL-USER> #"This string has\na newline in it!"
"This string has
a newline in it!"

CL-USER> #"\x4E00\x751F\x61F8\x547D"
"一生懸命"

Fun! To use it, use one of the exported readtables. In most cases, TRIVIAL-ESCAPES:READTABLE is probably the one you want, containing the standard readtable, with a dispatch function for #\# #\" added in.

(named-readtables:in-readtable trivesc:readtable)

However, if you need them, there are three other provided readtables as well. TRIVIAL-ESCAPES:READTABLE-MIXIN contains just the dispatch function for #\# #\" (this means that it doesn't contain any other reader macros! as in, #\( will no longer start s-expressions, for example.), and similarly, TRIVIAL-ESCAPES:DQ-READTABLE-MIXIN contains just a reader macro for #\", replacing the normal string reading.

TRIVIAL-ESCAPES:READTABLE and TRIVIAL-ESCAPES:DQ-READTABLE simple fuse the standard readtable with their respective mixins, creating actually usable readtables. In most cases, one of these two is what you want.

TRIVIAL-ESCAPES contains all the standard C escapes sequences, shown here.

Note that as a technicality, the characters you end up with will depend upon whatever character encoding your Lisp environment uses. But since everyone seems to be standardizing on Unicode, this probably won't be a p


2 Systems

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


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

2.1 trivial-escapes

C-style escape directives for Common Lisp.

Maintainer

William Yao <williamyaoh@gmail.com>

Author

William Yao <williamyaoh@gmail.com>

License

Public Domain

Version

1.2.0

Dependency

named-readtables (system).

Source

trivial-escapes.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 trivial-escapes/trivial-escapes.asd

Source

trivial-escapes.asd.

Parent Component

trivial-escapes (system).

ASDF Systems

trivial-escapes.


3.1.2 trivial-escapes/packages.lisp

Source

trivial-escapes.asd.

Parent Component

trivial-escapes (system).

Packages

trivial-escapes.


3.1.3 trivial-escapes/to-char.lisp

Dependency

packages.lisp (file).

Source

trivial-escapes.asd.

Parent Component

trivial-escapes (system).

Public Interface

3.1.4 trivial-escapes/escaping-pains.lisp

Dependency

to-char.lisp (file).

Source

trivial-escapes.asd.

Parent Component

trivial-escapes (system).

Internals

3.1.5 trivial-escapes/readtable.lisp

Dependency

escaping-pains.lisp (file).

Source

trivial-escapes.asd.

Parent Component

trivial-escapes (system).


4 Packages

Packages are listed by definition order.


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

4.1 trivial-escapes

Source

packages.lisp.

Nickname

trivesc

Use List

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


5.1.1 Ordinary functions

Function: to-char (code)

CODE-CHAR, except more portable across implementations.
Signals a correctable error of type NO-SUCH-CHAR-ERROR if CODE does
not correspond to a valid character under the implementation’s character encoding.

Provides a USE-VALUE restart for the user to provide a different character.

Package

trivial-escapes.

Source

to-char.lisp.


5.1.2 Generic functions

Generic Reader: code (condition)
Generic Writer: (setf code) (condition)
Package

trivial-escapes.

Methods
Reader Method: code ((condition no-such-char-error))
Writer Method: (setf code) ((condition no-such-char-error))
Source

to-char.lisp.

Target Slot

code.


5.1.3 Standalone methods

Method: print-object ((obj no-such-char-error) stream)
Source

to-char.lisp.


5.1.4 Conditions

Condition: no-such-char-error
Package

trivial-escapes.

Source

to-char.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: code
Initargs

:code

Readers

code.

Writers

(setf code).


5.2 Internals


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

5.2.1 Special variables

Special Variable: *escape-functions*
Package

trivial-escapes.

Source

escaping-pains.lisp.

Special Variable: *octal-escapes*
Package

trivial-escapes.

Source

escaping-pains.lisp.

Special Variable: *simple-escapes*
Package

trivial-escapes.

Source

escaping-pains.lisp.


5.2.2 Macros

Macro: admit (condition form else)
Package

trivial-escapes.

Source

escaping-pains.lisp.


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

5.2.3 Ordinary functions

Function: hex-digit-char-p (char)
Package

trivial-escapes.

Source

escaping-pains.lisp.

Function: hex-read (stream)
Package

trivial-escapes.

Source

escaping-pains.lisp.

Function: octal-digit-char-p (char)
Package

trivial-escapes.

Source

escaping-pains.lisp.

Function: octal-reader (char)
Package

trivial-escapes.

Source

escaping-pains.lisp.

Function: read-string-escaping (stream char &optional numarg)
Package

trivial-escapes.

Source

escaping-pains.lisp.

Function: simple-escape (char)

Used for implementing easy escape sequences, like backslash-n.

Package

trivial-escapes.

Source

escaping-pains.lisp.


Appendix A Indexes


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

A.1 Concepts