obscurity

pull/6/head
Matthew Butterick 6 years ago
parent 93fcabcc51
commit 79cddb19f2

@ -489,6 +489,12 @@
(fail-k max-depth tasks))))])
(k end max-depth tasks new-got-k new-fail-k)))])))))
;; These temp identifiers can't be `gensym` or `generate-temporary`
;; because they have to be consistent between module loads
;; (IIUC, the parser is multi-threaded, and this approach is not thread-safe)
;; so I see no alternative to the old standby of making them ludicrously unlikely
(define-for-syntax start-id-temp 'start_jihqolbbafscgxvsufnepvmxqipnxgmlpxukmdoqxqzmzgaogaftbkbyqjttwwfimifowdxfyekjiixdmtprfkcvfciraehoeuaz)
(define-for-syntax atok-id-temp 'atok_wrutdjgecmybyfipiwsgjlvsveryodlgassuzcargiuznzgdghrykfqfbwcjgzdhdoeqxcucmtjkuyucskzethozhqkasphdwbht)
(define-syntax (cfg-parser stx)
(syntax-case stx ()
[(_ clause ...)
@ -652,8 +658,6 @@
pats (caddr old-list))))
nt-ids patss)
;; Build a definition for each non-term:
(let ([start-id-temp (gensym)]
[atok-id-temp (gensym)])
(loop (cdr clauses)
cfg-start
(map (lambda (nt pats handles $ctxs)
@ -717,7 +721,7 @@
(%atok [(tok) (make-tok 'tok-id 'tok $e pos ...)] ...)))
(with-syntax ([%start start-id-temp])
#`(start %start))
parser-clauses))))]
parser-clauses)))]
[(grammar . _)
(raise-syntax-error
#f

Loading…
Cancel
Save