LispParser

Parse from input into lazy range over top-level expressions (SExpr).

Constructors

this
this(Input input, Config config)

Parse input into returned array of expressions (SExpr).

Postblit

this(this)
this(this)
Undocumented in source.

Members

Aliases

Input
alias Input = const(char)[]
Undocumented in source.
digitChars
alias digitChars = AliasSeq!('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
Undocumented in source.
endOfLineChars
alias endOfLineChars = AliasSeq!('\n', '\r')
Undocumented in source.
whiteChars
alias whiteChars = AliasSeq!(' ', '\t', '\n', '\v', '\r', '\f')
Undocumented in source.

Functions

charsToLineColumn
LineColumn charsToLineColumn(const(char)[] chars)
Undocumented in source.
empty
bool empty()
Undocumented in source.
front
const(SExpr) front()
Undocumented in source. Be warned that the author may not have intended to support it.
offsetTo
ptrdiff_t offsetTo(char[] expr)
Undocumented in source.
offsetToLineColumn
LineColumn offsetToLineColumn(size_t offset)
Undocumented in source.
popFront
void popFront()
Undocumented in source. Be warned that the author may not have intended to support it.
sexprToLineColumn
LineColumn sexprToLineColumn(SExpr sexpr)
Undocumented in source.

Properties

subExprsCount
size_t subExprsCount [@property getter]
Undocumented in source.

Structs

Config
struct Config
Undocumented in source.

Examples

const text = ";;a comment\n(instance AttrFn BinaryFunction);;another comment\0";
auto parser = LispParser(text);
assert(!parser.empty);

assert(parser.front.token.tok == TOK.symbol);
assert(parser.front.token.src == `instance`);

assert(parser.front.subs[0].token.tok == TOK.functionName);
assert(parser.front.subs[0].token.src == "AttrFn");

assert(parser.front.subs[1].token.tok == TOK.symbol);
assert(parser.front.subs[1].token.src == "BinaryFunction");

parser.popFront();
assert(parser.empty);
const text = ";;a comment\n(instance AttrFn BinaryFunction);;another comment\0";
auto parser = LispParser(text);
import std.conv : to;
assert(parser.front.to!string == `(instance AttrFn BinaryFunction)`);
assert(!parser.empty);

See Also

Meta