summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2011-02-18 10:53:18 +0100
committerAndy Wingo <wingo@pobox.com>2011-03-24 21:10:04 +0100
commitfbceaca0ab9888c44b2d1b6835a94401df3abc50 (patch)
treec3d8806bf5ae8194225a1d2f088ccf13a27813e6
parent7a5635cf152bbb9518bce4ddc1cdffefa3a125ea (diff)
downloadguile-fbceaca0ab9888c44b2d1b6835a94401df3abc50.tar.gz
peg: cg-peg-any does not use cggl
* module/ice-9/peg.scm (cg-peg-any): Don't use cggl.
-rw-r--r--module/ice-9/peg.scm9
1 files changed, 5 insertions, 4 deletions
diff --git a/module/ice-9/peg.scm b/module/ice-9/peg.scm
index 041636d0c..555ad854f 100644
--- a/module/ice-9/peg.scm
+++ b/module/ice-9/peg.scm
@@ -152,10 +152,11 @@ return EXP."
;; Generates code for matching any character.
;; E.g.: (cg-peg-any syntax 'body)
(define (cg-peg-any for-syntax accum)
- (cggl for-syntax #'str #'strlen #'at
- (cggr for-syntax accum
- 'cg-peg-any #`(substring str at (+ at 1))
- #`(+ at 1))))
+ #`(lambda (str len pos)
+ (and (< pos len)
+ #,(cggr for-syntax accum
+ 'cg-peg-any #`(substring str pos (+ pos 1))
+ #`(+ pos 1)))))
;; Generates code for matching a range of characters between start and end.
;; E.g.: (cg-range syntax #\a #\z 'body)