Closed ufo5260987423 closed 1 year ago
I don't know what a ".sps" file is, and Chez Scheme does not care what a file's extension is. I'm guessing maybe you're looking for this bit of magic to set the port position past a shebang line before attempting to read scheme objects from the file?
I don't know what a ".sps" file is, and Chez Scheme does not care what a file's extension is. I'm guessing maybe you're looking for this bit of magic to set the port position past a shebang line before attempting to read scheme objects from the file?
Thank you for your reply, and you truly solved my question!
My question actually is how Chez read this file and process #!/usr/bin/env scheme-script
. These things make get-datum/annotations
can't work as usual. And a .sps file is usually like following:
#!/usr/bin/env scheme-script
;; -*- mode: scheme; coding: utf-8 -*- !#
;; Copyright (c) 2022 WANG Zheng
;; SPDX-License-Identifier: MIT
#!r6rs
;;to read log and reproduce similar action for debug
(import (rnrs (6))
(srfi :64 testing)
(scheme-langserver)
(scheme-langserver util io) )
(test-begin "log-debug")
(let loop ([lines (read-lines "~/ready-for-analyse.log")]
[result '()]
[read? #f])
(if (not (null? lines))
(let ([current-line (car lines)])
(cond
[read? (loop
(cdr lines)
(append result `(,(string-append
"Content-Length: "
(number->string (bytevector-length (string->utf8 current-line)))
"\r\n\r\n" current-line)))
#f)]
[(equal? current-line "read-message") (loop (cdr lines) result #t)]
[else (loop (cdr lines) result #f)]))
(let* ([input-port (open-bytevector-input-port (string->utf8 (apply string-append result)))]
[log-port (open-file-output-port "~/scheme-langserver.log" (file-options replace) 'block (make-transcoder (utf-8-codec)))]
[output-port (open-file-output-port "~/scheme-langserver.out" (file-options replace) 'none)]
[server-instance (init-server input-port output-port log-port #f)])
(test-equal #f (server-shutdown? server-instance)))
))
(test-end)
(exit (if (zero? (test-runner-fail-count (test-runner-get))) 0 1))
I'm programming a language server protocol implementation named scheme-langserver. I'm writing code process .sps files and Chez scheme can run .sps files with
scheme --script ...
command.However, Chez Scheme's built-in procedure
get-datum/annotations
performed differently on .sps from other extensions including .ss, .sls and .sld. I roughly read Chez's code and still don't know how Chez works, that make my scheme-langserver now still can't help .sps programming.Could anyone help me?