|
|
@ -652,6 +652,8 @@
|
|
|
|
pats (caddr old-list))))
|
|
|
|
pats (caddr old-list))))
|
|
|
|
nt-ids patss)
|
|
|
|
nt-ids patss)
|
|
|
|
;; Build a definition for each non-term:
|
|
|
|
;; Build a definition for each non-term:
|
|
|
|
|
|
|
|
(let ([start-id-temp (gensym)]
|
|
|
|
|
|
|
|
[atok-id-temp (gensym)])
|
|
|
|
(loop (cdr clauses)
|
|
|
|
(loop (cdr clauses)
|
|
|
|
cfg-start
|
|
|
|
cfg-start
|
|
|
|
(map (lambda (nt pats handles $ctxs)
|
|
|
|
(map (lambda (nt pats handles $ctxs)
|
|
|
@ -704,15 +706,18 @@
|
|
|
|
[(pos ...)
|
|
|
|
[(pos ...)
|
|
|
|
(if src-pos?
|
|
|
|
(if src-pos?
|
|
|
|
#'($1-start-pos $1-end-pos)
|
|
|
|
#'($1-start-pos $1-end-pos)
|
|
|
|
#'(#f #f))])
|
|
|
|
#'(#f #f))]
|
|
|
|
;; rename `start` and `atok` to `%start` and `%atok`
|
|
|
|
;; rename `start` and `atok` to temp ids
|
|
|
|
;; so that "start" and "atok" can be used as literal string tokens in a grammar.
|
|
|
|
;; so that "start" and "atok" can be used as literal string tokens in a grammar.
|
|
|
|
;; not sure why this works, but it passes all tests.
|
|
|
|
;; not sure why this works, but it passes all tests.
|
|
|
|
|
|
|
|
[%start start-id-temp]
|
|
|
|
|
|
|
|
[%atok atok-id-temp])
|
|
|
|
#`(grammar (%start [() null]
|
|
|
|
#`(grammar (%start [() null]
|
|
|
|
[(%atok %start) (cons $1 $2)])
|
|
|
|
[(%atok %start) (cons $1 $2)])
|
|
|
|
(%atok [(tok) (make-tok 'tok-id 'tok $e pos ...)] ...)))
|
|
|
|
(%atok [(tok) (make-tok 'tok-id 'tok $e pos ...)] ...)))
|
|
|
|
#`(start %start)
|
|
|
|
(with-syntax ([%start start-id-temp])
|
|
|
|
parser-clauses)))]
|
|
|
|
#`(start %start))
|
|
|
|
|
|
|
|
parser-clauses))))]
|
|
|
|
[(grammar . _)
|
|
|
|
[(grammar . _)
|
|
|
|
(raise-syntax-error
|
|
|
|
(raise-syntax-error
|
|
|
|
#f
|
|
|
|
#f
|
|
|
|