Bugfix for backslash-c, use name-char instead of cl-unicode
This commit is contained in:
parent
5a0221366f
commit
581c03d5e9
3 changed files with 8 additions and 9 deletions
|
@ -12,7 +12,7 @@ Right now it doesn't do much, but I'll add new features as I think of them.
|
|||
- `\n`, `\t`, `\r`, `\f`, `\b`, `\a`, and `\e`
|
||||
- `\777`: octal character codes
|
||||
- `\xFF`, `\x{10FFFF}`, `\U+10FFFF`: hex character codes
|
||||
- `\N{Greek:sigma}`: named characters
|
||||
- `\N{greek small letter phi}`: named characters
|
||||
- `\<Newline>` to skip a chunk of whitespace
|
||||
- `\cX` for control codes (e.g. `\cA` = Start of Heading)
|
||||
- `(syrup:if*)` macro for easier-to-read conditional statements
|
||||
|
|
12
strings.lisp
12
strings.lisp
|
@ -41,7 +41,9 @@
|
|||
(not (or (graphic-char-p ch3) (char= ch3 #\Newline))))
|
||||
:do (read-char* stream)))
|
||||
(#\c ;; control code: \cA
|
||||
(vector-push-extend (code-char (logxor #x40 (char-code (char-upcase ch2)))) buf))
|
||||
(vector-push-extend
|
||||
(code-char (logxor #x40 (char-code (char-upcase (read-char* stream)))))
|
||||
buf))
|
||||
((#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7) ;; octal: \033
|
||||
(unread-char ch2 stream)
|
||||
(vector-push-extend (code-char (read-number* stream 8 :max 3)) buf))
|
||||
|
@ -62,20 +64,18 @@
|
|||
(when (char= (peek-char* stream) #\+)
|
||||
(read-char* stream))
|
||||
(vector-push-extend (code-char (read-number* stream 16)) buf))
|
||||
(#\N ;; named char: \N{greek:sigma}
|
||||
(#\N ;; named char: \N{greek small letter phi}
|
||||
(unless (char= (peek-char* stream) #\{)
|
||||
(error 'simple-reader-error
|
||||
:stream stream
|
||||
:format-control "Expected { after \\N"
|
||||
:format-arguments nil))
|
||||
(read-char* stream)
|
||||
(let ((name (make-array 0 :element-type 'character :fill-pointer t :adjustable t))
|
||||
(cl-unicode:*try-abbreviations-p* t)
|
||||
(cl-unicode:*try-hex-notation-p* t))
|
||||
(let ((name (make-array 0 :element-type 'character :fill-pointer t :adjustable t)))
|
||||
(loop :for ch3 := (read-char* stream)
|
||||
:until (char= ch3 #\})
|
||||
:do (vector-push-extend ch3 name))
|
||||
(vector-push-extend (cl-unicode:character-named name) buf)))
|
||||
(vector-push-extend (name-char (substitute #\_ #\Space name)) buf)))
|
||||
(#\~ ;; format interpolation
|
||||
(let ((directive (make-array 0 :element-type 'character :fill-pointer t :adjustable t)))
|
||||
(vector-push-extend #\~ directive)
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
(asdf:defsystem "syrup"
|
||||
:description "Assorted syntactic sugar for Lisp."
|
||||
:version "1.2"
|
||||
:version "1.3"
|
||||
:author "~keith <keith@keithhacks.cyou>"
|
||||
:homepage "https://bytes.keithhacks.cyou/keith/syrup"
|
||||
:license "Public Domain/CC0"
|
||||
:depends-on ("cl-unicode")
|
||||
:components ((:file "syrup")
|
||||
(:file "exports")
|
||||
(:file "control-flow")
|
||||
|
|
Loading…
Reference in a new issue