watt.containers.queue

//! A templated queue data structure.
module watt.containers.queue;

watt.containers.stack

//! A templated stack data structure.
module watt.containers.stack;

watt.digest.murmur

//! Contains an implementation of the Murmur hashing function.
module watt.digest.murmur;


//! Hash data using the 32 bit Murmur hash, and a seed of 0.
fn hashMurmur_32(arr: const(const(void)[])) u32 { }
//! Hash data using the 32 bit Murmur hash, and a seed.
fn hashMurmur_32(arr: const(const(void)[]), seed: u32) u32 { }

watt.digest.fnv

//! Contains two variants of the Fowler–Noll–Vo hashing function.
module watt.digest.fnv;


//! Hash data using a 32 bit variant of the FNV hash function.
fn hashFNV1A_32(arr: scope (const(scope (void)[])) u32 { }
//! Hash data using a 64 bit variant of the FNV hash function.
fn hashFNV1A_64(arr: scope (const(scope (void)[])) u64 { }

watt.digest

//! Modules that generate hashes of data.
module watt.digest;

public import watt.digest.fnv;
public import watt.digest.murmur;

watt.text.ascii

//! Functions for classifying characters in the ASCII range.
module watt.text.ascii;


enum HEX_DIGITS;
enum FULL_HEX_DIGITS;
enum DIGITS;
enum OCTAL_DIGITS;
enum LOWERCASE;
enum LETTERS;
enum UPPERCASE;
enum WHITESPACE;
enum NEWLINE;

//! Is a character alphanumeric?
fn isAlphaNum(c: dchar) bool { }
//! Is a character alphabetical?
fn isAlpha(c: dchar) bool { }
//! Is a character a lowercase alphabetical character?
fn isLower(c: dchar) bool { }
//! Is a character a uppercase alphabetical character?
fn isUpper(c: dchar) bool { }
//! Is a character a digit?
fn isDigit(c: dchar) bool { }
//! Is a character an octal digit?
fn isOctalDigit(c: dchar) bool { }
//! Is a character a hexadecimal digit?
fn isHexDigit(c: dchar) bool { }
//! Is a character whitespace?
fn isWhite(c: dchar) bool { }
//! Is a character a control character?
fn isControl(c: dchar) bool { }
//! Is a character punctuation?
fn isPunctuation(c: dchar) bool { }
//! Is a character a printable ASCII character?
fn isPrintable(c: dchar) bool { }
//! Is a given character an ASCII character?
fn isASCII(c: dchar) bool { }
//! Get the lowerspace letter of an uppercase character.
fn toLower(c: dchar) dchar { }
//! Get the upperspace letter of a lowercase character.
fn toUpper(c: dchar) dchar { }

watt.text.html

//! Functions for escaping and unescaping HTML.
module watt.text.html;


//! Get the HTML escaped version of a given string.
fn htmlEscape(str: string) string { }
//! Given an HTML escaped string str, unescape that string.
fn htmlUnescape(str: string) string { }
//! Writes the HTML escaped version of a given string to the given dgt.
fn htmlEscape(dgt: scope (Sink), str: string, ignore: string) { }
//! Returns the HTML escaped version of a given string, ignoring any HTML
//! tags.
fn htmlEscapeIgnoreTags(str: string) string { }
//! Writes the HTML escaped version of a given string to the given dgt,
//! ignoring any HTML tags.
fn htmlEscapeIgnoreTags(dgt: scope (Sink), str: string) { }
//! Escape every single character.
fn htmlEscapeAll(str: string) string { }
//! Escape every single character into a Sink.
fn htmlEscapeAll(dgt: scope (Sink), str: string) { }

watt.text.vdoc

//! Volt doccomment parsing and cleaning code.
module watt.text.vdoc;


enum DocState
{
	Content,
	Brief,
	Param,
	Section,
}

enum DocSection
{
	SeeAlso,
	Return,
	SideEffect,
	Throw,
}

//! Interface for doc string consumers.
interface DocSink
{
public:
	//! Signals the start of the full content.
	fn start(sink: scope (Sink));
	//! Signals the end of the full content.
	fn end(sink: scope (Sink));
	//! Signals the start of a brief comment section.
	fn briefStart(sink: scope (Sink));
	//! Signals the end of a brief comment section.
	fn briefEnd(sink: scope (Sink));
	//! Signals the start of a param comment section.
	fn paramStart(sink: scope (Sink), direction: string, arg: string);
	//! Signals the end of a param comment section.
	fn paramEnd(sink: scope (Sink));
	//! Signals the start of a section, these are never nested.
	fn sectionStart(sink: scope (Sink), sec: DocSection);
	//! Signals the end of a section, these are never nested.
	fn sectionEnd(sink: scope (Sink), sec: DocSection);
	//! Regular text content.
	fn content(sink: scope (Sink), state: DocState, d: string);
	//! p comment section.
	fn p(sink: scope (Sink), state: DocState, d: string);
	//! link comment section.
	fn link(sink: scope (Sink), state: DocState, target: string, text: string);
	//! The defgroup command.
	fn defgroup(sink: scope (Sink), group: string, text: string);
	//! The ingroup command, may get called multiple times.
	fn ingroup(sink: scope (Sink), group: string);
}

//! Take a doc comment and remove comment cruft from it.
fn cleanComment(comment: string, isBackwardsComment: bool) string { }
//! Given a doc string input, call dsink methods with the given sink as an
//! argument.
fn parse(src: string, dsink: DocSink, sink: scope (Sink)) { }

watt.text.getopt

//! Process command line arguments.
module watt.text.getopt;


//! Thrown when arguments are in error.
class GetoptException : Exception
{
public:
	this(msg: string) { }
}

//! Parse a flag taking a string argument from an array of strings.
fn getopt(args: string[], description: string, _string: string) bool { }
//! Parse a flag taking multiple string argument from an array of strings.
fn getopt(args: string[], description: string, strings: string[]) bool { }
//! Parse a flag that takes an integer argument from an array of strings.
fn getopt(args: string[], description: string, _int: i32) bool { }
//! Handle a simple boolean flag.
fn getopt(args: string[], description: string, _bool: bool) bool { }
//! Calls a delegate each time the flag appears.
fn getopt(args: string[], description: string, dgt: scope (void delegate())) bool { }
//! Calls a delegate with argument each time the flag appears.
fn getopt(args: string[], description: string, dgt: scope (void delegate(string))) bool { }
//! Get the first flag in an array of strings.
fn remainingOptions(args: string[]) string { }

watt.text.demangle

//! Functions for demangling Volt mangled symbols.
module watt.text.demangle;


//! Demangle a given mangled name.
fn demangle(mangledName: const(char)[]) string { }
//! Demangle a given mangled name, but omit redundant information.
fn demangleShort(mangledName: const(char)[]) string { }

watt.text.string

//! Simple functions for working with string values.
module watt.text.string;


//! Helper alias for string args that are scoped.
alias StrArg = scope (const(scope (char)[]);
//! Helper alias for string array args that are scoped.
alias StrArrayArg = scope (scope (const(scope (char)[])[]);

//! Divide s into an array of strings.
fn split(s: scope (StrArg), delimiter: dchar) string[] { }
//! Divide s into an array of strings.
fn split(s: scope (StrArg), delimiter: scope (StrArg)) string[] { }
//! Get an array with an element for each line in s.
fn splitLines(s: scope (StrArg)) string[] { }
//! Get an array with an element for each line in s.
fn splitLines(s: string) string[] { }
//! Remove whitespace before and after str.
fn strip(str: scope (StrArg)) string { }
//! Remove leading whitespace from str.
fn stripLeft(str: scope (StrArg)) string { }
//! Remove trailing whitespace.
fn stripRight(str: scope (StrArg)) string { }
//! Count how many times c occurs in s.
fn count(str: scope (StrArg), c: dchar) size_t { }
//! Find a character in a string.
fn indexOf(str: scope (StrArg), c: dchar) ptrdiff_t { }
//! Find a character in a string, starting from the end.
fn lastIndexOf(str: scope (StrArg), c: dchar) ptrdiff_t { }
//! Find a string in a string.
fn indexOf(str: scope (StrArg), sub: scope (StrArg)) ptrdiff_t { }
//! Find a string in an array of strings.
fn indexOf(ss: scope (StrArrayArg), str: scope (StrArg)) ptrdiff_t { }
//! Replace instances of a string in a string with another.
fn replace(str: scope (StrArg), from: scope (StrArg), to: scope (StrArg)) string { }
fn startsWith(str: scope (StrArg), beginnings: scope (StrArrayArg)) i32 { }
fn endsWith(str: scope (StrArg), ends: scope (StrArrayArg)) i32 { }
//! Join an array of strings into one string, separated by sep.
fn join(ss: scope (StrArrayArg), sep: scope (StrArg)) string { }

watt.text.diff

//! Functions that output the differences between two strings.
module watt.text.diff;


//! Print the difference between two strings, line-by-line, to stdout.
fn diff(a: const(char)[], b: const(char)[]) { }

watt.text.semver

//! Parse Semantic Version strings.
module watt.text.semver;


//! Parses a string into a Semantic Version.
class Release
{
public:
	//! major>..(-)(+)
	major: i32;
	minor: i32;
	patch: i32;
	prerelease: string;
	metadata: string;


public:
	//! Parse a SemVer from a given string.
	this(verString: string) { }
	//! Get a string representation of this semver string.
	fn toString() string { }
	//! Compare this release to another.
	fn opCmp(b: Release) i32 { }
	//! Test this release for equality with another.
	fn opEquals(b: Release) bool { }


public:
	static fn isValid(verString: string) bool { }
}

watt.text.source

//! A class for dealing with a file from the perspective of a compiler.
module watt.text.source;


//! A container for iterating over UTF-8 source code.
class Source
{
public:
	alias eof = empty;


public:
	//! The location of the current character front.
	loc: Location;


public:
	//! Sets this Source to s and the current location and validate it as a
	//! utf8 source.
	this(s: string, filename: string) { }
	//! Have we reached EOF, if we have current = dchar.default.
	fn empty() dchar { }
	//! Returns the current utf8 char.
	fn front() dchar { }
	//! Returns the following utf8 char after front.
	fn following() dchar { }
	//! Advance the source one character.
	fn popFront() { }
	//! Advance the source n character.
	fn popFrontN(n: size_t) { }
	//! Used to skip whitespace in the source file, as defined by
	//! watt.text.ascii.isWhite.
	fn skipWhitespace() { }
	//! Skips till character after next end of line or eof.
	fn skipEndOfLine() { }
	//! Return the unicode character n chars forwards. lookaheadEOF set to true
	//! if we reached EOF, otherwise false.
	fn lookahead(n: size_t, lookaheadEOF: bool) dchar { }
	//! Return the index of the current character.
	fn save() size_t { }
	//! Slices the source from the given mark to (but not including) the
	//! current character. Use save for indicies.
	fn sliceFrom(mark: size_t) string { }
	//! Slice the source from a to b.
	fn slice(a: size_t, b: size_t) string { }
}

//! A simple container for iterating over UTF-8 source code.
struct SimpleSource
{
public:
	alias eof = empty;


public:
	//! Have we reached EOF, if we have front = dchar.default.
	empty: bool;


public:
	//! Setup this simple source and return the full source.
	fn source(src: string) string { }
	//! Return the full source.
	fn source() string { }
	//! Returns the current utf8 char.
	fn front() dchar { }
	//! Returns the following utf8 char after front.
	fn following() dchar { }
	//! Advance the source one character.
	fn popFront() { }
	//! Advance the source n character.
	fn popFrontN(n: size_t) { }
	//! Return the unicode character n chars forwards. lookaheadEOF set to true
	//! if we reached EOF, otherwise false.
	fn lookahead(n: size_t, lookaheadEmpty: bool) dchar { }
	//! Used to skip whitespace in the source file, as defined by
	//! watt.text.ascii.isWhite.
	fn skipWhitespace() { }
	//! Return the index of the current character.
	fn save() size_t { }
	//! Slices the source from the given mark to (but not including) the
	//! current character. Use save for indicies.
	fn sliceFrom(mark: size_t) string { }
	//! Slices two points.
	fn slice(a: size_t, b: size_t) string { }
	//! Decodes a single utf8 code point at index in the given source.
	fn decodeChar(index: size_t) dchar { }
}

//! Struct representing a location in a source file.
struct Location
{
public:
	//! The file from pointed to this locatiom.
	filename: string;
	//! Line number starting at 1.
	line: size_t;
	//! Column starting at 1.
	column: size_t;
	//! Length in characers.
	length: size_t;


public:
	//! Format into a location string.
	fn toString() string { }
	//! Difference between two locations. end - begin == begin ... end
	fn opSub(begin: Location) Location { }
	//! See difference.
	fn spanTo(end: Location) { }


public:
	//! Difference between two locations. end - begin == begin ... end
	static fn difference(end: Location, begin: Location, _default: Location) Location { }
}

watt.text.sink

//! Construct long strings of text efficiently.
module watt.text.sink;


//! A Sink is a delegate that accepts strings and concatenates them
//! efficiently.
alias Sink = core.rt.format.Sink;
//! A SinkArg is shorthand for the string argument to a Sink.
alias SinkArg = core.rt.format.SinkArg;

//! Helps construct long strings efficiently.
struct StringSink
{
public:
	//! Add str to this sink.
	fn sink(str: scope (SinkArg)) { }
	//! Get the contents of this sink as a string.
	fn toString() string { }
	//! Get the contents of this sink as a mutable array of characters.
	fn toChar() char[] { }
	//! Safely get the backing storage from the sink without copying.
	fn toSink(sink: scope (Sink)) { }
	//! Clear this sink.
	fn reset() { }
}

struct StringsSink
{
public:
	enum MinSize;
	enum MaxSize;


public:
	alias Sink = void delegate(scope (SinkArg));
	alias SinkArg = scope (scope (T)[]);


public:
	fn length() size_t { }
	fn sink(type: T) { }
	fn append(arr: scope (scope (T)[])) { }
	fn append(s: SinkStruct) { }
	fn popLast() T { }
	fn getLast() T { }
	fn get(i: size_t) T { }
	fn set(i: size_t, n: T) { }
	fn setLast(i: T) { }
	fn toSink(sink: Sink) { }
	fn toArray() T[] { }
	fn borrowUnsafe() T[] { }
	fn reset() { }
}

watt.text.path

//! Functions for dealing with path strings.
module watt.text.path;


//! Given a path, return a representation of that path that is universal.
fn normalisePath(path: scope (SinkArg)) string { }
//! Given two paths, return a path composed of both.
fn concatenatePath(base: string, tail: string) string { }
//! Given a path, return a path that could be a subpath.
fn makePathAppendable(s: string) string { }
//! Normalise a path using POSIX rules, regardless of the current
//! platform.
fn normalisePathPosix(path: scope (SinkArg)) string { }
//! Normalise a path using Windows rules, regardless of the current
//! platform.
fn normalisePathWindows(path: scope (SinkArg)) string { }

watt.text.format

//! Structured string formatting.
module watt.text.format;


//! Formats various arguments into a string by interpreting formatString.
fn format(formatString: const(char)[]) string { }
//! Format using the above rules, but into a Sink.
fn format(sink: scope (Sink), formatString: const(char)[]) { }
//! Format using the above rules, but into a Sink, with an explicit list of
//! TypeInfos, and an explicit va_list.
fn formatImpl(sink: scope (Sink), formatString: const(char)[], _typeids: TypeInfo[], vl: va_list) { }

watt.text.utf

//! Functions for decoding and encoding UTF-8 strings and characters.
module watt.text.utf;


//! Encode c as UTF-8.
alias encodeNoGC = vrt_encode_static_u8;

//! Retrieve a UTF-8 character from a particular index.
fn decode(str: scope (StrArg), index: size_t) dchar { }
//! Determine how many codepoints are in a given UTF-8 string.
fn count(s: scope (StrArg)) size_t { }
//! Throws a MalformedUTF8Exception if s is not valid UTF-8.
fn validate(s: scope (StrArg)) { }
//! Encode c onto the end of buf.
fn encode(buf: char[], c: dchar) { }
//! Encode an array of codepoints into a string.
fn encode(arr: dchar[]) string { }
//! Encode c as UTF-8 and add it to arr, starting at index.
fn encode(arr: char[], index: size_t, c: dchar) { }
//! Encode c as UTF-8.
fn encode(c: dchar) string { }
//! Add c to a sink.
fn encode(dgt: scope (Sink), c: dchar) { }

watt.algorithm

//! Functions implementing generally applicable algorithms.
module watt.algorithm;


//! Takes two indices of elements to compare. Return true if the first
//! parameter should go before the second.
alias CmpDg = scope (bool delegate(size_t, size_t));
//! Takes two indices of elements to swap.
alias SwapDg = scope (void delegate(size_t, size_t));

//! Sort something via delegates.
fn runSort(numElements: size_t, cmp: scope (CmpDg), swap: scope (SwapDg)) { }
//! Sort an array of integers in place.
fn sort(ints: i32[]) { }
//! Return the maximum of two values.
fn max(a: i32, b: i32) i32 { }
//! Return the maximum of two values.
fn max(a: i64, b: i64) i64 { }
//! Return the maximum of two values.
fn max(a: u32, b: u32) u32 { }
//! Return the maximum of two values.
fn max(a: u64, b: u64) u64 { }
//! Return the maximum of two values.
fn max(f64, f64) f64;
//! Return the minimum of two values.
fn min(a: i32, b: i32) i32 { }
//! Return the minimum of two values.
fn min(a: i64, b: i64) i64 { }
//! Return the minimum of two values.
fn min(a: u32, b: u32) u32 { }
//! Return the minimum of two values.
fn min(a: u64, b: u64) u64 { }
//! Return the minimum of two values.
fn min(f64, f64) f64;

watt.license

//! Ensures the license is embedded in binaries.
module watt.license;


//! This is the license for the watt library.
enum license;

watt.library

//! Load functions from shared objects.
module watt.library;


//! A delegate that loads an address from a name. Usually loads a
//! function.
alias Loader = void* delegate(string);

//! Represents a loadable module.
class Library
{
public:
	//! Return a pointer to the requested symbol name.
	fn symbol(symbol: string) void* { }
	//! Close the library.
	fn free() { }


public:
	//! Given a list of shared objects, return the first one that loads.
	static fn loads(files: string[]) Library { }
	//! Create a Library from a path to a shared object.
	static fn load(filename: string) Library { }
}

watt.io.streams.fd

//! Streams that interact with *nix FDs.
module watt.io.streams.fd;


//! Size of the internal read/write buffer.
enum BufferSize;

//! An OutputStream in which the sink is a file.
class OutputFDStream : OutputStream
{
public:
	//! The file descriptor this stream wraps.
	fd: i32;


public:
	//! Construct a new OutputFDStream from a filename.
	this(filename: const(char)[]) { }
	//! Close the underlying file descriptor.
	fn close() { }
	//! Is this a valid stream?
	fn isOpen() bool { }
	//! Output c to the stream.
	fn put(c: dchar) { }
	//! Write s to the stream.
	fn write(s: scope (const(scope (char)[])) { }
	//! Ensure that all buffered output is written.
	fn flush() { }
}

//! An InputStream in which the source is a file.
class InputFDStream : InputStream
{
public:
	//! The underlying file descriptor.
	fd: i32;


public:
	//! Construct a new InputFDStream from a filename.
	this(filename: const(char)[]) { }
	//! Close the underlying file descriptor.
	fn close() { }
	//! Is this wrapping a valid file descriptor?
	fn isOpen() bool { }
	//! Read the first character from the file descriptor.
	fn get() dchar { }
	//! Read from the stream into buffer.
	fn read(buffer: u8[]) u8[] { }
	//! Has this descriptor reached EOF?
	fn eof() bool { }
}

watt.io.streams.stdc

//! Stream implementations in which the underlying implementation is libc
//! FILEs.
module watt.io.streams.stdc;


//! An OutputStream in which the sink is a file.
class OutputStdcStream : OutputStream
{
public:
	//! The underlying FILE handle.
	handle: FILE*;


public:
	//! Construct a new OutputStdcStream from a filename. This will use the
	//! mode string "w", so will overwrite any file with the given name that
	//! already exists.
	this(filename: const(char)[]) { }
	//! Construct a new OutputStdcStream with a filename, using the given mode
	//! string.
	this(filename: const(char)[], flags: const(char)[]) { }
	//! Close the underlying FILE handle.
	fn close() { }
	//! Is this stream open?
	fn isOpen() bool { }
	//! Write a single character to the stream.
	fn put(c: dchar) { }
	//! Write a string to the stream.
	fn write(s: scope (const(scope (char)[])) { }
	//! Ensure all buffered input is written to the stream.
	fn flush() { }
}

//! An InputStream in which the source is a file.
class InputStdcStream : InputStream
{
public:
	//! The underlying FILE handle.
	handle: FILE*;


public:
	//! Construct a new stream from a filename.
	this(filename: const(char)[]) { }
	//! Construct a new InputStdcStream with a filename, using the given mode
	//! string.
	this(filename: const(char)[], flags: const(char)[]) { }
	//! Close the underlying FILE handle.
	fn close() { }
	//! Is this stream open?
	fn isOpen() bool { }
	//! Read a single character from this stream.
	fn get() dchar { }
	//! Read from the stream into buffer.
	fn read(buffer: u8[]) u8[] { }
	//! Has this stream reached EOF?
	fn eof() bool { }
}

watt.io.streams

//! Stream interfaces for input and output.
module watt.io.streams;

public import watt.io.streams.fd;
public import watt.io.streams.stdc;


//! An implementation of the InputStream for files.
alias InputFileStream = InputFDStream;
//! An implementation of the OutputStream for files.
alias OutputFileStream = OutputFDStream;

//! OutputStreams write data to a destination (file, console, etc) in
//! characters.
class OutputStream
{
public:
	this() { }
	//! Close the stream.
	fn close();
	//! Determine the stream state.
	fn isOpen() bool;
	//! Write a single character out to the sink.
	fn put(c: dchar);
	//! Write a series of characters to the sink.
	fn write(s: scope (const(scope (char)[])) { }
	//! Ensure that all pending writes (from the put and write functions) are
	//! completed.
	fn flush();
	//! Write a series of characters then a newline.
	fn writeln(s: const(char)[]) { }
	fn vwritef(formatString: const(char)[], typeids: TypeInfo[], vl: va_list) { }
	//! Write a formatted string.
	fn writef(formatString: const(char)[]) { }
	fn vwritefln(formatString: const(char)[], typeids: TypeInfo[], vl: va_list) { }
	//! Write a formatted string and then a newline.
	fn writefln(formatString: const(char)[]) { }
}

//! InputStreams read data in characters from a source (file, device,
//! etc).
class InputStream
{
public:
	this() { }
	//! Close this stream.
	fn close();
	//! Determine this stream's state.
	fn isOpen() bool;
	//! Read a single character from the source.
	fn get() dchar;
	//! Read as much data as possible into buffer.
	fn read(buffer: u8[]) u8[];
	//! Is the source out of data?
	fn eof() bool;
	//! Read input until a newline character is encountered.
	fn readln() string { }
}

watt.io.seed

//! Get a random 32 bit number from the Operating System.
module watt.io.seed;


//! Get a random unsigned 32 bit integer.
fn getHardwareSeedU32() u32 { }

watt.io

//! The io package deals with input and output.
module watt.io;

public import watt.io.std;

watt.io.std

//! Standard streams and simple utility functions.
module watt.io.std;


//! An OutputFileStream that outputs to stdout.
global output: OutputFileStream;
//! An OutputFileStream that outputs to stderr.
global error: OutputFileStream;
//! An InputFileStream that reads from stdin.
global input: InputFileStream;

//! Write s to output.
fn write(s: const(char)[]) { }
//! Write s to output, then write a newline character.
fn writeln(s: const(char)[]) { }
//! Write the string representation of an i32 to output.
fn writeln(i: i32) { }
//! Write the string representation of a size_t to output.
fn writeln(i: size_t) { }
//! Write the string representation of a bool to output.
fn writeln(b: bool) { }
//! Write a newline to output.
fn writeln() { }
//! Format a string and write it to output.
fn writef(s: const(char)[]) { }
//! Format a string, write it to output, then output a newline.
fn writefln(s: const(char)[]) { }
//! Read text from input.
fn readln() string { }

watt.io.monotonic

//! Get precise timing information from the OS.
module watt.io.monotonic;


//! Get the ticks from the OS in an i64.
alias ticks = vrt_monotonic_ticks;

//! How many ticks (from the ticks function) are in a second.
global ticksPerSecond: i64;

//! Convert a time from one frequency to another.
fn convClockFreq(ticks: i64, srcTicksPerSecond: i64, dstTicksPerSecond: i64) i64 { }
//! Initialises the ticksPerSecond value.
fn __ctor() { }

watt.io.file

//! Simple file handling functions.
module watt.io.file;


//! Tell searchDir what to do after calling your delegate.
enum SearchStatus
{
	//! Call the delegate for any further entries.
	Continue,
	//! Stop searching; don't call the delegate further.
	Halt,
}

//! Thrown when a filesystem operation fails.
class FileException : Exception
{
public:
	this(msg: string) { }
}

//! Read a file into an array.
fn read(filename: scope (SinkArg)) void[] { }
//! Write an array of data to a file.
fn write(data: void[], filename: scope (SinkArg)) { }
//! Get the size of a file.
fn size(filename: scope (SinkArg)) size_t { }
//! Check if path matches pattern.
fn globMatch(path: string, pattern: string) bool { }
//! Call a delegate for a file in a directory that matches a given
//! pattern.
fn searchDir(dirName: string, glob: string, dgt: scope (SearchStatus delegate(string))) { }
//! Is a given path a file?
fn isFile(path: scope (SinkArg)) bool { }
//! Is a given path a directory?
fn isDir(path: scope (const(scope (char)[])) bool { }
//! Does a given path exist?
fn exists(path: const(char)[]) bool { }
//! Rename a file or directory.
fn rename(oldname: string, newname: string) { }
//! Delete a file pointed to by a given path.
fn remove(path: const(char)[]) { }
//! Change the current working directory of the calling process.
fn chdir(path: const(char)[]) { }
//! Get the current working directory of the calling process.
fn getcwd() string { }

watt.math.random

//! A psuedo-random number generator.
module watt.math.random;


//! The default RandomGenerator.
alias RandomGenerator = MersenneTwisterEngine;

//! A psuedorandom number generator implemented with the Mersenne Twister
//! algorithm.
struct MersenneTwisterEngine
{
public:
	//! The smallest unsigned value this generator can generate.
	enum min;
	//! The largest unsigned value this generator can generate.
	enum max;


public:
	//! Seed this generator with the given 32 bit value.
	fn seed(value: u32) { }
	//! Advance this generator.
	fn popFront() { }
	//! This generator's current value.
	fn front() u32 { }
	//! Copy this generator.
	fn save() MersenneTwisterEngine { }
	//! Is this generator out of values?
	fn empty() bool { }
	//! Generate a u32 value within a range.
	fn uniformU32(lower: u32, upper: u32) u32 { }
	//! Generate an i32 value within a range.
	fn uniformI32(lower: i32, upper: i32) i32 { }
	//! Generate a random string.
	fn randomString(length: size_t) string { }
}

watt.math.integer

//! Integer maths functions.
module watt.math.integer;


//! Returns the log2 fo the given unsigned integer, does not throw on 0.
fn log2(x: u32) u32 { }
//! Returns the absolute value of a signed integer.
fn abs(x: i32) i32 { }

watt.math.introspection

//! Determine if floating points are special constants.
module watt.math.introspection;


//! Is the given value signalling NaN?
fn isnan(d: f64) i32 { }
//! Is the given value signalling NaN?
fn isnan(f: f32) i32 { }
//! Is the given value signalling infinity?
fn isinf(d: f64) i32 { }
//! Is the given value signalling infinity?
fn isinf(f: f32) i32 { }

watt.math

//! Fundamental math functions.
module watt.math;

public import watt.math.integer;
public import watt.math.floating;
public import watt.math.introspection;

watt.math.floating

//! Floating point maths functions.
module watt.math.floating;


//! The number PI as a constant.
enum PIf;
//! The number PI as a constant.
enum PI;

//! Calculate the sine function of a number.
alias sin = sinf;
//! Calculate the cosine function of a number.
alias cos = cosf;
//! Calculate the tangent function of a number.
alias tan = tanf;
//! Calculate the square root of a number.
alias sqrt = sqrtf;

//! Calculate the sine function of a number.
fn sin(f64) f64;
//! Calculate the sine function of a number.
fn sinf(f32) f32;
//! Calculate the cosine function of a number.
fn cos(f64) f64;
//! Calculate the cosine function of a number.
fn cosf(f32) f32;
//! Calculate the tangent function of a number.
fn tan(f64) f64;
//! Calculate the tangent function of a number.
fn tanf(f32) f32;
//! Calculate the square root of a number.
fn sqrt(f64) f64;
//! Calculate the square root of a number.
fn sqrtf(f32) f32;
//! Convert radians into degrees.
fn radians(degs: f64) f64 { }
//! Convert degrees into radians.
fn degrees(rads: f64) f64 { }
//! Round a value down.
fn floor(f32) f32;
//! Round a value down.
fn floor(f64) f64;
//! Round a value up.
fn ceil(f32) f32;
//! Round a value up.
fn ceil(f64) f64;
//! Round a value to the nearest integer.
fn round(f32) f32;
//! Round a value to the nearest integer.
fn round(f64) f64;
//! Raise the value to the given (positive or negative) power.
fn pow(value: f32, power: f32) f32;
//! Raise the value to the given (positive or negative) power.
fn pow(value: f64, power: f64) f64;
fn abs(f32) f32;
fn abs(f64) f64;

watt.xdg.basedir

//! Retrieve paths to XDG standard directories.
module watt.xdg.basedir;


//! Get the config dirs values.
fn getConfigDirs() string[] { }
//! Get the configuration home value.
fn getConfigHome() string { }
//! Get the data dirs values.
fn getDataDirs() string[] { }
//! Get the data home value.
fn getDataHome() string { }
//! Find a configuration file.
fn findConfigFile(tail: string) string[] { }

watt.process.pipe

//! Functions for dealing with pipes.
module watt.process.pipe;


enum BufferSize;

//! Run the given command and read back the output/error into a string.
fn getOutput(cmd: string, args: string[]) string { }
//! Run the given command and read back the output/error into a string.
fn getOutput(cmd: string, args: string[], retval: u32) string { }

watt.process.environment

//! Functions for dealing with environmental variables.
module watt.process.environment;


//! Holds environment values.
class Environment
{
public:
	store: string[string];


public:
	this() { }
	//! Is the given key set?
	fn isSet(key: string) bool { }
	//! Get the given key, or return null.
	fn getOrNull(key: string) string { }
	//! Set a key in this environment.
	fn set(key: string, value: string) { }
	//! Remove a key from this environment.
	fn remove(key: string) { }
}

//! Returns an environment that is a copy of the running process'
//! environment.
fn retrieveEnvironment() Environment { }

watt.process.spawn

//! Functions for starting a process.
module watt.process.spawn;


//! Serves as a handle to a spawned process.
class Pid
{
public:
	alias OsHandle = pid_t;
	alias _pid = osHandle;
	alias NativeID = OsHandle;


public:
	osHandle: OsHandle;


public:
	this(osHandle: OsHandle) { }
	//! Wait for this process to finish, and get the return value.
	fn wait() i32 { }
}

//! Thrown if a process could not be spawned.
class ProcessException : Exception
{
public:
	this(msg: string) { }
}

//! Search the current working directory and PATH for the given command.
fn getCommandFromName(name: string) string { }
//! Start a process from the executable name and with the given args.
fn spawnProcess(name: string, args: string[]) Pid { }
//! Start a process from an executable.
fn spawnProcess(name: string, args: string[], inputStream: InputStdcStream, outputStream: OutputStdcStream, errorStream: OutputStdcStream, env: Environment) Pid { }
//! Start a process from an executable.
fn spawnProcess(name: string, args: string[], inputStream: InputFDStream, outputStream: OutputFDStream, errorStream: OutputFDStream, env: Environment) Pid { }
fn spawnProcess(name: string, args: string[], _stdin: FILE*, _stdout: FILE*, _stderr: FILE*, env: Environment) Pid { }
//! Search a PATH string for a command. If one is not given, PATH will be
//! retrieved and used.
fn searchPath(cmd: string, path: string) string { }
//! Get an environmental variable, or "" if it doesn't exist.
fn getEnv(env: string) string { }
//! Run a command through the libc system function.
fn system(name: string) i32 { }
fn spawnProcessPosix(name: string, args: string[], stdinFD: i32, stdoutFD: i32, stderrFD: i32, env: Environment) i32 { }
//! Wait for a specific process.
fn waitPosix(pid: pid_t) i32 { }
//! Wait for a process.
fn waitManyPosix(pid: pid_t) i32 { }

watt.process.cmd

//! Functions for parsing a command string.
module watt.process.cmd;


//! Surround the string with " and escape " and /.
fn escapeAndAddQuotation(sink: scope (Sink), str: scope (SinkArg)) { }
//! Returns a textual representation of cmd and args that can be passed to
//! "/bin/sh -c".
fn toArgsPosix(cmd: scope (SinkArg), args: scope (SinkArg)[]) char* { }
//! As normal toArgsPosix, but adds redirect after cmd with no processing.
fn toArgsPosix(cmd: scope (SinkArg), args: scope (SinkArg)[], redirect: scope (SinkArg)) char* { }
//! Parse a string as a series of arguments, like bash/make does.
fn parseArguments(str: scope (SinkArg)) string[] { }

watt.process

//! Modules for spawning new processes, reading environmental variables,
//! running and capturing the output of a command.
module watt.process;

public import watt.process.cmd;
public import watt.process.pipe;
public import watt.process.spawn;
public import watt.process.group;
public import watt.process.environment;
public import watt.process.util;

watt.process.util

module watt.process.util;


//! Get the process id of the calling process.
fn getpid() u32 { }

watt.process.group

//! Launch and manage multiple processes.
module watt.process.group;


//! Helper class to launch one or more processes to run along side the main
//! process.
class Group
{
public:
	//! Is called with the retval of the completed command.
	alias DoneDg = void delegate(i32);


public:
	this(maxWaiting: u32) { }
	fn run(name: string, args: string[], done: DoneDg) Pid { }
	fn run(name: string, args: string[], inputStream: InputStdcStream, outputStream: OutputStdcStream, errorStream: OutputStdcStream, env: Environment, done: DoneDg) Pid { }
	fn run(name: string, args: string[], inputStream: FILE*, outputStream: FILE*, errorStream: FILE*, env: Environment, done: DoneDg) Pid { }
	fn run(name: string, args: string[], inputStream: InputFDStream, outputStream: OutputFDStream, errorStream: OutputFDStream, env: Environment, done: DoneDg) Pid { }
	fn run(name: string, args: string[], inputFD: i32, outputFD: i32, errorFD: i32, env: Environment, done: DoneDg) Pid { }
	fn waitOne() { }
	//! Wait for all currently dispatched processes to complete.
	fn waitAll() { }
}

watt.process.sink

module watt.process.sink;


struct CStrSink
{
public:
	strStorage: char[262144];
	ptrStorage: char*[4096];
	strLoc: size_t;
	ptrLoc: size_t;


public:
	fn addArgz(str: scope (SinkArg)) bool { }
	fn addEnvz(key: scope (SinkArg), value: scope (SinkArg)) bool { }
}

watt.conv

//! Functions dealing with converting strings to integers, integers to
//! strings, integers to different types of integers, and so on.
module watt.conv;


//! Thrown when a conversion fails.
class ConvException : Exception
{
public:
	this(msg: string) { }
}

//! Get the lowercase representation of a string.
fn toLower(s: scope (StrArg)) string { }
//! Get the uppercase representation of a string.
fn toUpper(s: scope (StrArg)) string { }
//! Parse s as an integer, and return it as a u64.
fn toUlong(s: const(char)[], base: i32) u64 { }
//! Parse s as an integer, and return it as an i64.
fn toLong(s: const(char)[], base: i32) i64 { }
//! Parse s as an integer, and return it as an i32.
fn toInt(s: const(char)[], base: i32) i32 { }
//! Parse s as an integer, and return it as a u32.
fn toUint(s: const(char)[], base: i32) u32 { }
//! Get a string from a given u8.
fn toString(val: u8) string { }
//! Return an i8 as a string.
fn toString(val: i8) string { }
//! Return a u16 as a string.
fn toString(val: u16) string { }
//! Return an i16 as a string.
fn toString(val: i16) string { }
//! Return a u32 as a string.
fn toString(val: u32) string { }
//! Return an i32 as a string.
fn toString(val: i32) string { }
//! Return a u64 as a string.
fn toString(val: u64) string { }
//! Return an i64 as a string.
fn toString(val: i64) string { }
//! Return an f32 as a string.
fn toString(f: f32) string { }
//! Return an f64 as a string.
fn toString(f: f64) string { }
//! Return a pointer as a string.
fn toString(p: void*) string { }
//! Return a bool as "true" or "false".
fn toString(b: bool) string { }
//! Returns an upper case hex string from the given unsigned long.
fn toStringHex(val: u64) string { }
//! Given a u8, return a binary string.
fn toStringBinary(val: u8) string { }
//! Given a u16, return a binary string.
fn toStringBinary(val: u16) string { }
//! Given a u32, return a binary string.
fn toStringBinary(val: u32) string { }
//! Given a u64, return a binary string.
fn toStringBinary(val: u64) string { }
//! Given an i8, return a binary string.
fn toStringBinary(val: i8) string { }
//! Given an i16, return a binary string.
fn toStringBinary(val: i16) string { }
//! Given an i32, return a binary string.
fn toStringBinary(val: i32) string { }
//! Given an i64, return a binary string.
fn toStringBinary(val: i64) string { }
//! Given a Volt utf-8 string s, return a pointer to a null terminated
//! string.
fn toStringz(s: scope (SinkArg)) const(char)* { }
//! Given a Volt utf-16 string s, return a pointer to a null terminated
//! wchar string.
fn toStringz(s: const(wchar)[]) const(wchar)* { }
//! Given a null terminated string s, return a Volt string.
fn toString(s: scope (const(scope (char)*)) string { }
//! Return a string as an f32.
fn toFloat(s: string) f32 { }
//! Return a string as an f64.
fn toDouble(s: string) f64 { }

watt.path

//! Simple functions for dealing with paths, finding the path to the
//! currently running executable, returning the extension of a filename,
//! getting a full path from a relative path, and so on.
module watt.path;


enum dirSeparator;
enum pathSeparator;

//! Create a directory.
//! If the given directory exists, this function succeeds.
fn mkdir(dir: const(char)[]) { }
//! Create a directory and any intermediate directories.
//! Uses the dirSeparator string for the appropriate platform.
fn mkdirP(dir: const(char)[]) { }
//! Is c a path separator for this platform?
//! This is different to checking against dirSeparator because Windows
//! allows both forward and backward slashes in paths, whereas *nix only
//! allows forward ones.
fn isSlash(c: char) bool { }
//! Count how many path separators are in a given string.
fn countSlashes(s: const(char)[]) size_t { }
//! Remove any trailing path separators from s.
fn removeTrailingSlashes(s: const(char)[]) { }
//! Return the directory portion of a pathname.
fn dirName(path: const(char)[]) string { }
//! Return the non-directory portion of a pathname.
fn baseName(path: const(char)[], suffix: const(char)[]) string { }
//! Return the file extension of a path, or an empty string.
fn extension(path: const(char)[]) string { }
//! Get a temporary filename in the temp directory for the current
//! platform.
fn temporaryFilename(extension: string, subdir: string) string { }
//! Given a path, return an absolute path.
fn fullPath(file: string) string { }
//! Get the path to the executable.
fn getExecFile() string { }
//! Get the directory that the current executable is in.
fn getExecDir() string { }

watt.http

//! A simple interface for making HTTP requests.
module watt.http;

public import watt.http.curl;


enum Status
{
	Continue,
	Abort,
}

//! Manage multiple HTTP requests.
interface HttpInterface
{
public:
	fn isEmpty() bool;
	//! Launch new requests, and mark requests that are complete.
	fn perform();
	//! Complete all requests.
	fn loop(cb: Status delegate());
}

//! An HTTP request.
class RequestInterface
{
public:
	//! The address of the server to connect to.
	server: string;
	//! The url to connect to on the server.
	url: string;
	//! The port to connect to the remote server with.
	port: u16;
	//! Should this request use HTTPS?
	secure: bool;


public:
	//! Construct a new Request that is managed by http.
	this(http: HttpInterface) { }
	//! Get the result of the request.
	fn getData() void[];
	//! Get the result of the request as a string.
	fn getString() string;
	//! Has this request completed?
	fn completed() bool;
	//! Was an error generated for this request?
	fn errorGenerated() bool;
	//! Get an error string.
	fn errorString() string;
	//! How many bytes have been downloaded so far?
	fn bytesDownloaded() size_t;
	//! How big is the content? If unknown, this is zero.
	fn contentLength() size_t;
}

watt.http.windows

//! Windows implementation of Http requests.
module watt.http.windows;

watt.http.curl

//! A libcurl implementation of HTTP requests.
module watt.http.curl;


//! Curl implementation of HttpInterface.
class Http : HttpInterface
{
public:
	this() { }
	fn isEmpty() bool { }
	fn perform() { }
	fn loop(cb: Status delegate()) { }
}

//! Curl implementation of RequestInterface.
class Request : RequestInterface
{
public:
	this(http: Http) { }
	fn getData() void[] { }
	fn getString() string { }
	fn completed() bool { }
	fn errorGenerated() bool { }
	fn errorString() string { }
	fn bytesDownloaded() size_t { }
	fn contentLength() size_t { }
}

fn request_progress(clientp: void*, dltotal: curl_off_t, dlnow: curl_off_t, ultotal: curl_off_t, ulnow: curl_off_t) i32 { }

watt.json.dom

//! Parse a JSON file into memory.
module watt.json.dom;


//! Identifies the JSON type of a Value.
enum DomType
{
	//! A JSON value of null.
	Null,
	//! A JSON value of true or false.
	Boolean,
	//! A JSON value of a number with a decimal portion.
	Double,
	//! A JSON value of a signed integer.
	Long,
	//! A JSON value of an unsigned integer.
	Ulong,
	//! A JSON string.
	String,
	//! A JSON object, everything between {}.
	Object,
	//! A JSON array, everything between [].
	Array,
}

//! Thrown upon a parsing error.
class DOMException : JSONException
{
public:
	this(msg: string, location: string) { }
}

//! A JSON value.
struct Value
{
public:
	union Store
	{
	public:
		boolean: bool;
		str: immutable(char)[];
		integer: i64;
		unsigned: u64;
		floating: f64;
	}


public:
	fn type() DomType { }
	//! Is this Value a JSON null type?
	fn isNull() bool { }
	//! Set the type to null.
	fn setNull() { }
	//! Get this as a boolean value.
	fn boolean() bool { }
	//! Set this Value as a DomType.Boolean, and give it the value b.
	fn boolean(b: bool) { }
	//! Get this as a string value.
	fn str() string { }
	//! Set this Value as a DomType.String, and give it the value s.
	fn str(s: const(char)[]) { }
	//! Get this as an integer value.
	fn integer() i64 { }
	//! Set this Value as a DomType.Long, and give it the value l.
	fn integer(l: i64) { }
	//! Get this as an unsigned integer value.
	fn unsigned() u64 { }
	//! Set this Value as a DomType.Ulong, and give it the value l.
	fn unsigned(l: u64) { }
	//! Get this as a floating point value.
	fn floating() f64 { }
	//! Set this Value as a DomType.Double, and give it the value d.
	fn floating(d: f64) { }
	//! Get this as an array of Value.
	fn array() Value[] { }
	//! Set this Value as a DomType.Array, and give it the value array.
	fn array(array: Value[]) { }
	//! Add val to this Value's array.
	fn arrayAdd(val: Value) { }
	//! Set type as DomType.Array.
	fn setArray() { }
	//! Retrieve a key from this Value.
	fn lookupObjectKey(s: string) Value { }
	//! Does this object have a key s?
	fn hasObjectKey(s: string) bool { }
	//! Set this Value as an object, and set a key.
	fn setObjectKey(k: string, v: Value) { }
	//! Set type as DomType.Object.
	fn setObject() { }
	//! Retrieve all the keys associated with this Value.
	fn keys() string[] { }
	//! Retrieve all the values associated with this Value.
	fn values() Value[] { }
}

//! Parse a JSON string into a Value.
fn parse(s: string) Value { }

watt.json

//! Modules for parsing JSON.
module watt.json;

public import watt.json.util;
public import watt.json.sax;
public import watt.json.dom;

watt.json.sax

//! Parse JSON as a stream.
module watt.json.sax;


//! Type of a JSON value.
enum Type
{
	//! A JSON null value.
	NULL,
	//! A JSON true or false value.
	BOOLEAN,
	//! A JSON number.
	NUMBER,
	//! A JSON string.
	STRING,
	//! A JSON object, everything between {}.
	OBJECT,
	//! A JSON array, everything between [].
	ARRAY,
}

//! Events which will be produced by get.
enum Event
{
	//! The first event, marks the start of the JSON data.
	START,
	//! The last event, marks the end of the JSON data.
	END,
	//! Event which will occour if invalid JSON is encountered.
	ERROR,
	//! A null was encountered.
	NULL,
	//! A boolean was encountered.
	BOOLEAN,
	//! A number was encountered.
	NUMBER,
	//! A string was encountered.
	STRING,
	//! The start of a JSON object was encountered.
	OBJECT_START,
	//! A JSON object key was encountered (this is a string and still needs to
	//! be unescaped).
	OBJECT_KEY,
	//! The end of a JSON object was encountered.
	OBJECT_END,
	//! The start of a JSON array was encountered.
	ARRAY_START,
	//! The end of a JSON array was encountered.
	ARRAY_END,
}

//! Thrown when an error occurs during building.
class BuilderException : util.JSONException
{
public:
	this(msg: string, location: string) { }
}

//! Parses JSON from a given InputStream.
class SAX
{
public:
	//! Ignore garbage/left over data after the root element is parsed.
	ignoreGarbage: bool;


public:
	//! Creates a JSON object from an InputStream.
	this(source: InputStream, bufferSize: size_t, reallocSize: size_t) { }
	//! Creates a JSON object from an array.
	this(data: const(u8)[]) { }
	//! Creates a JSON object from a string.
	this(data: const(char)[]) { }
	//! Continues parsing the input data and calsl the callback with the
	//! appropriate data.
	fn get(callback: scope (void delegate(Event, const(u8)[]))) { }


protected:
	source: InputStream;
	buffer: u8[];
	reallocSize: size_t;
	current: const(u8)[];
	index: size_t;
	savedMark: size_t;
	isMarked: bool;
	state: ParserStack;
	lastError: string;


protected:
	fn error(message: string, file: string, line: const(i32)) { }
	fn eof() bool { }
	fn mark() { }
	fn retrieve() const(u8)[] { }
	fn getImpl(c: char, skip: bool, advance: bool) bool { }
	fn unget() { }
	fn skipWhite() { }
	fn skipDigits() bool { }
	fn expect(c: char, skip: bool) bool { }
	fn getString(array: const(u8)[]) bool { }
	fn getNumber(array: const(u8)[]) bool { }
	fn getBoolean(array: const(u8)[]) bool { }
	fn getNull(array: const(u8)[]) bool { }
}

//! The main class to build/write JSON.
class Builder
{
public:
	//! Creates a new JSONBuilder object.
	this(output: OutputStream, prettyPrint: bool, indent: const(char)[]) { }
	//! Writes a null value.
	fn buildNull() { }
	//! Writes a number.
	fn buildNumber(number: f64) { }
	//! Writes a number.
	fn buildNumber(number: i32) { }
	//! Writes a number.
	fn buildNumber(number: i64) { }
	//! Writes a string.
	fn buildString(str: const(char)[], escape: bool) { }
	//! Writes a boolean.
	fn buildBoolean(b: bool) { }
	//! Writes the start of a JSON object.
	fn buildObjectStart() { }
	//! Writes the end of a JSON object.
	fn buildObjectEnd() { }
	//! Writes the start of a JSON array.
	fn buildArrayStart() { }
	//! Writes the end of a JSON array.
	fn buildArrayEnd() { }
	//! Finalizes the JSON.
	fn finalize() { }


protected:
	output: OutputStream;
	prettyPrint: bool;
	indent: const(char)[];
	indentLevel: size_t;
	buffer: char[];
	state: ParserStack;


protected:
	fn prepareAndCheck(isString: bool) { }
}

//! Turn an Event into a human readable string.
fn eventToString(event: Event) string { }

watt.json.util

//! Useful functions when dealing with JSON.
module watt.json.util;


//! Base Exception for the whole json package.
class JSONException : Exception
{
public:
	this(msg: string, location: string) { }
}

//! Exception thrown when an error occurs during parsing.
class ParseException : JSONException
{
public:
	this(msg: string, location: string) { }
}

fn canBeInteger(data: const(char)[], signed: bool) bool { }
//! Parse a u64 from a JSON number string.
fn parseUlong(data: const(char)[], l: u64) bool { }
//! Parse an i64 from a JSON number string. Returns true if a double was
//! parsed.
fn parseLong(data: const(char)[], l: i64) bool { }
//! Parse a double from a JSON number string.
fn parseDouble(data: const(char)[], d: f64) bool { }
//! Parse a double from a JSON number string, using a pre allocated
//! buffer, resizing it if needed.
fn parseDouble(data: const(char)[], d: f64, buffer: char[]) bool { }
fn parseBool(data: const(char)[]) bool { }
//! Unescape a JSON string and return it.
fn unescapeString(str: const(char)[]) const(char)[] { }
//! Unescape a JSON string and return it.
fn unescapeString(str: const(u8)[]) const(char)[] { }
//! Unescape a JSON string and return it, using a pre allocated buffer and
//! resizing it if needed.
fn unescapeString(str: const(char)[], buffer: char[]) const(char)[] { }
//! Escape a JSON string and return it.
fn escapeString(str: const(char)[]) const(char)[] { }
//! Escape a JSON string and return it, using a pre allocated buffer and
//! resizing it if needed.
fn escapeString(str: const(char)[], buffer: char[]) const(char)[] { }

watt.toml.tree

//! Uses the event parser to parse TOML into a tree in memory.
module watt.toml.tree;


//! A TOML Value.
class Value
{
public:
	//! Each TOML Value is typed with one of these types.
	enum Type
	{
		//! A series of characters.
		String,
		//! A 64 bit signed integer.
		Integer,
		//! A 64 bit floating point number.
		Float,
		//! A boolean value is true or false.
		Boolean,
		//! An array of Values of the same type.
		Array,
		//! A table of Values, indexed by string.
		Table,
	}


public:
	//! The type of this Value.
	type: Type;
	//! Any comments that appeared before this value.
	comment: string;
	//! If this is a table, was it inline? (Affects toString functions).
	inline: bool;
	//! If this is an array, should it appear before the table it's nested in?
	hoist: bool;


public:
	//! Construct a Value with no type.
	this() { }
	//! Construct a Value with a string type.
	this(v: string) { }
	//! Construct a Value with an integer type.
	this(v: i64) { }
	//! Construct a Value with an integer type.
	this(v: i32) { }
	//! Construct a Value with a floating point type.
	this(v: f64) { }
	//! Construct a Value with a boolean type.
	this(v: bool) { }
	//! Construct an array of Values.
	this(v: Value[]) { }
	//! Get the keys for this table.
	fn tableKeys() string[] { }
	//! Get the Values set for this table.
	fn tableValues() Value[] { }
	//! If this is a table, remove the given key, if it is set.
	fn removeKey(key: string) { }
	//! Get a string representation of the value.
	fn toString() string { }
	//! Add the string representation of this Value to the given sink.
	fn toString(sink: scope (sink.Sink), parent: string) { }
	//! Retrieve the string value.
	fn str() string { }
	//! Set the string value.
	fn str(val: string) { }
	//! Retrieve the integer value.
	fn integer() i64 { }
	fn integer(val: i64) { }
	//! Retrieve the floating value.
	fn floating() f64 { }
	//! Set the floating value.
	fn floating(val: f64) { }
	//! Retrieve the boolean value.
	fn boolean() bool { }
	//! Set the boolean value.
	fn boolean(val: bool) { }
	//! Retrieve the array value.
	fn array() Value[] { }
	//! Set a table entry.
	fn tableEntry(k: string, v: Value) { }
	//! Set the array value.
	fn array(vals: Value[]) { }
	//! How many keys does this table have set?
	fn countKeys() size_t { }
	//! Does this table have a key?
	fn hasKey(key: string) bool { }
	//! Retrieve a key from this table.
	fn opIndex(key: string) Value { }
}

//! Given a TOML document, return a Value that represents that document.
fn parse(src: string) Value { }

watt.toml

//! Package module for Watt's TOML parser.
module watt.toml;

public import watt.toml.event;
public import watt.toml.tree;
public import watt.toml.util;

watt.toml.util

module watt.toml.util;


//! Thrown on input error.
class TomlException : rt.Exception
{
public:
	this(msg: string) { }
}

fn match(src: source.SimpleSource, c: dchar) { }
//! If p.src is at c, eat it and return true. Otherwise, return false.
fn matchIf(src: source.SimpleSource, c: dchar) bool { }
fn atTripleString(src: source.SimpleSource) bool { }
fn skipIfNewline(src: source.SimpleSource) { }
fn parseMultilineString(src: source.SimpleSource) string { }
fn parseString(src: source.SimpleSource) string { }
fn escapeString(unescaped: string, multiline: bool) string { }

watt.toml.event

//! Event driven TOML parser, a la SAX.
module watt.toml.event;


//! Interface for toml string consumers.
interface EventSink
{
public:
	//! Signals the start of content.
	fn start();
	//! Signals the end of content.
	fn end();
	//! Signals the start of a comment. Comment value is sent via 
	//! stringContent.
	fn commentStart();
	//! Signals the end of a comment.
	fn commentEnd();
	//! Signals the start of a key/value pair.
	fn keyValueStart(key: string);
	//! Signals the end of a key/value pair.
	fn keyValueEnd(key: string);
	//! Signals the start of a table.
	fn tableStart(name: string);
	//! Signals the end of a table.
	fn tableEnd(name: string);
	//! Signals a table array.
	fn tableArray(name: string);
	//! Signals an inline table value start.
	fn inlineTableStart();
	//! Signals the end of an inline table value.
	fn inlineTableEnd();
	//! Signals the start of an array.
	fn arrayStart();
	//! Signals the end of an array.
	fn arrayEnd();
	//! Regular text content, used by multiple events.
	fn stringContent(str: string);
	//! Signed integer content.
	fn integerContent(i: i64);
	//! Boolean content.
	fn boolContent(b: bool);
	//! Floating point content.
	fn floatContent(n: f64);
}

//! A class that implements all the methods of EventSink by doing nothing.
class NullEventSink : EventSink
{
public:
	this() { }
	fn start() { }
	fn end() { }
	fn commentStart() { }
	fn commentEnd() { }
	fn keyValueStart(key: string) { }
	fn keyValueEnd(key: string) { }
	fn tableStart(name: string) { }
	fn tableEnd(name: string) { }
	fn tableArray(name: string) { }
	fn inlineTableStart() { }
	fn inlineTableEnd() { }
	fn arrayStart() { }
	fn arrayEnd() { }
	fn stringContent(str: string) { }
	fn integerContent(i: i64) { }
	fn boolContent(b: bool) { }
	fn floatContent(n: f64) { }
}

//! Given a TOML string input, call the appropriate methods on the given 
//! EventSink.
fn runEventSink(txt: string, esink: EventSink) { }

watt.markdown.html

//! Markdown HTML printer.
module watt.markdown.html;


//! Prints Markdown documents in format HTML.
class Html : Visitor
{
public:
	//! Are we in plain mode. This is used for images and links.
	plain: Node;
	//! Track if the last character written was a newline.
	lastNl: bool;


public:
	this() { }
	fn enter(n: Document, sink: scope (Sink)) { }
	fn leave(n: Document, sink: scope (Sink)) { }
	fn enter(n: BlockQuote, sink: scope (Sink)) { }
	fn leave(n: BlockQuote, sink: scope (Sink)) { }
	fn enter(n: Paragraph, sink: scope (Sink)) { }
	fn leave(n: Paragraph, sink: scope (Sink)) { }
	fn enter(n: Heading, sink: scope (Sink)) { }
	fn leave(n: Heading, sink: scope (Sink)) { }
	fn enter(n: List, sink: scope (Sink)) { }
	fn leave(n: List, sink: scope (Sink)) { }
	fn enter(n: Item, sink: scope (Sink)) { }
	fn leave(n: Item, sink: scope (Sink)) { }
	fn enter(n: Link, sink: scope (Sink)) { }
	fn leave(n: Link, sink: scope (Sink)) { }
	fn enter(n: Image, sink: scope (Sink)) { }
	fn leave(n: Image, sink: scope (Sink)) { }
	fn enter(n: Emph, sink: scope (Sink)) { }
	fn leave(n: Emph, sink: scope (Sink)) { }
	fn enter(n: Strong, sink: scope (Sink)) { }
	fn leave(n: Strong, sink: scope (Sink)) { }
	fn visit(n: HtmlBlock, sink: scope (Sink)) { }
	fn visit(n: CodeBlock, sink: scope (Sink)) { }
	fn visit(n: Text, sink: scope (Sink)) { }
	fn visit(n: Code, sink: scope (Sink)) { }
	fn visit(n: HtmlInline, sink: scope (Sink)) { }
	fn visit(n: Softbreak, sink: scope (Sink)) { }
	fn visit(n: Linebreak, sink: scope (Sink)) { }
	fn visit(n: ThematicBreak, sink: scope (Sink)) { }


protected:
	fn ln(sink: scope (Sink)) { }
	fn w(sink: scope (Sink), str: string) { }
	fn wln(sink: scope (Sink), str: string) { }
	fn getGrandparent() Node { }
	fn isGrandparentTightList() bool { }
	fn push(n: Document) { }
	fn push(n: BlockQuote) { }
	fn push(n: List) { }
	fn push(n: Item) { }
	fn push(n: Paragraph) { }
	fn push(n: Heading) { }
	fn push(n: Emph) { }
	fn push(n: Strong) { }
	fn push(n: Link) { }
	fn push(n: Image) { }
	fn pop(n: Document) { }
	fn pop(n: BlockQuote) { }
	fn pop(n: List) { }
	fn pop(n: Item) { }
	fn pop(n: Paragraph) { }
	fn pop(n: Heading) { }
	fn pop(n: Emph) { }
	fn pop(n: Strong) { }
	fn pop(n: Link) { }
	fn pop(n: Image) { }
	fn push(n: Node) { }
	fn pop(n: Node) { }
}

//! Print the given Markdown document in html format and return it as a
//! string.
fn printHtml(doc: Document) string { }
//! Print the given Markdown document in html format to the given sink.
fn printHtml(doc: Document, sink: scope (Sink)) { }

watt.markdown.xml

//! Xml exporter of ast, used for debugging.
module watt.markdown.xml;


//! Pure AST XML printer for Markdown.
class Xml : Visitor
{
public:
	indent: u32;


public:
	this() { }
	fn enter(str: string, sink: scope (Sink)) { }
	fn leave(str: string, sink: scope (Sink)) { }
	fn visit(str: string, sink: scope (Sink)) { }
	fn enter(n: Document, sink: scope (Sink)) { }
	fn leave(n: Document, sink: scope (Sink)) { }
	fn enter(n: BlockQuote, sink: scope (Sink)) { }
	fn leave(n: BlockQuote, sink: scope (Sink)) { }
	fn enter(n: Paragraph, sink: scope (Sink)) { }
	fn leave(n: Paragraph, sink: scope (Sink)) { }
	fn enter(n: Heading, sink: scope (Sink)) { }
	fn leave(n: Heading, sink: scope (Sink)) { }
	fn enter(n: List, sink: scope (Sink)) { }
	fn leave(n: List, sink: scope (Sink)) { }
	fn enter(n: Item, sink: scope (Sink)) { }
	fn leave(n: Item, sink: scope (Sink)) { }
	fn enter(n: Link, sink: scope (Sink)) { }
	fn leave(n: Link, sink: scope (Sink)) { }
	fn enter(n: Image, sink: scope (Sink)) { }
	fn leave(n: Image, sink: scope (Sink)) { }
	fn enter(n: Emph, sink: scope (Sink)) { }
	fn leave(n: Emph, sink: scope (Sink)) { }
	fn enter(n: Strong, sink: scope (Sink)) { }
	fn leave(n: Strong, sink: scope (Sink)) { }
	fn visit(n: HtmlBlock, sink: scope (Sink)) { }
	fn visit(n: CodeBlock, sink: scope (Sink)) { }
	fn visit(n: Text, sink: scope (Sink)) { }
	fn visit(n: Code, sink: scope (Sink)) { }
	fn visit(n: HtmlInline, sink: scope (Sink)) { }
	fn visit(n: Softbreak, sink: scope (Sink)) { }
	fn visit(n: Linebreak, sink: scope (Sink)) { }
	fn visit(n: ThematicBreak, sink: scope (Sink)) { }
}

//! Print the document as a xml ast, return it as a string.
fn printXml(doc: Document) string { }
//! Print the document as a XML AST to the given sink.
fn printXml(doc: Document, sink: scope (Sink)) { }

watt.markdown.phase2

//! Perform inline translation (headings, links, etc) on partially parsed
//! Markdown.
module watt.markdown.phase2;


//! Perform inline transformation.
class Phase2 : Visitor
{
public:
	this(links: LinkReference[string]) { }
	fn processEmphasis(children: Node[], stackBottom: DelimiterEntry) { }
	fn insert(parent: Parent, start: Text, payload: Node[], outputList: Node[]) { }
	fn replaceRange(parent: Parent, start: Text, end: Text, payload: Node[], outputList: Node[]) { }
	fn replaceNode(start: Text, node: Node, outputList: Node[]) { }
	fn doDelimiters(text: Text, replacement: Node[]) bool { }
	fn doDelimiters(children: Node[], sink: scope (Sink)) { }
	fn getLabel(src: Source) string { }
	fn getInlineReference(src: Source) LinkReference { }
	fn eatIfTag(src: Source, tag: string) bool { }
	fn eatRun(src: Source, run: string) bool { }
	fn enter(n: Document, sink: scope (Sink)) { }
	fn leave(n: Document, sink: scope (Sink)) { }
	fn enter(n: BlockQuote, sink: scope (Sink)) { }
	fn leave(n: BlockQuote, sink: scope (Sink)) { }
	fn enter(n: List, sink: scope (Sink)) { }
	fn leave(n: List, sink: scope (Sink)) { }
	fn enter(n: Item, sink: scope (Sink)) { }
	fn leave(n: Item, sink: scope (Sink)) { }
	fn enter(n: Paragraph, sink: scope (Sink)) { }
	fn leave(n: Paragraph, sink: scope (Sink)) { }
	fn enter(n: Heading, sink: scope (Sink)) { }
	fn leave(n: Heading, sink: scope (Sink)) { }
	fn enter(n: Emph, sink: scope (Sink)) { }
	fn leave(n: Emph, sink: scope (Sink)) { }
	fn enter(n: Link, sink: scope (Sink)) { }
	fn leave(n: Link, sink: scope (Sink)) { }
	fn enter(n: Image, sink: scope (Sink)) { }
	fn leave(n: Image, sink: scope (Sink)) { }
	fn enter(n: Strong, sink: scope (Sink)) { }
	fn leave(n: Strong, sink: scope (Sink)) { }
	fn visit(n: HtmlBlock, sink: scope (Sink)) { }
	fn visit(n: CodeBlock, sink: scope (Sink)) { }
	fn visit(n: ThematicBreak, sink: scope (Sink)) { }
	fn visit(n: Text, sink: scope (Sink)) { }
	fn visit(n: Softbreak, sink: scope (Sink)) { }
	fn visit(n: Linebreak, sink: scope (Sink)) { }
	fn visit(code: Code, sink: scope (Sink)) { }
	fn visit(n: HtmlInline, sink: scope (Sink)) { }
}

watt.markdown.lines

//! Split a file into line objects..
module watt.markdown.lines;


//! Represents a line of input.
struct Line
{
public:
	iterationCount: size_t;
	listCount: size_t;


public:
	fn set(str: string, idx: size_t) { }
	fn unchanged() bool { }
	fn toString() string { }
	fn empty() bool { }
	//! Length of the advanced portion.
	fn length() size_t { }
	//! Retrieve the nth character from the start.
	fn opIndex(n: size_t) char { }
	//! Return a slice of the advanced string, starting from a (inclusive),
	//! going to b (exclusive). If the slice is out of range, an empty string
	//! will be returned.
	fn slice(a: size_t, b: size_t) string { }
	//! Advance the line forward by n characters. Tabs encountered will be
	//! expanded. If n is greater than the rest of the line, the result will be
	//! an empty string.
	fn advance(n: size_t) { }
	fn leadingWhitespace() size_t { }
	fn realLeadingWhitespace() size_t { }
	fn realContiguousWhitespace(a: size_t) size_t { }
	fn contiguousWhitespace(a: size_t) size_t { }
	//! Call advance while this line is non-empty and starts with whitespace.
	fn consumeWhitespace() size_t { }
	//! Call advance if this line is non-empty and starts with a given
	//! character.
	fn consumeChar(c: char) bool { }
	//! Make this line empty.
	fn clear() { }
	//! Remove whitespace from both sides of the underlying string. The
	//! advanced string index is reset.
	fn strip() { }
	//! Replace a with b.
	fn replace(a: string, b: string) { }
	//! Remove (from the underlying string) any trailing whitespace
	//! characters.
	fn stripRight() { }
	fn removeLast() { }


public:
	//! Given a string, return a list of Line structures, split by the \n
	//! characters present in the string.
	static fn split(src: string) Line[] { }
}

watt.markdown

//! Parse Markdown into HTML.
module watt.markdown;


//! Given a markdown string, return a string of HTML.
fn filterMarkdown(src: string) string { }
//! Given a markdown string, put a string of HTML in a given Sink.
fn filterMarkdown(sink: scope (Sink), src: string) { }

watt.markdown.util

//! Utils for markdown AST.
module watt.markdown.util;


enum CODE_INDENT;

//! State for email validator.
enum EmailState
{
	BeforeAt,
	DomainStart,
	DomainBody,
}

//! Create a Document node and return it.
fn buildDocument() Document { }
//! Create a BlockQuote node, add it to children and return it.
fn addBlockQuote(children: Node[]) BlockQuote { }
//! Create a List node, add it to children and return it.
fn addList(children: Node[]) List { }
//! Create a Item node, add it to children and return it.
fn addItem(children: Node[]) Item { }
//! Create a CodeBlock node, add it to children and return it.
fn addCodeBlock(children: Node[], str: string, info: string) CodeBlock { }
//! Create a HtmlBlock node, add it to children and return it.
fn addHtmlBlock(children: Node[], str: string) HtmlBlock { }
//! Create an HtmlBlock node.
fn buildHtmlBlock() HtmlBlock { }
//! Create a Paragraph node, add it to children and return it.
fn addParagraph(children: Node[]) Paragraph { }
//! Create a Paragraph node, don't add it anywhere.
fn buildParagraph() Paragraph { }
//! Create a Heading node, add it to children and return it.
fn addHeading(children: Node[], level: u32) Heading { }
//! Create a Heading node, don't add it anywhere.
fn buildHeading(level: u32) Heading { }
//! Create a ThematicBreak node, add it to children and return it.
fn addThematicBreak(children: Node[]) ThematicBreak { }
//! Create a Text node, add it to children and return it.
fn addText(children: Node[], str: string) Text { }
//! Create a Text node, don't add it anywhere.
fn buildText(str: string) Text { }
//! Create a Softbreak node, add it to children and return it.
fn addSoftbreak(children: Node[]) Softbreak { }
//! Create a Linebreak node, add it to children and return it.
fn addLinebreak(children: Node[]) Linebreak { }
//! Create a Code node, add it to children and return it.
fn addCode(children: Node[], str: string) Code { }
//! Create a Code node.
fn buildCode(str: string) Code { }
//! Create an HtmlInline node, add it to children and return it.
fn addHtmlInline(children: Node[], str: string) HtmlInline { }
//! Build an HtmlInline node.
fn buildHtmlInline(str: string) HtmlInline { }
//! Create a Emph node, add it to children and return it.
fn addEmph(children: Node[]) Emph { }
//! Create a Emph node, don't add it anywhere.
fn buildEmph() Emph { }
//! Create a Strong node, don't add it anywhere.
fn buildStrong() Strong { }
//! Create a Strong node, add it to children and return it.
fn addStrong(children: Node[]) Strong { }
//! Create a Link node, add it to children and return it.
fn addLink(children: Node[], url: string, title: string) Link { }
//! Create a Link node.
fn buildLink() Link { }
//! Create a Link node.
fn buildLink(url: string, title: string) Link { }
//! Create a Image node, add it to children and return it.
fn addImage(children: Node[], url: string, title: string) Image { }
//! Build an Image node.
fn buildImage(url: string, alt: string, title: string) Image { }
//! Consume characters until a character is found.
fn consumeUntilChar(str: string, outStr: string, c: char) bool { }
//! Consume a link tag.
fn consumeTag(str: string, tag: string) bool { }
//! Consume one character.
fn consumeChar(str: string, c: char) bool { }
//! Consume whitespace.
fn consumeWhitespace(str: string) { }
//! Consume a URL.
fn consumeUrl(str: string, url: string) bool { }
//! Count the whitespace at the beginning of a string.
fn countLeadingWhitespace(str: string) size_t { }
//! Starting from i, count how much whitespace until the first
//! nonwhitespace character. If as much or more whitespace than maxLength
//! is counted, return immediately. Tabs count as 4.
fn countContiguousWhitespace(str: string, maxLength: size_t, i: size_t) size_t { }
//! Remove a delimiter length worth of characters from the front of str.
//! Taking into account tabs etc.
fn removeDelimiter(str: string, delimiter: size_t, forceFourTab: bool) string { }
//! Create a string filled with spaces len characters long.
fn emptyString(len: size_t) string { }
//! Create a string len characters long, filled with c characters.
fn uniformString(len: size_t, c: char) string { }
//! Get the string representation of a paragraph.
fn paragraphToString(p: Paragraph) string { }
fn markdownPunctuation(c: dchar) bool { }
//! Turn consecutive whitespace into a single whitespace.
fn collapseWhitespace(str: string) string { }
//! Escape a string using markdown escape rules.
fn markdownEscape(str: string) string { }
//! Build an AutoLink node.
fn makeAutoLink(url: string) Node { }
//! Build an EmailLink node.
fn makeEmailLink(url: string) Node { }
//! Build an AutoLinkNode.
fn makeStandaloneAutoLink(url: string) Node { }
fn isAbsoluteURI(str: string) bool { }
//! Percent encode a given url string. This isn't quite 'standard' in a few
//! ways:
fn urlEscape(str: string) string { }
//! Escape HTML entities.
fn htmlEntityEscape(str: string) string { }
fn isEmailAddress(str: string) bool { }
//! Is the string valid to be an HTML block?
fn validBlockHtml(str: string) bool { }
fn validInlineHtml(str: string) bool { }
//! Strip characters from a string hat are not allowed in image link
//! titles.
fn altStringPresentation(str: string) string { }
//! Replace an HTML entity with the correct unicode character.
fn replaceEntity(str: string) string { }

watt.markdown.ast

//! Main importer for markdown parser.
module watt.markdown.ast;


//! The type of node.
enum Type
{
	Document,
	BlockQuote,
	List,
	Item,
	CodeBlock,
	HtmlBlock,
	Paragraph,
	Heading,
	ThematicBreak,
	Text,
	Softbreak,
	Linebreak,
	Code,
	HtmlInline,
	Emph,
	Strong,
	Link,
	Image,
}

//! Base struct for all nodes.
class Node
{
public:
	type: Type;


public:
	this() { }
	fn toDocument() Document { }
	fn toBlockQuote() BlockQuote { }
	fn toList() List { }
	fn toItem() Item { }
	fn toCodeBlock() CodeBlock { }
	fn toHtmlBlock() HtmlBlock { }
	fn toParagraph() Paragraph { }
	fn toHeading() Heading { }
	fn toThematicBreak() ThematicBreak { }
	fn toText() Text { }
	fn toSoftbreak() Softbreak { }
	fn toLinebreak() Linebreak { }
	fn toCode() Code { }
	fn toHtmlInline() HtmlInline { }
	fn toEmph() Emph { }
	fn toStrong() Strong { }
	fn toLink() Link { }
	fn toImage() Image { }
	fn toParent() Parent { }
	fn toDocumentFast() Document { }
	fn toBlockQuoteFast() BlockQuote { }
	fn toListFast() List { }
	fn toItemFast() Item { }
	fn toCodeBlockFast() CodeBlock { }
	fn toHtmlBlockFast() HtmlBlock { }
	fn toParagraphFast() Paragraph { }
	fn toHeadingFast() Heading { }
	fn toThematicBreakFast() ThematicBreak { }
	fn toTextFast() Text { }
	fn toSoftbreakFast() Softbreak { }
	fn toLinebreakFast() Linebreak { }
	fn toCodeFast() Code { }
	fn toHtmlInlineFast() HtmlInline { }
	fn toEmphFast() Emph { }
	fn toStrongFast() Strong { }
	fn toLinkFast() Link { }
	fn toImageFast() Image { }
	fn toParentFast() Parent { }
}

//! A Parent node can have children nodes.
class Parent : Node
{
public:
	children: Node[];


public:
	this() { }
}

//! A Document node represents the entire markdown text.
class Document : Parent
{
public:
	this() { }
}

//! A Parent block from lines that start with >.
class BlockQuote : Parent
{
public:
	lastLineBlank: bool;


public:
	this() { }
}

//! A Parent block that lists its children, either ordered or unordered.
class List : Parent
{
public:
	enum Kind
	{
		Bullet,
		Ordered,
	}


public:
	alias Bullet = Kind.Bullet;
	alias Ordered = Kind.Ordered;


public:
	kind: Kind;
	isTight: bool;
	blankLinePending: bool;
	leadingWhitespace: size_t;
	empty: bool;
	delimiter: string;
	separator: char;
	start: i32;


public:
	this() { }
}

//! An element in a List.
class Item : Parent
{
public:
	childPoint: size_t;


public:
	this() { }
}

//! A Block that contains text that is to be displayed as-is in a
//! monospace font.
class CodeBlock : Node
{
public:
	str: string;
	info: string;
	fenceIndentation: size_t;


public:
	this() { }
}

//! A block of raw HTML.
class HtmlBlock : Node
{
public:
	enum Kind
	{
		Script,
		Comment,
		Question,
		Bang,
		CData,
		Normal,
		Other,
	}


public:
	str: string;
	kind: Kind;
	parent: Parent;


public:
	this() { }
}

//! A Paragraph is the simplest parent block, usually containing text.
class Paragraph : Parent
{
public:
	this() { }
}

//! Demarks a section with text in a special style. Can be generated in
//! multiple ways.
class Heading : Parent
{
public:
	level: u32;


public:
	this() { }
}

//! Breaks a document into sections. Rendered with an  node in HTML.
class ThematicBreak : Node
{
public:
	this() { }
}

//! A written method of human communication.
class Text : Node
{
public:
	str: string;
	leadingWhitespace: size_t;
	slashToBreak: bool;
	run: string;


public:
	this() { }
}

//! A newline.
class Softbreak : Node
{
public:
	this() { }
}

//! Harder form of break than Softbreak, rendered with 
in HTML.
class Linebreak : Node { public: slashBreak: bool; public: this() { } } //! Like CodeBlock but inline. class Code : Node { public: str: string; public: this() { } } //! An inline HTML tag. class HtmlInline : Node { public: str: string; public: this() { } } //! First level of text emphasis. Rendered as italics. class Emph : Parent { public: this() { } } //! Second level of text emphasis. Rendered as bold. class Strong : Parent { public: this() { } } //! A Link to a URL. class Link : Parent { public: url: string; title: string; fromHtml: bool; public: this() { } } //! A Link to an image, intended for inline display. class Image : Parent { public: url: string; alt: string; title: string; public: this() { } } //! Visitor base class. class Visitor { public: this() { } fn enter(n: Document, sink: scope (Sink)) { } fn leave(n: Document, sink: scope (Sink)) { } fn enter(n: BlockQuote, sink: scope (Sink)) { } fn leave(n: BlockQuote, sink: scope (Sink)) { } fn enter(n: List, sink: scope (Sink)) { } fn leave(n: List, sink: scope (Sink)) { } fn enter(n: Item, sink: scope (Sink)) { } fn leave(n: Item, sink: scope (Sink)) { } fn enter(n: Paragraph, sink: scope (Sink)) { } fn leave(n: Paragraph, sink: scope (Sink)) { } fn enter(n: Heading, sink: scope (Sink)) { } fn leave(n: Heading, sink: scope (Sink)) { } fn enter(n: Emph, sink: scope (Sink)) { } fn leave(n: Emph, sink: scope (Sink)) { } fn enter(n: Link, sink: scope (Sink)) { } fn leave(n: Link, sink: scope (Sink)) { } fn enter(n: Image, sink: scope (Sink)) { } fn leave(n: Image, sink: scope (Sink)) { } fn enter(n: Strong, sink: scope (Sink)) { } fn leave(n: Strong, sink: scope (Sink)) { } fn visit(n: HtmlBlock, sink: scope (Sink)) { } fn visit(n: CodeBlock, sink: scope (Sink)) { } fn visit(n: ThematicBreak, sink: scope (Sink)) { } fn visit(n: Text, sink: scope (Sink)) { } fn visit(n: Softbreak, sink: scope (Sink)) { } fn visit(n: Linebreak, sink: scope (Sink)) { } fn visit(n: Code, sink: scope (Sink)) { } fn visit(n: HtmlInline, sink: scope (Sink)) { } } //! Dispatch to correct visitor function. fn accept(n: Node, v: Visitor, sink: scope (Sink)) { }

watt.markdown.parser

//! Markdown parser.
module watt.markdown.parser;


//! Internal representation of a link.
class LinkReference
{
public:
	enum Stage
	{
		Opening,
		Label,
		ClosingColon,
		Url,
		Title,
		Done,
	}


public:
	label: string;
	url: string;
	title: string;
	titleSentinel: dchar;
	stage: Stage;
	lines: string[];


public:
	this() { }
	fn addLines(p: Parser) { }
}

//! Parse a string of markdown, ready for processing into output.
fn parse(str: string) Document { }