mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 13:30:26 +02:00
remove cggl, cg-generic-lambda
* module/ice-9/peg.scm (cg-generic-lambda, cggl): Remove these helpers, they are no longer needed. (cg-generic-ret): Remove optimization for particular cg- routines, as it's no longer needed.
This commit is contained in:
parent
e9722ec0aa
commit
63a1336de7
1 changed files with 4 additions and 23 deletions
|
@ -89,22 +89,6 @@ return EXP."
|
||||||
;; accum: (all name body none)
|
;; accum: (all name body none)
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;; Code we generate will be defined in a function, and always has to test
|
|
||||||
;; whether it's beyond the bounds of the string before it executes.
|
|
||||||
(define (cg-generic-lambda for-syntax str strlen at code)
|
|
||||||
;; all arguments are syntax
|
|
||||||
#`(lambda (#,str #,strlen #,at)
|
|
||||||
(if (>= #,at #,strlen)
|
|
||||||
#f
|
|
||||||
#,code)))
|
|
||||||
|
|
||||||
;; The short name makes the formatting below much easier to read.
|
|
||||||
(define cggl cg-generic-lambda)
|
|
||||||
|
|
||||||
;; Optimizations for CG-GENERIC-RET below...
|
|
||||||
(define *op-known-single-body* '(cg-string cg-peg-any cg-range))
|
|
||||||
;; ...done with optimizations (could use more of these).
|
|
||||||
|
|
||||||
;; Code we generate will have a certain return structure depending on how we're
|
;; Code we generate will have a certain return structure depending on how we're
|
||||||
;; accumulating (the ACCUM variable).
|
;; accumulating (the ACCUM variable).
|
||||||
(define (cg-generic-ret for-syntax accum name body-uneval at)
|
(define (cg-generic-ret for-syntax accum name body-uneval at)
|
||||||
|
@ -121,13 +105,10 @@ return EXP."
|
||||||
((eq? accum 'name)
|
((eq? accum 'name)
|
||||||
#`(list #,at '#,name))
|
#`(list #,at '#,name))
|
||||||
((eq? accum 'body)
|
((eq? accum 'body)
|
||||||
(cond
|
#`(list #,at
|
||||||
((member (syntax->datum name) *op-known-single-body*)
|
(cond
|
||||||
#`(list #,at body))
|
((single? body) (car body))
|
||||||
(else #`(list #,at
|
(else body))))
|
||||||
(cond
|
|
||||||
((single? body) (car body))
|
|
||||||
(else body))))))
|
|
||||||
((eq? accum 'none)
|
((eq? accum 'none)
|
||||||
#`(list #,at '()))
|
#`(list #,at '()))
|
||||||
(else
|
(else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue