Skip to content

Commit

Permalink
issue #4 -- recognize the mixed case
Browse files Browse the repository at this point in the history
  • Loading branch information
guicho271828 committed Sep 25, 2018
1 parent 6578f3e commit d28088c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/printers.lisp
Expand Up @@ -45,13 +45,17 @@
((symbol name)
(write-char #\' stream)
;; escape a backslash
(loop
for c across name
do
(if (char= #\\ c)
(progn (write-char #\\ stream)
(write-char #\\ stream))
(write-char (char-downcase c) stream)))
(let ((mixed-case-p
(not (every (disjoin #'upper-case-p
(complement #'both-case-p))
name))))
(loop
for c across name
do
(if (char= #\\ c)
(progn (write-char #\\ stream)
(write-char #\\ stream))
(write-char (if mixed-case-p c (char-downcase c)) stream))))
(write-char #\' stream))
((string*)
(format stream "'~a'" term))
Expand Down
8 changes: 8 additions & 0 deletions t/package.lisp
Expand Up @@ -80,6 +80,14 @@
halt)
(:- (initialization main)))
*interpreter-class* :debug *debug*)))
(is (equal "Anakin-Skywalker"
(run-prolog `((parent-of luke-skywalker |Anakin-Skywalker|)
(:- main
(parent-of luke-skywalker ?who-is-it)
(write ?who-is-it)
halt)
(:- (initialization main)))
*interpreter-class* :debug *debug*)))
(is (equal "\\=" ; string for \=
(run-prolog `((parent-of luke-skywalker \\=) ; lisp symbol \= ; quoted prolog '\\=' ; prolog \=
(:- main
Expand Down

0 comments on commit d28088c

Please sign in to comment.