mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 04:25:06 +02:00
Added block comment support
This commit is contained in:
parent
22814ffc52
commit
365e26a2a5
2 changed files with 20 additions and 1 deletions
|
@ -4,7 +4,7 @@ This is the status of Scheme programming language features implemented from the
|
||||||
|
|
||||||
Section | Status | Comments
|
Section | Status | Comments
|
||||||
------- | ------ | ---------
|
------- | ------ | ---------
|
||||||
2.2 Whitespace and comments | Partial | No datum or block comments
|
2.2 Whitespace and comments | Partial | No datum comments
|
||||||
2.3 Other notations | Yes |
|
2.3 Other notations | Yes |
|
||||||
2.4 Datum labels | No |
|
2.4 Datum labels | No |
|
||||||
3.1 Variables, syntactic keywords, and regions | Yes |
|
3.1 Variables, syntactic keywords, and regions | Yes |
|
||||||
|
|
|
@ -302,6 +302,10 @@
|
||||||
(in-port:set-cnum! ptbl
|
(in-port:set-cnum! ptbl
|
||||||
(+ 1 (in-port:get-cnum ptbl)))
|
(+ 1 (in-port:get-cnum ptbl)))
|
||||||
(cond
|
(cond
|
||||||
|
;; Block comments
|
||||||
|
((eq? #\| next-c)
|
||||||
|
(read-block-comment fp ptbl)
|
||||||
|
(parse fp '() toks all? #f parens ptbl))
|
||||||
;; Booleans
|
;; Booleans
|
||||||
;; Do not use add-tok below, no need to quote a bool
|
;; Do not use add-tok below, no need to quote a bool
|
||||||
((eq? #\t next-c)
|
((eq? #\t next-c)
|
||||||
|
@ -473,6 +477,21 @@
|
||||||
(in-port:read-buf! ptbl) ;; Already buffered
|
(in-port:read-buf! ptbl) ;; Already buffered
|
||||||
(read-char fp)))
|
(read-char fp)))
|
||||||
|
|
||||||
|
;; Read chars in the middle of a block comment
|
||||||
|
(define (read-block-comment fp ptbl)
|
||||||
|
(let ((c (get-next-char fp ptbl)))
|
||||||
|
(cond
|
||||||
|
((eq? #\| c) (read-block-terminator fp ptbl))
|
||||||
|
(else (read-block-comment fp ptbl)))))
|
||||||
|
|
||||||
|
;; Read (possibly) the end of a block comment
|
||||||
|
(define (read-block-terminator fp ptbl)
|
||||||
|
(let ((c (get-next-char fp ptbl)))
|
||||||
|
(cond
|
||||||
|
((eq? #\# c) #t)
|
||||||
|
((eq? #\| c) (read-block-terminator fp ptbl))
|
||||||
|
(else (read-block-comment fp ptbl)))))
|
||||||
|
|
||||||
(define (parse-number fp toks all? parens ptbl base tok->num)
|
(define (parse-number fp toks all? parens ptbl base tok->num)
|
||||||
; (parse-number-rec base fp '() ptbl))
|
; (parse-number-rec base fp '() ptbl))
|
||||||
(let ((num (parse-number-rec base fp '() ptbl)))
|
(let ((num (parse-number-rec base fp '() ptbl)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue