mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-08 05:27:33 +02:00
WIP
This commit is contained in:
parent
2d7839c264
commit
6c3adfa6b8
2 changed files with 10 additions and 13 deletions
6
read.scm
6
read.scm
|
@ -693,7 +693,11 @@
|
|||
; (repl))
|
||||
;(repl)
|
||||
|
||||
(write 'TODO)
|
||||
(define-c read-token
|
||||
"(void *data, int argc, closure _, object k, object port)"
|
||||
" Cyc_io_read_token(data, k, port);")
|
||||
|
||||
(read-token (open-input-file "generate-c.scm"))
|
||||
|
||||
;; Notes on writing a fast parser:
|
||||
; - Interface to the user is (read). This needs to be fast
|
||||
|
|
17
runtime.c
17
runtime.c
|
@ -5708,20 +5708,13 @@ void _read_whitespace(port_type *p) {}
|
|||
|
||||
void _read_error(void *data, port_type *p, const char *msg)
|
||||
{
|
||||
/* TODO: need equivalent of this:
|
||||
(define (parse-error msg lnum cnum)
|
||||
(error
|
||||
(string-append
|
||||
"Error (line "
|
||||
(number->string lnum)
|
||||
", char "
|
||||
(number->string cnum)
|
||||
"): "
|
||||
msg)))
|
||||
*/
|
||||
char buf[1024];
|
||||
snprintf(buf, 1023, "Error (line %d, column %d): %s",
|
||||
p->line_num, p->col_num, msg);
|
||||
Cyc_rt_raise_msg(data, buf);
|
||||
}
|
||||
|
||||
void Cyc_read_token(void *data, object cont, object port)
|
||||
void Cyc_io_read_token(void *data, object cont, object port)
|
||||
{
|
||||
Cyc_check_port(data, port);
|
||||
port_type *p = (port_type *)port;
|
||||
|
|
Loading…
Add table
Reference in a new issue