summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/language/python/compile.scm4
-rw-r--r--modules/language/python/string.scm19
2 files changed, 13 insertions, 10 deletions
diff --git a/modules/language/python/compile.scm b/modules/language/python/compile.scm
index f364e7a..34cc4df 100644
--- a/modules/language/python/compile.scm
+++ b/modules/language/python/compile.scm
@@ -225,8 +225,8 @@
((rsplit) (S 'py-rsplit ))
((splitlines) (S 'py-splitlines))
((startswith) (S 'py-startswith))
- ((swapcase) (S 'py-swapcas))
- ((translate) (S 'py-translate))
+ ((swapcase) (S 'py-swapcase))
+ ((translate) (S 'py-translate))
((zfill) (S 'py-zfill))))
(define (fastfkn x) (hash-ref fasthash x))
diff --git a/modules/language/python/string.scm b/modules/language/python/string.scm
index d15ca23..15dbe43 100644
--- a/modules/language/python/string.scm
+++ b/modules/language/python/string.scm
@@ -416,18 +416,21 @@
(w (make-string n))
(t (if (eq? table None) #f table))
(d (match l (() #f) ((x) x))))
-
(define (tr ch)
+ (define (e)
+ (if t
+ (let ((i (char->integer ch)))
+ (if (< i (string-length t))
+ (string-ref t i)
+ ch))
+ ch))
+
(if d
(if (string-contains d (list->string (list ch)))
#f
- (if t
- (let ((i (char->integer ch)))
- (if (< i n)
- (string-ref t i)
- ch))
- ch))))
-
+ (e))
+ (e)))
+
(let lp ((i 0) (k 0))
(if (< i n)
(let ((ch (tr (string-ref s i))))