1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 13:30:26 +02:00

peg: cg-string improvement

* module/ice-9/peg.scm (cg-string): Use the more efficient string= with
  range args, rather than string=? and substring.
This commit is contained in:
Andy Wingo 2011-02-18 10:42:13 +01:00
parent 87c3ef2f95
commit 990b24b254

View file

@ -144,8 +144,7 @@ return EXP."
(define (cg-string for-syntax match accum)
(let ((len (string-length match)))
(cggl for-syntax #'str #'strlen #'at
#`(if (string=? (substring str at (min (+ at #,len) strlen))
#,match)
#`(if (string= str #,match at (min (+ at #,len) strlen))
#,(cggr for-syntax accum 'cg-string match
#`(+ at #,len))
#f))))