pattern: Workaround Mes optargs difference.

* gash/pattern.scm (pattern-match?): Remove optional arguments.
This commit is contained in:
Timothy Sample 2022-11-08 09:52:15 -06:00
parent 7fb21c1549
commit 2b44788598
1 changed files with 7 additions and 5 deletions

View File

@ -234,11 +234,14 @@ source string is the only string that will match it."
((string-ends-with-part s part start i) (- i (vector-length part)))
(else (loop (1- i))))))
(define* (pattern-match? pattern str #:optional (start 0)
(end (string-length str))
#:key explicit-initial-period?)
(define* (pattern-match? pattern str #:key explicit-initial-period?)
"Check if @var{str} matches @var{pattern}."
;; XXX: These used to be optional arguments, but Mes handles mixing
;; optional and keyword arguments differently than Guile.
(define start 0)
(define end (string-length str))
(define (parts-match? parts start)
(match parts
(() (= start end))
@ -255,8 +258,7 @@ source string is the only string that will match it."
(char=? (string-ref str start) #\.))
(match parts
((#(#\. _ ...) . _)
(pattern-match? pattern str start end
#:explicit-initial-period? #f))
(pattern-match? pattern str #:explicit-initial-period? #f))
(_ #f))
(match parts
(() (= start end))