const text = ";;a comment\n(instance AttrFn BinaryFunction);;another comment\0"; auto _topExprs = LispParser(text); assert(!_topExprs.empty); assert(_topExprs.front.token.tok == TOK.symbol); assert(_topExprs.front.token.src == `instance`); assert(_topExprs.front.subs[0].token.tok == TOK.functionName); assert(_topExprs.front.subs[0].token.src == "AttrFn"); assert(_topExprs.front.subs[1].token.tok == TOK.symbol); assert(_topExprs.front.subs[1].token.src == "BinaryFunction"); _topExprs.popFront(); assert(_topExprs.empty);
const text = ";;a comment\n(instance AttrFn BinaryFunction);;another comment\0"; auto _topExprs = LispParser(text); import std.conv : to; assert(_topExprs.front.to!string == `(instance AttrFn BinaryFunction)`); assert(!_topExprs.empty);
https://forum.dlang.org/post/okqdldjnoyrtuizevqeo@forum.dlang.org
Parse the contents of filePath into lazy range over top-level expressions (SExpr).