From 6aa4f1890a4e1327b5eabfb19386c94750223cbe Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 1 Jun 2020 15:28:37 -0700 Subject: Some fixups --- bs/re.scm | 13 +++++++------ bs/string.scm | 8 ++++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/bs/re.scm b/bs/re.scm index e2bc276..2b5752b 100644 --- a/bs/re.scm +++ b/bs/re.scm @@ -16,15 +16,16 @@ ;; TODO: port srfi-115 to guile ;; TODO: make `match` and `search` do different things - (export match group sub search - I IGNORECASE M MULTILINE) + (export match group sub search compile + ;; I IGNORECASE M MULTILINE + ) (import (rnrs base (6)) (ice-9 regex)) - (define I regexp/icase) - (define IGNORECASE regexp/icase) - (define M regexp/newline) - (define MULTILINE regexp/newline) + ;; (define I regexp/icase) + ;; (define IGNORECASE regexp/icase) + ;; (define M regexp/newline) + ;; (define MULTILINE regexp/newline) ;; Compile `pattern` into a regular expression object. (define (compile pattern . flags) diff --git a/bs/string.scm b/bs/string.scm index 6d6e941..963525c 100644 --- a/bs/string.scm +++ b/bs/string.scm @@ -10,8 +10,10 @@ (only (srfi srfi-13) string-trim string-trim-both string-trim-right string-prefix? string-suffix? string-upcase string-concatenate - string-drop string-take string-contains substring/shared string-null? string-fold) - (only (srfi srfi-14) string->char-set) + string-drop string-take string-contains substring/shared string-null? string-fold + string-tokenize) + (only (srfi srfi-14) + string->char-set char-set-complement char-set) (only (srfi srfi-28) format) ;; TODO: remove or port ice-9 dependency (only (ice-9 ports) with-output-to-string)) @@ -26,6 +28,8 @@ ;; Split `s` at `sep` (define (split s sep) + ;; this is still wrong. it splits on any of the "sep" characters + ;; instead of all of them (string-tokenize s (char-set-complement (apply char-set (string->list sep))))) ;; Replace `match` in `s` with `char` -- cgit v1.2.3