diff options
author | Ben Sima <ben@bsima.me> | 2020-06-01 15:28:37 -0700 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-06-01 15:28:37 -0700 |
commit | 6aa4f1890a4e1327b5eabfb19386c94750223cbe (patch) | |
tree | 22e247aa1a74190288900c24fa35b7b5d0431e6b /bs | |
parent | 96245a828aa9c717b847812812546667e090ee3f (diff) |
Some fixups
Diffstat (limited to 'bs')
-rw-r--r-- | bs/re.scm | 13 | ||||
-rw-r--r-- | bs/string.scm | 8 |
2 files changed, 13 insertions, 8 deletions
@@ -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` |