fix: enumerable objects get converted to lists now.

This commit is contained in:
redxef 2024-10-27 00:51:54 +02:00
parent b4574497e6
commit 4dccc928e9
Signed by: redxef
GPG key ID: 7DAC3AA211CBD921

View file

@ -211,7 +211,7 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler {
public override string ToString() { public override string ToString() {
return _value.ToString(); return _value.ToString();
} }
public static Atom FromBase(object o) { public static Expression FromBase(object o) {
switch (o) { switch (o) {
case bool b: case bool b:
return new Boolean(b); return new Boolean(b);
@ -219,6 +219,8 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler {
return new Integer(i); return new Integer(i);
case string s: case string s:
return new String(s); return new String(s);
case IEnumerable<object> e:
return new List(e.Select(x => Object.FromBase(x)).ToList());
default: default:
return new Object(o); return new Object(o);
} }
@ -267,6 +269,9 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler {
public Parser(StringTokenStream tokens) { public Parser(StringTokenStream tokens) {
_sts = tokens; _sts = tokens;
} }
public Parser(string s) {
_sts = StringTokenStream.generate(s);
}
public Expression parse() { public Expression parse() {
Token<string> token = _sts.Get(); Token<string> token = _sts.Get();