peg: cg-peg-any does not use cggl
authorAndy Wingo <wingo@pobox.com>
Fri, 18 Feb 2011 09:53:18 +0000 (10:53 +0100)
committerAndy Wingo <wingo@pobox.com>
Wed, 16 Jan 2013 09:11:39 +0000 (10:11 +0100)
* module/ice-9/peg.scm (cg-peg-any): Don't use cggl.

module/ice-9/peg.scm

index 041636d..555ad85 100644 (file)
@@ -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)