LispFileParser

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

Constructors

this
this(string filePath)
Undocumented in source.

Destructor

~this
~this()
Undocumented in source.

Alias This

parser

Members

Functions

offsetTo
ptrdiff_t offsetTo(char[] expr)
Undocumented in source.

Variables

parser
LispParser parser;
Undocumented in source.

Examples

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);

See Also

Meta