From eca3895a00d45d94e8054519a9f1ea6860c760e8 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sun, 20 Oct 2013 17:28:39 +0900 Subject: [PATCH] Adding missing string-cursor utilities for non-Chibi implementations. --- lib/chibi/regexp.sld | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/chibi/regexp.sld b/lib/chibi/regexp.sld index f3144f4f..eec956de 100644 --- a/lib/chibi/regexp.sld +++ b/lib/chibi/regexp.sld @@ -28,7 +28,7 @@ (else (begin (define (string-start-arg s o) - (if (pair? o) (string-index->offset (car o)) 0)) + (if (pair? o) (string-index->offset s (car o)) 0)) (define (string-end-arg s o) (if (pair? o) (string-index->offset (car o)) (string-length s))) (define string-cursor=? =) @@ -37,8 +37,11 @@ (define string-cursor>? >) (define string-cursor>=? >=) (define string-cursor-ref string-ref) + (define (string-cursor-next s i) (+ i 1)) + (define (string-cursor-prev s i) (- i 1)) (define substring-cursor substring) (define (string-offset->index str off) off) + (define (string-index->offset str i) i) (define (string-concatenate-reverse ls) (apply string-append (reverse ls)))))) (include "regexp.scm"))