diff options
| author | Artyom V. Poptsov <poptsov.artyom@gmail.com> | 2015-10-29 21:37:39 +0300 |
|---|---|---|
| committer | Artyom V. Poptsov <poptsov.artyom@gmail.com> | 2015-10-29 21:37:39 +0300 |
| commit | ac6465ba700e55c42fa1499db9aa3f5497c98bbb (patch) | |
| tree | beb11564f41106894a1bcbfd9e7f540732f42c2d /modules/ssh/dist | |
| parent | node.scm (rrepl-get-result): Wrap a long line (diff) | |
| download | guile-ssh-ac6465ba700e55c42fa1499db9aa3f5497c98bbb.tar.gz | |
node.scm (rrepl-get-result): Add a sub-procedure
* modules/ssh/dist/node.scm (rrepl-get-result) <parse-result>: New
sub-procedure.
<read-result>: Use it.
Diffstat (limited to 'modules/ssh/dist')
| -rw-r--r-- | modules/ssh/dist/node.scm | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/modules/ssh/dist/node.scm b/modules/ssh/dist/node.scm index ead5ebf..b579b1c 100644 --- a/modules/ssh/dist/node.scm +++ b/modules/ssh/dist/node.scm @@ -188,17 +188,18 @@ name. Throw 'node-repl-error' on an error." (loop (read-line repl-channel) (string-append result "\n" line))))) + (define (parse-result 1st-match) + (let loop ((line (read-line repl-channel)) + (matches (list 1st-match))) + (if (or (eof-or-null? line) + (regexp-exec %repl-undefined-result-regexp line)) + (reverse matches) + (loop (read-line repl-channel) + (cons (regexp-exec %repl-result-2-regexp line) matches))))) + (define (read-result match) - (let* ((matches - (let loop ((line (read-line repl-channel)) - (matches (list match))) - (if (or (eof-or-null? line) - (regexp-exec %repl-undefined-result-regexp line)) - (reverse matches) - (loop (read-line repl-channel) - (cons (regexp-exec %repl-result-2-regexp line) - matches))))) - (len (length matches))) + (let* ((matches (parse-result match)) + (len (length matches))) (if (= len 1) (let ((m (car matches))) (values (read-string (match:substring m 4)) |
