feat: add special case for string representation of cons which is a quote.
This commit is contained in:
parent
d5e8b69b70
commit
805d0efb4f
2 changed files with 8 additions and 1 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue