summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2011-02-18 11:33:12 +0100
committerNoah Lavine <nlavine@haverford.edu>2011-09-05 21:51:00 -0400
commit892b2bf33194c65cb0c27f66672d1c6d9fb5daf5 (patch)
tree9e3409429d9aea6793598e3a81e673c7dcad6e79
parentffbb94d8e625b092502206d585bca4a715c605d6 (diff)
downloadguile-892b2bf33194c65cb0c27f66672d1c6d9fb5daf5.tar.gz
peg: cg-string, cg-peg-any, cg-range: remove needless for-syntax arg
* module/ice-9/peg.scm (cg-string, cg-peg-any, cg-range): Remove unnecessary for-syntax arg. (peg-sexp-compile): Adapt.
-rw-r--r--module/ice-9/peg.scm12
1 files changed, 6 insertions, 6 deletions
diff --git a/module/ice-9/peg.scm b/module/ice-9/peg.scm
index 1cc70a2cd..2136ee41d 100644
--- a/module/ice-9/peg.scm
+++ b/module/ice-9/peg.scm
@@ -122,7 +122,7 @@ return EXP."
;; Generates code that matches a particular string.
;; E.g.: (cg-string syntax "abc" 'body)
-(define (cg-string for-syntax pat accum)
+(define (cg-string pat accum)
(let ((plen (string-length pat)))
#`(lambda (str len pos)
(let ((end (+ pos #,plen)))
@@ -137,7 +137,7 @@ return EXP."
;; Generates code for matching any character.
;; E.g.: (cg-peg-any syntax 'body)
-(define (cg-peg-any for-syntax accum)
+(define (cg-peg-any accum)
#`(lambda (str len pos)
(and (< pos len)
#,(case accum
@@ -150,7 +150,7 @@ return EXP."
;; Generates code for matching a range of characters between start and end.
;; E.g.: (cg-range syntax #\a #\z 'body)
-(define (cg-range for-syntax start end accum)
+(define (cg-range start end accum)
#`(lambda (str len pos)
(and (< pos len)
(let ((c (string-ref str pos)))
@@ -185,10 +185,10 @@ return EXP."
;; E.g.: (peg-sexp-compile syntax '(and "abc" (or "-" (range #\a #\z))) 'all)
(define (peg-sexp-compile for-syntax pat accum)
(cond
- ((string? pat) (cg-string for-syntax pat (baf accum)))
+ ((string? pat) (cg-string pat (baf accum)))
((symbol? pat) ;; either peg-any or a nonterminal
(cond
- ((eq? pat 'peg-any) (cg-peg-any for-syntax (baf accum)))
+ ((eq? pat 'peg-any) (cg-peg-any (baf accum)))
;; if pat is any other symbol it's a nonterminal, so just return it
(else (datum->syntax for-syntax pat))))
((or (not (list? pat)) (null? pat))
@@ -196,7 +196,7 @@ return EXP."
(datum->syntax for-syntax
(error-val `(peg-sexp-compile-error-1 ,pat ,accum))))
((eq? (car pat) 'range) ;; range of characters (e.g. [a-z])
- (cg-range for-syntax (cadr pat) (caddr pat) (baf accum)))
+ (cg-range (cadr pat) (caddr pat) (baf accum)))
((eq? (car pat) 'ignore) ;; match but don't parse
(peg-sexp-compile for-syntax (cadr pat) 'none))
((eq? (car pat) 'capture) ;; parse