From af9dfb787636ff5c256d2ddbcb7ee0d89d2fb7f6 Mon Sep 17 00:00:00 2001 From: Cristian Esquivias Date: Tue, 19 Aug 2014 15:15:34 -0700 Subject: [PATCH] Took out 'start prepend hack from reader. When proc-expression is a string call start instead with proc-expression as the first argument. --- language.rkt | 14 +++++++++++++- rash-lang.rkt | 8 ++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/language.rkt b/language.rkt index 0da5f58..a0d6904 100644 --- a/language.rkt +++ b/language.rkt @@ -4,4 +4,16 @@ (provide start pipe - (all-from-out racket/base)) + (except-out (all-from-out racket/base) + #%app + #%top) + (rename-out [my-app #%app] + [my-top #%top])) + +(define-syntax-rule (my-top . id) + 'id) + +(define-syntax-rule (my-app proc-expr arg ...) + (if (string? proc-expr) + (start proc-expr arg ...) + (proc-expr arg ...))) diff --git a/rash-lang.rkt b/rash-lang.rkt index 42c4b70..3fc4887 100644 --- a/rash-lang.rkt +++ b/rash-lang.rkt @@ -13,7 +13,7 @@ (define-values (start-line start-col start-pos) (port-next-location in)) (define (list->rash-syntax l span) (datum->syntax #f - (cons 'start l) + l (vector src start-line start-col start-pos span))) (let loop ([words '()] @@ -58,14 +58,14 @@ (test-case "Read alphanumeric words with EOF" - (check equal? '(start "echo" "hello1") (rash-read (2port "echo hello1")))) + (check equal? '("echo" "hello1") (rash-read (2port "echo hello1")))) (test-case "Read string with newline" - (check equal? '(start "echo") (rash-read (2port "echo\n")))) + (check equal? '("echo") (rash-read (2port "echo\n")))) (test-case "Read string" (check equal? - '(start "echo" "hello world") + '("echo" "hello world") (rash-read (2port "echo \"hello world\"")))))