pattern: Adjust for Mes.

* gash/pattern.scm (substring->list): New procedure.
(character-range): Use it.
This commit is contained in:
Timothy Sample 2022-12-22 09:32:30 -06:00
parent b973b21cc7
commit c6d39caecc
1 changed files with 12 additions and 1 deletions

View File

@ -21,6 +21,7 @@
#:use-module (ice-9 receive)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9 gnu)
#:use-module (srfi srfi-14)
#:use-module (srfi srfi-26)
#:use-module (gash compat srfi-43)
#:export (parse-pattern
@ -31,6 +32,16 @@
pattern-drop
pattern-drop-right))
(cond-expand
(mes
;; Mes does not allow a range for 'string->list'. We use this so
;; infrequently, that we just define a new procedure for when we
;; need it.
(define (substring->list string start end)
(string->list (substring string start end))))
(else
(define substring->list string->list)))
(define-immutable-record-type <pattern>
(make-pattern parts)
pattern?
@ -77,7 +88,7 @@
(match (string-index str end)
(#f (loop tail))
(eindex (if (<= sindex eindex)
(string->list str sindex (1+ eindex))
(substring->list str sindex (1+ eindex))
(loop tail))))))))))))
(define* (parse-matching-bracket-expression s #:optional (start 0)