Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
zilf
zilf
Commits
f66b0e5c1f1d
Commit
0d8adb19
authored
Jan 17, 2021
by
Jesse McGrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make READER-MACROS a builtin package.
parent
ea31ec9aaa9c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
8 deletions
+9
-8
src/Zilf/Interpreter/Context.cs
src/Zilf/Interpreter/Context.cs
+2
-2
src/Zilf/Interpreter/Subrs.Output.cs
src/Zilf/Interpreter/Subrs.Output.cs
+1
-1
test/Zilf.Tests.Integration/MacroTests.cs
test/Zilf.Tests.Integration/MacroTests.cs
+2
-1
zillib/experimental/qq.mud
zillib/experimental/qq.mud
+4
-4
No files found.
src/Zilf/Interpreter/Context.cs
View file @
f66b0e5c
...
...
@@ -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
(
n
ame
,
del
)
:
new
ZilSubr
(
n
ame
,
del
));
SetGlobalVal
(
atom
,
isFSubr
?
new
ZilFSubr
(
baseN
ame
,
del
)
:
new
ZilSubr
(
baseN
ame
,
del
));
}
}
}
...
...
src/Zilf/Interpreter/Subrs.Output.cs
View file @
f66b0e5c
...
...
@@ -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
)
...
...
test/Zilf.Tests.Integration/MacroTests.cs
View file @
f66b0e5c
...
...
@@ -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"
);
}
...
...
zillib/experimental/qq.mud
View file @
f66b0e5c
...
...
@@ -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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment