Compare commits

..

No commits in common. "c9d7f1ee60bf2ab0bef868154f19ae220cc6bad8" and "d5e8b69b7083d44c2df7a21907c32f5dc4d1db83" have entirely different histories.

3 changed files with 3 additions and 14 deletions

View file

@ -78,11 +78,8 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler {
} }
value += t; value += t;
} }
if (value.Equals("")) {
return null; return null;
} }
return new AtomToken(value);
}
} }
class CharStream: Stream<char> { class CharStream: Stream<char> {
@ -104,7 +101,7 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler {
if (prev_avail == program.Available() && prev_avail == 0) { if (prev_avail == program.Available() && prev_avail == 0) {
break; break;
} else if (prev_avail == program.Available()) { } else if (prev_avail == program.Available()) {
throw new ApplicationException($"Program is invalid, still available: {program.Available()}"); throw new ApplicationException("Program is invalid");
} }
prev_avail = program.Available(); prev_avail = program.Available();
foreach (Type c in _classes) { foreach (Type c in _classes) {

View file

@ -243,13 +243,6 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp {
return $"{Item1} . {Item2}"; return $"{Item1} . {Item2}";
} }
public override string? ToString() { 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()})"; return $"({ToStringSimple()})";
} }
} }

View file

@ -70,7 +70,7 @@ namespace Tests
program = "(abc '(1 2 3))"; program = "(abc '(1 2 3))";
sts = StringTokenStream.generate(program); sts = StringTokenStream.generate(program);
p = new Parser(sts); p = new Parser(sts);
Assert.Equal(program, string.Format("{0}", p.parse())); Assert.Equal("(abc (quote (1 2 3)))", string.Format("{0}", p.parse()));
program = "(abc \"'(1 2 3)\")"; program = "(abc \"'(1 2 3)\")";
sts = StringTokenStream.generate(program); sts = StringTokenStream.generate(program);
@ -148,7 +148,6 @@ namespace Tests
(if (> 0 1) (car (quote (1 2 3))) (cdr (quote (2 3 4))))) (if (> 0 1) (car (quote (1 2 3))) (cdr (quote (2 3 4)))))
""").ToString()); """).ToString());
Assert.Equal("a", e.eval("'a").ToString());
} }
[Fact] [Fact]