Paste: read lsp message from stdin
Author: | itmuckel |
Mode: | factor |
Date: | Sun, 21 Jun 2020 18:26:45 |
Plain Text |
: read-message ( -- message-as-string )
readln
"Content-Length: " "" replace
parse-number
"{" read-until drop
drop
1 -
CHAR: x <string> read-into drop
>string
;
Author: | ^alex |
Mode: | factor |
Date: | Sun, 21 Jun 2020 18:43:12 |
Plain Text |
IN: scratchpad : parse-message ( -- jsons )
readln >lower
"content-length:" ?head
[ "bad content length" throw ] unless
[ blank? ] trim
parse-number
read json> ;
IN: scratchpad parse-message
Content-length: 2
{}
--- Data stack:
H{ }
New Annotation