simplify runtime config

pull/10/head
Matthew Butterick 8 years ago
parent 5cc0f73028
commit c1e2939aa6

@ -11,12 +11,11 @@
[(REQ-SPEC ...) (find-property 'b-require-spec #'(LINE ...))] [(REQ-SPEC ...) (find-property 'b-require-spec #'(LINE ...))]
[((SHELL-ID SHELL-VAL) ...) [((SHELL-ID SHELL-VAL) ...)
(for/list ([(arg idx) (in-indexed (current-command-line-arguments))]) (for/list ([(arg idx) (in-indexed (current-command-line-arguments))])
(list (format-id caller-stx "arg~a" idx) arg))]) ; explain why (format-datum 'arg~a idx) won't work (list (format-id caller-stx "arg~a" idx) arg))]) ; explain why (format-datum 'arg~a idx) won't work
#'(#%module-begin #'(#%module-begin
(module configure-runtime br (module configure-runtime br
(require "runtime.rkt") (require "runtime.rkt")
(current-basic-port (current-output-port)) (configure-this!))
(configure-repl!))
(require REQ-SPEC) ... (require REQ-SPEC) ...
(define VAR-ID 0) ... (define VAR-ID 0) ...
(provide VAR-ID ...) (provide VAR-ID ...)
@ -24,8 +23,7 @@
LINE ... LINE ...
(define line-table (define line-table
(apply hasheqv (append (list NUM LINE-FUNC) ...))) (apply hasheqv (append (list NUM LINE-FUNC) ...)))
(parameterize ([current-output-port (parameterize ([current-output-port (basic-output-port)])
(or (current-basic-port) (open-output-nowhere))])
(void (run line-table)))))) (void (run line-table))))))
(begin-for-syntax (begin-for-syntax
@ -34,6 +32,6 @@
(remove-duplicates (remove-duplicates
(for/list ([stx (in-list (stx-flatten line-stxs))] (for/list ([stx (in-list (stx-flatten line-stxs))]
#:when (syntax-property stx which)) #:when (syntax-property stx which))
stx) stx)
#:key syntax->datum))) #:key syntax->datum)))

@ -1,10 +1,12 @@
#lang br #lang br
(require "parser.rkt" "tokenizer.rkt") (require "parser.rkt" "tokenizer.rkt")
(provide current-basic-port configure-repl!) (provide basic-output-port configure-this!)
(define current-basic-port (make-parameter #f)) (define basic-output-port (make-parameter (open-output-nowhere)))
(define (configure-repl!) (define (configure-this!)
(basic-output-port (current-output-port))
(define statement-parser (make-rule-parser b-statement)) (define statement-parser (make-rule-parser b-statement))
(define (read-one-line path port) (define (read-one-line path port)
(define one-line (read-line port)) (define one-line (read-line port))

Loading…
Cancel
Save