Skip to content

Commit

Permalink
Support variables and headers in echo
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Alama committed Nov 14, 2018
1 parent 8ac84d7 commit e52a4c0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion echo.rkt
Expand Up @@ -45,7 +45,8 @@
[else
(displayln "# (empty response)")])]
[(? expression?)
(render-commented-out (send expr evalutate env))])
(displayln (format "# ~a = " (send expr render)))
(render-commented-out (send expr evaluate env))])
env)
(define/override (render)
(cond [(eq? #f expr)
Expand Down
2 changes: 1 addition & 1 deletion grammar.rkt
Expand Up @@ -11,7 +11,7 @@ program-step: assignment

import: IMPORT URI

echo: "echo" [ JSON-POINTER | NORMAL-IDENTIFIER | HEADER-REF ]
echo: "echo" [ JSON-POINTER | normal-identifier | head-id ]

unset: "unset" HEADER-IDENTIFIER

Expand Down
4 changes: 4 additions & 0 deletions program.rkt
Expand Up @@ -321,6 +321,10 @@
(match to-be-echoed
[#f
(make-echo-step #f)]
[(list 'normal-identifier id)
(make-echo-step (parse-tree->identifier to-be-echoed))]
[(list 'head-id id)
(make-echo-step (parse-tree->identifier to-be-echoed))]
[else
(error (format "parse-tree->echo: Cannot make sense of ~a" to-be-echoed))]))

Expand Down

0 comments on commit e52a4c0

Please sign in to comment.