|
|
|
@ -12,14 +12,18 @@
|
|
|
|
|
(find-property 'b-import-name #'(LINE ...))]
|
|
|
|
|
[(EXPORT-NAME ...)
|
|
|
|
|
(find-property 'b-export-name #'(LINE ...))]
|
|
|
|
|
[((SHELL-ID SHELL-VAL) ...) (handle-shell caller-stx)])
|
|
|
|
|
[((SHELL-ID SHELL-VAL) ...)
|
|
|
|
|
(make-shell-ids-and-values caller-stx)]
|
|
|
|
|
[(UNIQUE-ID ...)
|
|
|
|
|
(unique-ids
|
|
|
|
|
(syntax->list #'(VAR-ID ... SHELL-ID ...)))])
|
|
|
|
|
#'(#%module-begin
|
|
|
|
|
(module configure-runtime br
|
|
|
|
|
(require basic-demo-3/setup)
|
|
|
|
|
(do-setup!))
|
|
|
|
|
(require IMPORT-NAME) ...
|
|
|
|
|
(provide EXPORT-NAME ...)
|
|
|
|
|
(define VAR-ID 0) ...
|
|
|
|
|
(define UNIQUE-ID 0) ...
|
|
|
|
|
(set! SHELL-ID SHELL-VAL) ...
|
|
|
|
|
LINE ...
|
|
|
|
|
(define line-table
|
|
|
|
@ -30,17 +34,21 @@
|
|
|
|
|
|
|
|
|
|
(begin-for-syntax
|
|
|
|
|
(require racket/list)
|
|
|
|
|
|
|
|
|
|
(define (unique-ids stxs)
|
|
|
|
|
(remove-duplicates stxs #:key syntax->datum))
|
|
|
|
|
|
|
|
|
|
(define (find-property which line-stxs)
|
|
|
|
|
(remove-duplicates
|
|
|
|
|
(unique-ids
|
|
|
|
|
(for/list ([stx (in-list (stx-flatten line-stxs))]
|
|
|
|
|
#:when (syntax-property stx which))
|
|
|
|
|
stx)
|
|
|
|
|
#:key syntax->datum))
|
|
|
|
|
stx)))
|
|
|
|
|
|
|
|
|
|
(define (handle-shell ctxt)
|
|
|
|
|
(for/list
|
|
|
|
|
([(val idx)
|
|
|
|
|
(in-indexed (current-command-line-arguments))])
|
|
|
|
|
(list (suffix-id #'arg idx #:context ctxt)
|
|
|
|
|
(or (string->number val) val)))))
|
|
|
|
|
(define (make-shell-ids-and-values ctxt)
|
|
|
|
|
(for/list ([idx (in-naturals)]
|
|
|
|
|
[val (current-command-line-arguments)])
|
|
|
|
|
(with-pattern
|
|
|
|
|
([SHELL-ID (suffix-id #'arg idx #:context ctxt)]
|
|
|
|
|
[SHELL-VALUE (or (string->number val) val)])
|
|
|
|
|
#'(SHELL-ID SHELL-VALUE)))))
|
|
|
|
|
|
|
|
|
|