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;
|
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) {
|
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");
|
throw new ApplicationException($"Program is invalid, still available: {program.Available()}");
|
||||||
}
|
}
|
||||||
prev_avail = program.Available();
|
prev_avail = program.Available();
|
||||||
foreach (Type c in _classes) {
|
foreach (Type c in _classes) {
|
||||||
|
|
|
@ -243,6 +243,13 @@ 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()})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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("(abc (quote (1 2 3)))", string.Format("{0}", p.parse()));
|
Assert.Equal(program, string.Format("{0}", p.parse()));
|
||||||
|
|
||||||
program = "(abc \"'(1 2 3)\")";
|
program = "(abc \"'(1 2 3)\")";
|
||||||
sts = StringTokenStream.generate(program);
|
sts = StringTokenStream.generate(program);
|
||||||
|
@ -148,6 +148,7 @@ 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]
|
||||||
|
|
Loading…
Reference in a new issue