git » jacl.git » commit 5c20c45

@@ readAwait reader macro

author Alan Dipert
2020-02-24 03:59:29 UTC
committer Alan Dipert
2020-02-24 03:59:29 UTC
parent cef2746ff32973ce78d0e4dab154f54996df5024

@@ readAwait reader macro

jacl.js +8 -0

diff --git a/jacl.js b/jacl.js
index d620ad0..0daadd3 100644
--- a/jacl.js
+++ b/jacl.js
@@ -666,6 +666,13 @@ const readGlobalReference = async stream => {
   );
 };
 
+const readAwait = async stream => {
+  return new Values(Cons.listOf(
+    JACLPKG.intern('AWAIT'),
+    await (new Reader(stream)).read()
+  ));
+}
+
 READTABLE.value = new ReadTable()
   .setMacro(';', true, async stream => {
     for await(const ch of stream) {
@@ -2090,6 +2097,7 @@ JACLPKG.intern('ENABLE-JS-SYNTAX').fvalue = () => {
     .val()
     .makeDispatchMacroChar('@', true)
     .setDispatchMacroChar('@', '"', readJsString)
+    .setDispatchMacroChar('@', '@', readAwait)
     .setDispatchMacroChar('@', '|', readGlobalReference);
   return null;
 };