New start/stop splitting.
This commit is contained in:
parent
8764877e40
commit
924f5d6675
1 changed files with 12 additions and 5 deletions
|
@ -122,11 +122,15 @@
|
||||||
;; returns a list of the symbol representing the type and start/stop
|
;; returns a list of the symbol representing the type and start/stop
|
||||||
;; symbol. It returns false otherwise.
|
;; symbol. It returns false otherwise.
|
||||||
(define (split-start/stop-symbol s)
|
(define (split-start/stop-symbol s)
|
||||||
(cond ((eq? s 'studentstart) '(student start))
|
(let* ((ss (symbol->string s))
|
||||||
((eq? s 'studentstop) '(student stop))
|
(mstart (irregex-search (string->irregex "(start|stop)") ss)))
|
||||||
((eq? s 'suspendstart) '(suspend start))
|
(if mstart
|
||||||
((eq? s 'suspendstop) '(suspend stop))
|
(let* ((istart (irregex-match-start-index mstart))
|
||||||
(else #f)))
|
(bstring (substring ss 0 istart))
|
||||||
|
(sstring (substring ss istart)))
|
||||||
|
(list (string->symbol bstring)
|
||||||
|
(string->symbol sstring)))
|
||||||
|
#f)))
|
||||||
|
|
||||||
;; Processes member line adding given value v to the dictionary d
|
;; Processes member line adding given value v to the dictionary d
|
||||||
;; under key k. Special handling for start/stop symbols means given
|
;; under key k. Special handling for start/stop symbols means given
|
||||||
|
@ -209,6 +213,9 @@
|
||||||
(test-equal? split-member-line (split-member-line " nick value ") '(nick "value"))
|
(test-equal? split-member-line (split-member-line " nick value ") '(nick "value"))
|
||||||
(test-equal? split-member-line (split-member-line " nick value1 value2 ") '(nick "value1 value2"))
|
(test-equal? split-member-line (split-member-line " nick value1 value2 ") '(nick "value1 value2"))
|
||||||
(test-exn split-member-line (split-member-line "key value"))
|
(test-exn split-member-line (split-member-line "key value"))
|
||||||
|
(test-equal? split-start/stop-symbol (split-start/stop-symbol 'suspendstart) '(suspend start))
|
||||||
|
(test-equal? split-start/stop-symbol (split-start/stop-symbol 'teststop) '(test stop))
|
||||||
|
(test-false split-start/stop-symbol (split-start/stop-symbol 'normalkey))
|
||||||
))
|
))
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue