Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Artifact ID: | eabba6f014009cbc7494061c2380d64fd8e60303 |
---|---|
Page Name: | API Reference |
Date: | 2016-11-21 12:55:39 |
Original User: | User |
Parent: | 4bdf078f0d3f837e7fb560b3ee7d7e520775d2b3 (diff) |
PComb API
Types
Parser
export type Parser = (input: ParserInput, output: ParserOutput, action?: ParserAction) => ParseResult;
ParseResult
export type ParseResult = boolean, ParserInput, ParserOutput;
The ParseResult tuple is returned by all parser functions. The first value indicates if the parser successfully matched its input. If the value if false, the remaining parameters will be identical to the objects that were supplied in the call to the Parse function. If true is returned, the ParserInput returned will have its text field set to have only the input data that was not consumed by parsing, and the ParserOutput will have its matched list set to contain all of the individual strings that were matched by each discrete parsing step as well as any application-specific fields that were set by ParserAction functions.
ParserOutput
export interface ParserOutput {
/** The text that was matched by the parser. */
matched: Array<string>;
copy(): ParserOutput;
}
ParserInput
export interface ParserInput {
/** What is the text that is being parsed? */
text: string;
copy(): ParserInput;
}