/** * @author fenris */ declare type int = number; /** * @author fenris */ declare type float = number; /** * @author fenris */ declare type type_time = { hours: int; minutes: int; seconds: int; }; /** * @author fenris */ declare type type_pseudopointer = { value: type_value; }; /** * @author fenris */ declare function pseudopointer_null(): type_pseudopointer; /** * @author fenris */ declare function pseudopointer_make(value: type_value): type_pseudopointer; /** * @author fenris */ declare function pseudopointer_isset(pseudopointer: type_pseudopointer): boolean; /** * @author fenris */ declare function pseudopointer_read(pseudopointer: type_pseudopointer): type_value; /** * @author fenris */ declare function pseudopointer_write(pseudopointer: type_pseudopointer, value: type_value): void; declare var process: any; declare var require: any; declare class Buffer { constructor(x: string, modifier?: string); toString(modifier?: string): string; } declare var java: any; declare module lib_base { /** * @author fenris */ function environment(): string; } /** * @author fenris */ declare var instance_verbosity: int; /** * @desc the ability to check for equality with another element of the same domain * @author fenris */ interface interface_collatable { /** * @author fenris */ _collate(value: type_value): boolean; } /** * @author fenris */ declare function instance_collate(value1: type_value, value2: type_value): boolean; /** * @desc the ability to compare with another element of the same domain for determining if the first is "smaller than or equal to" the latter * @author fenris */ interface interface_comparable { /** * @author fenris */ _compare(value: type_value): boolean; } /** * @author fenris */ declare function instance_compare(value1: type_value, value2: type_value): boolean; /** * @desc the ability to create an exact copy * @author fenris */ interface interface_cloneable { /** * @author fenris */ _clone(): type_value; } /** * @author fenris */ declare function instance_clone(value: type_value): type_value; /** * @author fenris */ interface interface_hashable { /** * @author fenris */ _hash(): string; } /** * @desc the ability to generate a string out of the element, which identifies it to a high degree * @author fenris */ declare function instance_hash(value: type_value): string; /** * @author fenris */ interface interface_showable { /** * @author fenris */ _show(): string; } /** * @desc the ability to map the element to a textual representation (most likely not injective) * @author fenris */ declare function instance_show(value: type_value): string; /** * @todo outsource to dedicated plankton-lib */ declare module lib_log { /** * @author fenris */ function log(...args: Array): void; /** * @author fenris */ function info(...args: Array): void; /** * @author fenris */ function warn(...args: Array): void; /** * @author fenris */ function error(...args: Array): void; } /** * @author frac */ interface interface_decorator { /** * @author frac */ core: type_core; } /** * @author frac */ declare class class_observer { /** * @author frac */ protected counter: int; /** * @author frac */ protected actions: { [id: string]: (information: Object) => void; }; /** * @author frac */ protected buffer: Array; /** * @author frac */ constructor(); /** * @author frac */ empty(): boolean; /** * @author frac */ flush(): void; /** * @author frac */ set(id: string, action: (information: Object) => void): void; /** * @author frac */ del(id: string): void; /** * @author frac */ add(action: (information: Object) => void): void; /** * @author frac */ notify(information?: Object, delayed?: boolean): void; /** * @author frac */ rollout(): void; } /** * @author frac */ /** * @author frac */ declare module lib_maybe { /** * @author fenris */ type type_maybe = { kind: string; parameters: Object; }; /** * @author fenris */ function make_nothing(): type_maybe; /** * @author fenris */ function make_just(value: type_value): type_maybe; /** * @author fenris */ function is_nothing(maybe: type_maybe): boolean; /** * @author fenris */ function is_just(maybe: type_maybe): boolean; /** * @author fenris */ function cull(maybe: type_maybe): type_value; /** * @author fenris */ function propagate(maybe: type_maybe, function_: (value: type_value) => type_maybe): type_maybe; } /** * @author fenris */ declare class class_maybe implements interface_showable { /** * @desc whether the wrapper is nothing * @author fenris */ is_nothing(): boolean; /** * @desc whether the wrapper is just * @author fenris */ is_just(): boolean; /** * @desc return the value, stored in the maybe-wrapper * @author fenris */ cull(): type_value; /** * @author fenris */ toString(): string; /** * @author fenris */ distinguish(action_just: (value?: type_value) => void, action_nothing?: (reason?: string) => void): void; /** * @author fenris */ propagate(action: (value: type_value) => class_maybe): class_maybe; /** * @desc [implementation] * @author fenris */ _show(): string; } /** * @author fenris */ declare class class_nothing extends class_maybe { /** * @author fenris */ private reason; /** * @author fenris */ constructor(reason?: string); /** * @author fenris */ is_nothing(): boolean; /** * @author fenris */ is_just(): boolean; /** * @author fenris */ cull(): type_value; /** * @author fenris */ toString(): string; /** * @author fenris */ reason_get(): string; /** * @author fenris */ distinguish(action_just: (value?: type_value) => void, action_nothing?: (reason?: string) => void): void; /** * @author fenris */ propagate(action: (value: type_value) => class_maybe): class_maybe; } /** * @author fenris */ declare class class_just extends class_maybe { /** * @author fenris */ private value; /** * @author fenris */ constructor(value: type_value); /** * @author fenris */ is_nothing(): boolean; /** * @author fenris */ is_just(): boolean; /** * @author fenris */ cull(): type_value; /** * @author fenris */ toString(): string; /** * @author fenris */ distinguish(action_just: (value?: type_value) => void, action_nothing?: (reason?: string) => void): void; /** * @author fenris */ propagate(action: (value: type_value) => class_maybe): class_maybe; } /** * @author frac */ declare class class_error extends Error { /** * @author frac */ protected suberrors: Array; /** * @author frac */ protected mess: string; /** * @author frac */ constructor(message: string, suberrors?: Array); /** * @override * @author frac */ toString(): string; } declare namespace lib_plankton.log { /** */ enum enum_level { debug = 0, info = 1, notice = 2, warning = 3, error = 4 } /** */ function level_order(level1: enum_level, level2: enum_level): boolean; /** */ function level_show(level: enum_level): string; /** */ type type_entry = { level: enum_level; incident: string; details: { [name: string]: any; }; }; } /** * @deprecated * @todo remove */ declare module lib_log { function level_push(level: int): void; function level_pop(): void; function indent_push(indent: int): void; function indent_pop(): void; function indent_inc(): void; function indent_dec(): void; /** * @author fenris */ function write({ "message": message, "type": type, "prefix": prefix, "level": level, "indent": indent, }: { message?: string; type?: string; prefix?: string; level?: int; indent?: int; }): void; } declare namespace lib_plankton.log { /** */ abstract class class_channel { /** */ abstract add(entry: type_entry): void; } } declare namespace lib_plankton.log { /** */ class class_channel_console extends class_channel { /** */ add(entry: type_entry): void; } } declare namespace lib_plankton.log { /** */ class class_channel_notify extends class_channel { /** */ add(entry: type_entry): void; } } declare namespace lib_plankton.log { /** */ class class_channel_minlevel extends class_channel { /** */ private core; /** */ private threshold; /** */ constructor(core: class_channel, threshold: enum_level); /** */ add(entry: type_entry): void; } } declare namespace lib_plankton.log { /** */ function channel_make(description: { kind: string; data?: { [key: string]: any; }; }): class_channel; } declare namespace lib_plankton.log { /** */ function conf_default(): Array; /** */ function conf_push(channels: Array): void; /** */ function conf_pop(): void; /** */ function setup(): void; /** */ function add(entry: type_entry): void; /** */ function debug(incident: string, details?: { [name: string]: any; }): void; /** */ function info(incident: string, details?: { [name: string]: any; }): void; /** */ function notice(incident: string, details?: { [name: string]: any; }): void; /** */ function warning(incident: string, details?: { [name: string]: any; }): void; /** */ function error(incident: string, details?: { [name: string]: any; }): void; } declare namespace lib_args { /** */ enum enum_environment { cli = "cli", url = "url" } /** */ enum enum_kind { positional = "positional", volatile = "volatile" } /** */ enum enum_type { boolean = "boolean", integer = "int", float = "float", string = "string" } /** */ enum enum_mode { replace = "replace", accumulate = "accumulate" } } declare module lib_args { /** * @author fenris */ class class_argument { /** * @author fenris */ protected name: string; /** * @author fenris */ protected kind: enum_kind; /** * @author fenris */ protected type: enum_type; /** * @author fenris */ protected mode: enum_mode; /** * @author fenris */ protected default_: any; /** * @author fenris */ protected info: string; /** * @author fenris */ protected parameters: Object; /** * @author fenris */ protected hidden: boolean; /** * @author fenris */ constructor({ "name": name, "type": type, "kind": kind, "mode": mode, "default": default_, "info": info, "parameters": parameters, "hidden": hidden, }: { name: string; type?: enum_type; kind?: enum_kind; mode?: enum_mode; default?: any; info?: string; parameters?: Object; hidden?: boolean; }); /** * @author fenris */ static positional({ "name": name, "type": type, "mode": mode, "default": default_, "info": info, "hidden": hidden, "index": index, }: { name: string; type?: enum_type; mode?: enum_mode; default?: any; info?: string; hidden?: boolean; index: int; }): class_argument; /** * @author fenris */ static volatile({ "name": name, "type": type, "mode": mode, "default": default_, "info": info, "hidden": hidden, "indicators_short": indicators_short, "indicators_long": indicators_long, }: { name: string; type?: enum_type; mode?: enum_mode; default?: any; info?: string; hidden?: boolean; indicators_short: Array; indicators_long: Array; }): class_argument; /** * @author fenris */ check(): boolean; /** * @author fenris */ name_get(): string; /** * @author fenris */ kind_get(): enum_kind; /** * @author fenris */ type_get(): enum_type; /** * @author fenris */ mode_get(): enum_mode; /** * @author fenris */ default_get(): any; /** * @author fenris */ parameters_get(): Object; /** * @author fenris */ hidden_get(): boolean; /** * @author fenris */ toString(): string; /** * @author fenris */ indicator_main(): string; /** * @author fenris */ pattern_value(): string; /** * @author fenris */ extract(raw: string): any; /** * @author fenris */ assign(data: Object, target: string, raw: string): void; /** * @author fenris */ make(data: Object, target: string): string; /** * @author fenris */ generate_help(): string; } } declare module lib_args { /** * @author fenris */ var verbosity: int; /** * @author fenris * @todo check validity */ class class_handler { /** * @author fenris */ protected arguments_: { [name: string]: class_argument; }; /** * @author fenris */ constructor(arguments_: { [name: string]: class_argument; }); /** * @author fenris */ filter(kind: enum_kind): { [name: string]: class_argument; }; /** * @author fenris */ read(environment: enum_environment, input: string, data?: { [name: string]: any; }): { [name: string]: any; }; /** * @author fenris * @todo handle if the data object doesn't have the required field or the type is wrong or sth. */ write(environment: enum_environment, data: { [name: string]: any; }): string; /** * @desc manpage-like info-sheet * @author fenris */ generate_help({ "programname": programname, "author": author, "description": description, "executable": executable, }: { programname?: string; author?: string; description?: string; executable?: string; }): string; } } declare namespace lib_plankton.file { /** * @author fenris */ function read(path: string): Promise; /** * @author fenris */ function read_stdin(): Promise; /** * @author fenris */ function write(path: string, content: string): Promise; } declare module lib_observer { /** * @author fenris */ type type_eventname = string; /** * @author fenris */ type type_data = any; /** * @author fenris */ type type_action = (data: type_data) => void; /** * @author fenris */ type type_observer = { actions: { [eventname: string]: Array; }; force_registration: boolean; no_attendants_warn_do: boolean; no_attendants_warn_action: (eventname: type_eventname) => void; }; /** * @author fenris */ function make({ "force_registration": force_registration, "no_attendants_warn_do": no_attendants_warn_do, "no_attendants_warn_action": no_attendants_warn_action, }?: { force_registration?: boolean; no_attendants_warn_do?: boolean; no_attendants_warn_action?: (eventname: type_eventname) => void; }): type_observer; /** * @author fenris */ function register(observer: type_observer, eventname: type_eventname): void; /** * @author fenris */ function attend(observer: type_observer, eventname: type_eventname, action: type_action): void; /** * @author fenris */ function notify(observer: type_observer, eventname: type_eventname, data: type_data): void; } declare namespace lib_plankton.lang { /** * @author fenris */ type char = string; /** * @author fenris */ type type_terminal_default = { id: string; data?: Object; }; /** * @author fenris */ function find(word: Array, part: Array, equality: (x: type_x, y: type_y) => boolean, /*= instance_collate*/ right_to_left?: boolean): int; } declare namespace lib_plankton.lang { /** * @author fenris */ interface interface_symbol { /** * @author fenris */ equals(symbol: interface_symbol): boolean; /** * @author fenris */ toString(): string; } } declare namespace lib_plankton.lang { /** * @author fenris */ class class_symbol_terminal implements interface_symbol { /** * @author fenris */ protected terminal: type_terminal; /** * @author fenris */ protected equality_terminal: (x: type_terminal, y: type_terminal) => boolean; /** * @desc [constructor] * @author fenris */ constructor(terminal: type_terminal, equality_terminal?: (x: type_terminal, y: type_terminal) => boolean); /** * @author fenris */ terminal_get(): type_terminal; /** * @override * @author fenris */ equals(symbol: interface_symbol): boolean; /** * @override * @author fenris */ toString(): string; /** * @author fenris */ static tree_generic(terminal: type_terminal): class_symbol_terminal>; /** * @author fenris */ static tree_default(terminal: type_terminal_default): class_symbol_terminal>; } } declare namespace lib_plankton.lang { /** * @author fenris */ class class_symbol_variable implements interface_symbol { /** * @author fenris */ protected variable: type_variable; /** * @author fenris */ protected meaning: type_meaning; /** * @desc [constructor] * @author fenris */ constructor(variable: type_variable, meaning?: type_meaning); /** * @desc [accessor] [getter] * @author fenris */ variable_get(): type_variable; /** * @desc [accessor] [getter] * @author fenris */ meaning_get(): type_meaning; /** * @override * @author fenris */ equals(symbol: interface_symbol): boolean; /** * @override * @author fenris */ toString(): string; /** * @author fenris */ static tree_generic(variable: type_variable): class_symbol_variable>; /** * @author fenris */ static tree_default(variable: string): class_symbol_variable>; } } declare namespace lib_plankton.lang { /** * @author fenris */ interface interface_lexer { /** * @author fenris */ run(input: Array): Array; } } declare namespace lib_plankton.lang { /** * @author fenris */ type type_token = { sequence: Array; terminal: class_maybe; }; /** * @author fenris */ type type_lexerrule = { search: (part: Array) => { found: boolean; data?: { position?: int; length?: int; }; }; construct: (part: Array) => Array; observer: lib_observer.type_observer; }; /** * @author fenris */ function lexerrule_make(search: (part: Array) => { found: boolean; data?: { position?: int; length?: int; }; }, construct: (part: Array) => Array): type_lexerrule; /** * @author fenris * @todo schön machen? is aber vermutlich gar nicht möglich :/ */ function lexerrule_show(rule: type_lexerrule): string; /** * @author fenris */ function lexerrule_apply(rule: type_lexerrule, tokens: Array>): Array>; /** * @author fenris */ function lexerrule_pass(): type_lexerrule; /** * @author fenris */ function lexerrule_pattern_generic(rule_raw: { pattern: string; construct: (part: Array) => Array; }): type_lexerrule; /** * @author fenris */ function lexerrule_pattern_ignore(pattern: string): type_lexerrule; /** * @author fenris */ function lexerrule_pattern_void(pattern: string, id: string): type_lexerrule; /** * @author fenris */ function lexerrule_pattern_boolean(pattern: string, id: string, value: boolean): type_lexerrule; /** * @author fenris */ function lexerrule_pattern_int(pattern: string, id: string): type_lexerrule; /** * @author fenris */ function lexerrule_pattern_float(pattern: string, id: string): type_lexerrule; /** * @author fenris */ function lexerrule_pattern_string(pattern: string, id: string): type_lexerrule; } declare namespace lib_plankton.lang { /** * @author fenris * @todo warn on prefix-detection * @todo after rule application don't start from the beginning but from the last position */ type type_lexer_dumb = { rules: Array>; observer: lib_observer.type_observer; }; /** * @author fenris */ function lexer_dumb_make(rules: Array>): type_lexer_dumb; /** * @author fenris */ function lexer_dumb_run(subject: type_lexer_dumb, input: Array, configuration?: { use_reduce?: boolean; }): Array; /** * @author fenris */ function lexer_dumb_pass(): type_lexer_dumb; } declare namespace lib_plankton.lang { /** * @author fenris */ class class_lexerrule { /** * @author fenris */ protected subject: type_lexerrule; /** * @author fenris */ constructor(subject: type_lexerrule); /** * @author fenris */ static construct({ "search": search, "construct": construct, }: { search: (part: Array) => { found: boolean; data?: { position?: int; length?: int; }; }; construct: (part: Array) => Array; }): class_lexerrule; /** * @author fenris */ subject_get(): type_lexerrule; /** * @author fenris */ search(part: Array): { found: boolean; data?: { position?: int; length?: int; }; }; /** * @author fenris */ construct(part: Array): Array; /** * @author fenris */ static pass(): class_lexerrule; /** * @author fenris */ static pattern_generic(rule_raw: { pattern: string; construct: (part: Array) => Array; }): class_lexerrule; /** * @author fenris */ static pattern_ignore(pattern: string): class_lexerrule; /** * @author fenris */ static pattern_void(pattern: string, id: string): class_lexerrule; /** * @author fenris */ static pattern_boolean(pattern: string, id: string, value: boolean): class_lexerrule; /** * @author fenris */ static pattern_int(pattern: string, id: string): class_lexerrule; /** * @author fenris */ static pattern_float(pattern: string, id: string): class_lexerrule; /** * @author fenris */ static pattern_string(pattern: string, id: string): class_lexerrule; } /** * @author fenris */ class class_lexer_dumb implements interface_lexer { /** * @author fenris */ protected subject: type_lexer_dumb; /** * @author fenris */ constructor(subject: type_lexer_dumb); /** * @author fenris */ static construct(rules: Array>): class_lexer_dumb; /** * @author fenris */ run(input: Array): Array; /** * @author fenris */ static pass(): class_lexer_dumb; } } declare namespace lib_plankton.lang { /** * @author fenris */ interface interface_parser { /** * @param input the input sequence to parse * @param target_variable if not passed, this value should fall back to the start symbol of the grammar * @author fenris */ run(input: Array, target_variable?: type_variable): type_meaning; } } declare namespace lib_plankton.lang { /** * @author fenris */ type type_tree = { label?: string; value: Array; children: Array>; }; /** * @author fenris */ type type_parserrule = { premise: type_variable; conclusion: Array>; construct: (args: Array, terminals: Array) => type_meaning; right_to_left: boolean; }; /** * @desc [constructor] * @author fenris */ function parserrule_make({ "premise": premise, "conclusion": conclusion, "construct": construct, "right_to_left": right_to_left, }: { premise: type_variable; conclusion: Array>; construct: (args: Array, terminals: Array) => type_meaning; right_to_left?: boolean; }): { premise: type_variable; conclusion: interface_symbol[]; construct: (args: type_meaning[], terminals: type_terminal[]) => type_meaning; right_to_left: boolean; }; /** * @author fenris */ function parserrule_check(parserrule: type_parserrule, sequence: Array>): int; /** * @author fenris */ function parserrule_construct(parserrule: type_parserrule, args: Array, terminals: Array): type_meaning; } declare namespace lib_plankton.lang { /** * @author fenris * @todo fatal error on empty conclusion */ type type_parser_dumb = { start: type_variable; rules: Array>; equality_terminal: (x: type_terminal, y: type_terminal) => boolean; observer: lib_observer.type_observer; }; /** * @author fenris */ function parser_dumb_make(start: type_variable, rules: Array>, equality_terminal?: (x: type_terminal, y: type_terminal) => boolean): type_parser_dumb; /** * @override * @author fenris */ function parser_dumb_run(parser_dumb: type_parser_dumb, input: Array, target_variable?: type_variable): type_meaning; /** * @author fenris */ function parser_dumb_tree(start: type_variable, rules_raw: Array<{ premise: type_variable; conclusion: Array>>; label?: string; right_to_left?: boolean; }>, equality_terminal?: (x: type_terminal, y: type_terminal) => boolean): type_parser_dumb>; } declare namespace lib_plankton.lang { /** * @author fenris */ class class_parserrule { /** * @author fenris */ protected subject: type_parserrule; /** * @desc [constructor] * @author fenris */ private constructor(); /** * @desc [constructor] * @author fenris */ static construct({ "premise": premise, "conclusion": conclusion, "construct": construct, "right_to_left": right_to_left, }: { premise: type_variable; conclusion: Array>; construct: (args: Array, terminals: Array) => type_meaning; right_to_left?: boolean; }): class_parserrule; /** * @desc [accessor] [getter] * @author fenris */ subject_get(): type_parserrule; /** * @desc [accessor] [getter] * @author fenris */ premise_get(): type_variable; /** * @desc [accessor] [getter] * @author fenris */ conclusion_get(): Array>; /** * @desc [accessor] * @author fenris */ check(sequence: Array>): int; /** * @desc [accessor] * @author fenris */ construct(args: Array, terminals: Array): type_meaning; } /** * @author fenris * @todo fatal error on empty conclusion */ class class_parser_dumb implements interface_parser { /** * @author fenris */ protected subject: type_parser_dumb; /** * @author fenris */ private constructor(); /** * @author fenris */ static construct(start: type_variable, rules: Array>, equality_terminal?: (x: type_terminal, y: type_terminal) => boolean): class_parser_dumb; /** * @override * @author fenris */ run(input: Array, target_variable?: type_variable): type_meaning; /** * @author fenris */ static tree(start: type_variable, rules_raw: Array<{ premise: type_variable; conclusion: Array>>; label?: string; right_to_left?: boolean; }>, equality_terminal?: (x: type_terminal, y: type_terminal) => boolean): class_parser_dumb>; } } declare namespace lib_plankton.lang { /** * @author fenris */ function reader_run(lexer_run: (input: Array) => Array, parser_run: (input: Array, target_variable?: type_variable) => type_meaning, input: Array, target_variable?: type_variable): type_meaning; /** * @author fenris */ type type_parser_rule_default = { premise: string; conclusion: Array>>; label?: string; right_to_left?: boolean; }; /** * @author fenris */ function reader_default({ "lexer_rules": lexer_rules, "parser_start": parser_start, "parser_rules": parser_rules, }: { lexer_rules: Array>; parser_start: string; parser_rules: Array; }): class_reader>; /** * @author fenris */ type type_raw_parser_rule = { premise: string; conclusion: Array<{ type: string; parameters?: Object; }>; label?: string; right_to_left?: boolean; }; /** * @author fenris */ function default_raw({ "lexer_rules": lexer_rules, "parser_start": parser_start, "parser_rules": parser_rules, }: { lexer_rules: Array<{ type: string; parameters?: Object; }>; parser_start: string; parser_rules: Array; }): class_reader>; } declare namespace lib_plankton.lang { /** * @author fenris */ class class_reader { /** * @author fenris */ protected lexer: interface_lexer; /** * @author fenris */ protected parser: interface_parser; /** * @author fenris */ constructor(lexer: interface_lexer, parser: interface_parser); /** * @desc [accessor] yes, it's really just lexing and parsing * @author fenris */ run(input: Array, target_variable?: type_variable): type_result; /** * @author fenris */ static default({ "lexer_rules": lexer_rules, "parser_start": parser_start, "parser_rules": parser_rules, }: { lexer_rules: Array>; parser_start: string; parser_rules: Array<{ premise: string; conclusion: Array>>; label?: string; right_to_left?: boolean; }>; }): class_reader>; /** * @author fenris */ static default_raw({ "lexer_rules": lexer_rules, "parser_start": parser_start, "parser_rules": parser_rules, }: { lexer_rules: Array<{ type: string; parameters?: Object; }>; parser_start: string; parser_rules: Array<{ premise: string; conclusion: Array<{ type: string; parameters?: Object; }>; label?: string; right_to_left?: boolean; }>; }): class_reader>; } }