Commit 0d8adb19 authored by Jesse McGrew's avatar Jesse McGrew
Browse files

Make READER-MACROS a builtin package.

parent ea31ec9aaa9c
......@@ -319,7 +319,7 @@ namespace Zilf.Interpreter
void InitPackages()
{
var emptyPackageNames = new[] { "NEWSTRUC", "ZILCH", "ZIL" };
var emptyPackageNames = new[] { "NEWSTRUC", "ZILCH", "ZIL", "READER-MACROS" };
foreach (var name in emptyPackageNames)
{
......@@ -351,7 +351,7 @@ namespace Zilf.Interpreter
// these atoms need to be on the root oblist
var atom = ZilAtom.Parse(name + "!-", this);
SetGlobalVal(atom, isFSubr ? new ZilFSubr(name, del) : new ZilSubr(name, del));
SetGlobalVal(atom, isFSubr ? new ZilFSubr(baseName, del) : new ZilSubr(baseName, del));
}
}
}
......
......@@ -303,7 +303,7 @@ namespace Zilf.Interpreter
return position;
}
[Subr("MAKE-PREFIX-MACRO", ObList = "READER-MACROS")]
[Subr("MAKE-PREFIX-MACRO", ObList = "READER-MACROS!-PACKAGE")]
public static ZilObject MAKE_PREFIX_MACRO(Context ctx, ZilChar ch,
[Either(typeof(IApplicable), typeof(ZilFalse))]
object handlerOrFalse)
......
......@@ -65,7 +65,8 @@ namespace Zilf.Tests.Integration
public void MAKE_PREFIX_MACRO_Should_Work()
{
AssertExpr(@"<TELL B @HELLO "" "" B @WORLD CR>")
.WithGlobal(@"<MAKE-PREFIX-MACRO!-READER-MACROS !\@ <FUNCTION (W:ATOM) <VOC <SPNAME .W> BUZZ>>>")
.WithGlobal(@"<USE ""READER-MACROS"">")
.WithGlobal(@"<MAKE-PREFIX-MACRO !\@ <FUNCTION (W:ATOM) <VOC <SPNAME .W> BUZZ>>>")
.Outputs("hello world\n");
}
......
......@@ -2,6 +2,8 @@
<ENTRY QUASIQUOTE TILDE>
<USE "READER-MACROS">
<NEWTYPE TILDE LIST '!<<PRIMTYPE LIST> ANY>>
<DEFINE QUASIQUOTE ("BIND" ENV 'STRUC "AUX" (ALLOW-SPLICING? <>))
......@@ -35,9 +37,7 @@
<DEFINE WRAP-QQ ("ARGS" A) <FORM QUASIQUOTE !.A>>
<DEFINE WRAP-UQ ("ARGS" A) <CHTYPE .A TILDE>>
;"TODO: USE READER-MACROS"
<COND (<GASSIGNED? MAKE-PREFIX-MACRO!-READER-MACROS>
<MAKE-PREFIX-MACRO!-READER-MACROS !\` ,WRAP-QQ>
<MAKE-PREFIX-MACRO!-READER-MACROS !\~ ,WRAP-UQ>)>
<MAKE-PREFIX-MACRO !\` ,WRAP-QQ>
<MAKE-PREFIX-MACRO !\~ ,WRAP-UQ>
<ENDPACKAGE>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment