LispFileParser

Parse the contents of filePath into lazy range over top-level expressions (SExpr).

struct LispFileParser {
@safe
LispParser parser;
}

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Alias This

parser

Examples

1 const text = ";;a comment\n(instance AttrFn BinaryFunction);;another comment\0";
2 auto _topExprs = LispParser(text);
3 assert(!_topExprs.empty);
4 
5 assert(_topExprs.front.token.tok == TOK.symbol);
6 assert(_topExprs.front.token.src == `instance`);
7 
8 assert(_topExprs.front.subs[0].token.tok == TOK.functionName);
9 assert(_topExprs.front.subs[0].token.src == "AttrFn");
10 
11 assert(_topExprs.front.subs[1].token.tok == TOK.symbol);
12 assert(_topExprs.front.subs[1].token.src == "BinaryFunction");
13 
14 _topExprs.popFront();
15 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);

See Also

Meta