fix ReaderExp.toString()

This commit is contained in:
2020-11-27 18:58:02 -07:00
parent 6101ddf4cf
commit 66a7f0c780
2 changed files with 18 additions and 9 deletions

View File

@@ -11,6 +11,8 @@ import kiss.Macros;
import kiss.Types;
import kiss.CompileError;
using kiss.Reader;
typedef KissState = {
className:String,
readTable:Map<String, ReadFunction>,
@@ -47,12 +49,13 @@ class Kiss {
break;
var position = stream.position();
var nextExp = Reader.read(stream, k.readTable);
#if test
trace(nextExp);
#end
// The last expression might be a comment, in which case None will be returned
switch (nextExp) {
case Some(nextExp):
#if test
trace(nextExp.def.toString());
#end
var field = readerExpToField(nextExp, k);
if (field != null)
classFields.push(field);

View File

@@ -123,17 +123,23 @@ class Reader {
case CallExp(func, args):
// (f a1 a2...)
var str = '(' + func.def.toString();
if (args.length > 0)
str += " ";
str += [
for (arg in args) {
str += arg.def.toString();
arg.def.toString();
}
].join(" ");
str += ')';
str;
case ListExp(exps):
// [v1 v2 v3]
var str = '[';
str += [
for (exp in exps) {
str += exp.def.toString();
exp.def.toString();
}
].join(" ");
str += ']';
str;
case StrExp(s):