mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-18 21:29:18 +02:00
Issue #253 - Cut over to new repl function
This commit is contained in:
parent
cf711ffd0f
commit
e25d534282
2 changed files with 3 additions and 40 deletions
|
@ -8,6 +8,7 @@ Features
|
|||
- Improved hash table lookup performance for symbols.
|
||||
- Increased the max bound of hash tables to `(2 ^ 30) - 1`.
|
||||
- Changed `hash-by-identity` to a high-performance builtin.
|
||||
- Added a `repl` function to `(scheme repl)` to make it easy to use a REPL from your own code.
|
||||
- Added basic support for square and curly brackets in place of parentheses.
|
||||
|
||||
Bug Fixes
|
||||
|
|
42
icyc.scm
42
icyc.scm
|
@ -15,6 +15,7 @@
|
|||
(scheme lazy)
|
||||
(scheme load)
|
||||
(scheme read)
|
||||
(scheme repl)
|
||||
(scheme write)
|
||||
(scheme inexact)
|
||||
(scheme process-context)
|
||||
|
@ -25,45 +26,6 @@
|
|||
;(srfi 133)
|
||||
(srfi 69))
|
||||
|
||||
;(define *icyc-env* (setup-environment))
|
||||
(define (repl:next-line)
|
||||
(call/cc
|
||||
(lambda (k)
|
||||
(with-exception-handler
|
||||
(lambda (obj)
|
||||
(display "Error: ")
|
||||
(cond
|
||||
((pair? obj)
|
||||
(when (string? (car obj))
|
||||
(display (car obj))
|
||||
(if (not (null? (cdr obj)))
|
||||
(display ": "))
|
||||
(set! obj (cdr obj)))
|
||||
(for-each
|
||||
(lambda (o)
|
||||
(write o)
|
||||
(display " "))
|
||||
obj))
|
||||
(else
|
||||
(display obj)))
|
||||
(newline)
|
||||
(k #t))
|
||||
(lambda ()
|
||||
(repl)))))
|
||||
(repl:next-line))
|
||||
|
||||
(define (repl)
|
||||
(display "cyclone> ")
|
||||
(let ((c (eval (read) #;*icyc-env*)))
|
||||
(cond
|
||||
((not (eof-object? c))
|
||||
(write c)
|
||||
(newline)
|
||||
(repl:next-line))
|
||||
(else
|
||||
(display "\n")
|
||||
(exit 0)))))
|
||||
|
||||
;; Collect values for the given command line arguments and option.
|
||||
;; Will return a list of values for the option.
|
||||
;; For example:
|
||||
|
@ -150,5 +112,5 @@ Options:
|
|||
(if (and (>= (length args) 1)
|
||||
(not (member (car (reverse args)) '("-s"))))
|
||||
(load (car (reverse args)) #;*icyc-env*))
|
||||
(repl:next-line))))
|
||||
(repl))))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue