Compare commits
No commits in common. "d5e8b69b7083d44c2df7a21907c32f5dc4d1db83" and "6d7cd33d04a402e72d584b52ea470cf0bcf75f96" have entirely different histories.
d5e8b69b70
...
6d7cd33d04
3 changed files with 1 additions and 36 deletions
|
@ -40,19 +40,6 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler {
|
||||||
return new String(r);
|
return new String(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression parse_comment(GroupingToken start, GroupingToken? end) {
|
|
||||||
Debug.Assert(end != null);
|
|
||||||
Debug.Assert(";".Contains(start.value));
|
|
||||||
while (_sts.Available() > 0) {
|
|
||||||
Token<string> t = _sts.Get();
|
|
||||||
if (t.value == end.value) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_sts.Commit();
|
|
||||||
return parse();
|
|
||||||
}
|
|
||||||
|
|
||||||
Expression parse_quote(GroupingToken start, GroupingToken? end) {
|
Expression parse_quote(GroupingToken start, GroupingToken? end) {
|
||||||
Debug.Assert(end == null);
|
Debug.Assert(end == null);
|
||||||
Debug.Assert("'".Contains(start.value));
|
Debug.Assert("'".Contains(start.value));
|
||||||
|
@ -66,9 +53,6 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler {
|
||||||
if ("'".Contains(start.value)) {
|
if ("'".Contains(start.value)) {
|
||||||
return parse_quote(start, end);
|
return parse_quote(start, end);
|
||||||
}
|
}
|
||||||
if (";".Contains(start.value)) {
|
|
||||||
return parse_comment(start, end);
|
|
||||||
}
|
|
||||||
Debug.Assert(end != null);
|
Debug.Assert(end != null);
|
||||||
IList<Expression> expressions = new List<Expression>();
|
IList<Expression> expressions = new List<Expression>();
|
||||||
while (_sts.Available() > 0) {
|
while (_sts.Available() > 0) {
|
||||||
|
@ -77,13 +61,6 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler {
|
||||||
_sts.Commit();
|
_sts.Commit();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (t is SpaceToken) {
|
|
||||||
// need this here because those tokens can never
|
|
||||||
// return an expression and trying to parse the last
|
|
||||||
// expression will not work if its only spaces and a
|
|
||||||
// closing parentheses.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
_sts.Rewind(1);
|
_sts.Rewind(1);
|
||||||
expressions.Add(parse());
|
expressions.Add(parse());
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
char t = program.Get();
|
char t = program.Get();
|
||||||
if ("()\"';".Contains(t)) {
|
if ("()\"'".Contains(t)) {
|
||||||
return new GroupingToken(t.ToString());
|
return new GroupingToken(t.ToString());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -55,8 +55,6 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler {
|
||||||
return null;
|
return null;
|
||||||
} else if (_value == "'") {
|
} else if (_value == "'") {
|
||||||
return null;
|
return null;
|
||||||
} else if (_value == ";") {
|
|
||||||
return new GroupingToken("\n");
|
|
||||||
}
|
}
|
||||||
return new GroupingToken(_value);
|
return new GroupingToken(_value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,16 +76,6 @@ namespace Tests
|
||||||
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(program, string.Format("{0}", p.parse()));
|
||||||
|
|
||||||
program = """
|
|
||||||
(begin ;this too
|
|
||||||
;;; this is a comment
|
|
||||||
t
|
|
||||||
)
|
|
||||||
""";
|
|
||||||
sts = StringTokenStream.generate(program);
|
|
||||||
p = new Parser(sts);
|
|
||||||
Assert.Equal("(begin t)", string.Format("{0}", p.parse()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
Loading…
Reference in a new issue