Compare commits
2 commits
d5e8b69b70
...
c9d7f1ee60
Author | SHA1 | Date | |
---|---|---|---|
c9d7f1ee60 | |||
805d0efb4f |
3 changed files with 14 additions and 3 deletions
|
@ -78,7 +78,10 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler {
|
|||
}
|
||||
value += t;
|
||||
}
|
||||
return null;
|
||||
if (value.Equals("")) {
|
||||
return null;
|
||||
}
|
||||
return new AtomToken(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +104,7 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler {
|
|||
if (prev_avail == program.Available() && prev_avail == 0) {
|
||||
break;
|
||||
} else if (prev_avail == program.Available()) {
|
||||
throw new ApplicationException("Program is invalid");
|
||||
throw new ApplicationException($"Program is invalid, still available: {program.Available()}");
|
||||
}
|
||||
prev_avail = program.Available();
|
||||
foreach (Type c in _classes) {
|
||||
|
|
|
@ -243,6 +243,13 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp {
|
|||
return $"{Item1} . {Item2}";
|
||||
}
|
||||
public override string? ToString() {
|
||||
if (Item1 is Symbol SymbolItem1
|
||||
&& SymbolItem1.Name() == "quote"
|
||||
&& Item2 is Cons ConsItem2
|
||||
&& ConsItem2.Item2.Equals(Boolean.FALSE)
|
||||
) {
|
||||
return $"'{ConsItem2.Item1}";
|
||||
}
|
||||
return $"({ToStringSimple()})";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace Tests
|
|||
program = "(abc '(1 2 3))";
|
||||
sts = StringTokenStream.generate(program);
|
||||
p = new Parser(sts);
|
||||
Assert.Equal("(abc (quote (1 2 3)))", string.Format("{0}", p.parse()));
|
||||
Assert.Equal(program, string.Format("{0}", p.parse()));
|
||||
|
||||
program = "(abc \"'(1 2 3)\")";
|
||||
sts = StringTokenStream.generate(program);
|
||||
|
@ -148,6 +148,7 @@ namespace Tests
|
|||
(if (> 0 1) (car (quote (1 2 3))) (cdr (quote (2 3 4)))))
|
||||
""").ToString());
|
||||
|
||||
Assert.Equal("a", e.eval("'a").ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
Loading…
Reference in a new issue