sindri/lib/plankton/plankton.d.ts
Christian Fraß 910028908f [res]
2023-07-23 19:34:15 +02:00

1460 lines
36 KiB
TypeScript

/**
* @author fenris
*/
type int = number;
/**
* @author fenris
*/
type float = number;
/**
* @author fenris
*/
type type_time = {
hours: int;
minutes: int;
seconds: int;
};
declare var process: any;
declare var require: any;
declare class Buffer {
constructor(x: string, modifier?: string);
toString(modifier?: string): string;
}
declare namespace lib_plankton.base {
/**
* @author fenris
*/
function environment(): string;
}
/**
* @author fenris
*/
type type_pseudopointer<type_value> = {
value: type_value;
};
/**
* @author fenris
*/
declare function pseudopointer_null<type_value>(): type_pseudopointer<type_value>;
/**
* @author fenris
*/
declare function pseudopointer_make<type_value>(value: type_value): type_pseudopointer<type_value>;
/**
* @author fenris
*/
declare function pseudopointer_isset<type_value>(pseudopointer: type_pseudopointer<type_value>): boolean;
/**
* @author fenris
*/
declare function pseudopointer_read<type_value>(pseudopointer: type_pseudopointer<type_value>): type_value;
/**
* @author fenris
*/
declare function pseudopointer_write<type_value>(pseudopointer: type_pseudopointer<type_value>, value: type_value): void;
/**
* @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<type_value> {
/**
* @author fenris
*/
_collate(value: type_value): boolean;
}
/**
* @author fenris
*/
declare function instance_collate<type_value>(value1: (type_value & {
_collate?: ((value: type_value) => boolean);
}), 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<type_value> {
/**
* @author fenris
*/
_compare(value: type_value): boolean;
}
/**
* @author fenris
*/
declare function instance_compare<type_value>(value1: (type_value & {
_compare: ((value: type_value) => boolean);
}), value2: type_value): boolean;
/**
* @desc the ability to create an exact copy
* @author fenris
*/
interface interface_cloneable<type_value> {
/**
* @author fenris
*/
_clone(): type_value;
}
/**
* @author fenris
*/
declare function instance_clone<type_value>(value: (type_value & {
_clone?: (() => 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<type_value>(value: (type_value & {
_hash?: (() => string);
})): 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<type_value>(value: (type_value & {
_show?: (() => string);
})): string;
/**
* @author frac
*/
interface interface_decorator<type_core> {
/**
* @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<Object>;
/**
* @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<type_value> = {
kind: string;
parameters: Object;
};
/**
* @author fenris
*/
function make_nothing<type_value>(): type_maybe<type_value>;
/**
* @author fenris
*/
function make_just<type_value>(value: type_value): type_maybe<type_value>;
/**
* @author fenris
*/
function is_nothing<type_value>(maybe: type_maybe<type_value>): boolean;
/**
* @author fenris
*/
function is_just<type_value>(maybe: type_maybe<type_value>): boolean;
/**
* @author fenris
*/
function cull<type_value>(maybe: type_maybe<type_value>): type_value;
/**
* @author fenris
*/
function propagate<type_value, type_value_>(maybe: type_maybe<type_value>, function_: (value: type_value) => type_maybe<type_value_>): type_maybe<type_value_>;
}
/**
* @author fenris
*/
declare class class_maybe<type_value> 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<type_value_>(action: (value: type_value) => class_maybe<type_value_>): class_maybe<type_value_>;
/**
* @desc [implementation]
* @author fenris
*/
_show(): string;
}
/**
* @author fenris
*/
declare class class_nothing<type_value> extends class_maybe<type_value> {
/**
* @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<type_value_>(action: (value: type_value) => class_maybe<type_value_>): class_maybe<type_value_>;
}
/**
* @author fenris
*/
declare class class_just<type_value> extends class_maybe<type_value> {
/**
* @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<type_value_>(action: (value: type_value) => class_maybe<type_value_>): class_maybe<type_value_>;
}
/**
* @author frac
*/
declare class class_error extends Error {
/**
* @author frac
*/
protected suberrors: Array<Error>;
/**
* @author frac
*/
protected mess: string;
/**
* @author frac
*/
constructor(message: string, suberrors?: Array<Error>);
/**
* @override
* @author frac
*/
toString(): string;
}
declare namespace lib_plankton.base {
/**
* returns the current UNIX timestamp
*
* @author fenris
*/
function get_current_timestamp(rounded?: boolean): int;
/**
*/
function object_merge(core: Record<string, any>, mantle: Record<string, any>): Record<string, any>;
}
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: Record<string, any>;
};
}
/**
* @deprecated
* @todo remove
*/
declare namespace lib_plankton.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 {
/**
* output for writing log entries to stdout
*/
class class_channel_stdout extends class_channel {
/**
*/
add(entry: type_entry): void;
}
}
declare namespace lib_plankton.log {
/**
*/
class class_channel_file extends class_channel {
/**
* the path of the log file
*/
private path;
/**
* [constructor]
*/
constructor(path: string);
/**
*/
add(entry: type_entry): void;
}
}
declare namespace lib_plankton.log {
/**
* output for desktop notifications via "libnotify"
*/
class class_channel_notify extends class_channel {
/**
*/
add(entry: type_entry): void;
}
}
declare namespace lib_plankton.log {
/**
* decorator for filtering out log entries below a certain level threshold
*/
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;
/**
*/
type type_configuration = Array<class_channel>;
/**
*/
function conf_default(): type_configuration;
}
declare namespace lib_plankton.log {
/**
* pushes a new configuration on the stack and activates it
*/
function conf_push(channels: type_configuration): void;
/**
* pops the current active configuration from the stack
*/
function conf_pop(): void;
/**
* consumes a log entry, i.e. sends it to the currently active outputs
*/
function add(entry: type_entry): void;
/**
*/
function debug(incident: string, details?: Record<string, any>): void;
/**
*/
function info(incident: string, details?: Record<string, any>): void;
/**
*/
function notice(incident: string, details?: Record<string, any>): void;
/**
*/
function warning(incident: string, details?: Record<string, any>): void;
/**
*/
function error(incident: string, details?: Record<string, any>): void;
}
declare var plain_text_to_html: (text: string) => string;
/**
* @desc makes a valid
*/
declare var format_sentence: (str: string, rtl?: boolean, caseSense?: boolean) => string;
declare var fill_string_template: (template_string: string, object: any, fabric: Function, delimiter: string, default_string: string, sloppy: boolean) => string;
declare var make_string_template: (_template: string, _fabrics?: Object) => (object: {
[key: string]: string;
}) => string;
declare var make_eml_header: (object: {
[key: string]: string;
}) => string;
declare var make_eml_body: Object;
declare namespace lib_plankton.string {
/**
* @author neuc,frac
*/
function empty(str: string): boolean;
/**
* @desc returns a unique string
* @param {string} prefix an optional prefix for the generated string
* @return {string}
* @author fenris
*/
function generate(prefix?: string): string;
/**
* @desc splits a string, but returns an empty list, if the string is empty
* @param {string} chain
* @param {string} separator
* @return {Array<string>}
* @author fenris
*/
function split(chain: string, separator?: string): Array<string>;
/**
* @author neu3no
*/
function explode(str: string, needle: string, max: int): Array<string>;
/**
* @desc concats a given word with itself n times
* @param {string} word
* @param {int}
* @return {string}
* @author fenris
*/
function repeat(word: string, count: int): string;
/**
* @desc lengthens a string by repeatedly appending or prepending another string
* @param {string} word the string to pad
* @param {int} length the length, which the result shall have
* @param {string} symbol the string, which will be added (multiple times)
* @param {boolean} [prepend]; whether to prepend (~true) or append (~false); default: false
* @return {string} the padded string
* @author fenris
*/
function pad(word: string, length: int, symbol?: string, mode?: string): string;
/**
* @desc checks if a given string conttains a certain substring
* @param {string} string
* @param {string} part
* @return {boolean}
* @author fenris
*/
function contains(chain: string, part: string): boolean;
/**
* @desc checks if a given string starts with a certain substring
* @param {string} string
* @param {string} part
* @return {boolean}
* @author fenris
*/
function startsWith(chain: string, part: string): boolean;
/**
* @desc checks if a given string ends with a certain substring
* @param {string} string
* @param {string} part
* @return {boolean}
* @author fenris
*/
function endsWith(chain: string, part: string): boolean;
/**
* @desc count the occourrences of a string in a string
* @param string haystack_string the string wich should be examined
* @param string needle_string the string which should be counted
* @author neuc
*/
function count_occourrences(haystack_string: string, needle_string: string, check_escape: boolean): int;
/**
* @author fenris
*/
function replace(str: string, replacements: Array<{
from: string;
to: string;
}>, options?: {}): string;
/**
* @desc replaces occurences of "${name}" in a string by the corresponding values of an argument object
* @author fenris
*/
function coin(str: string, args: {
[id: string]: string;
}, options?: {
legacy?: boolean;
open?: string;
close?: string;
}): string;
/**
* @author fenris
*/
function cut(str: string, length: int, delimiter?: string): string;
}
/**
* @deprecated
*/
declare namespace lib_string {
const empty: typeof lib_plankton.string.empty;
const generate: typeof lib_plankton.string.generate;
const split: typeof lib_plankton.string.split;
const explode: typeof lib_plankton.string.repeat;
const repeat: typeof lib_plankton.string.repeat;
const pad: typeof lib_plankton.string.pad;
const contains: typeof lib_plankton.string.contains;
const startsWith: typeof lib_plankton.string.startsWith;
const endsWith: typeof lib_plankton.string.endsWith;
const count_occourrences: typeof lib_plankton.string.count_occourrences;
const coin: typeof lib_plankton.string.coin;
const stance: typeof lib_plankton.string.coin;
const cut: typeof lib_plankton.string.cut;
}
declare namespace lib_plankton.string {
/**
* an implementation of c sprintf
* @param {string} string format string
* @param {array} args arguments which should be filled into
* @returns {string}
*/
var sprintf: (input: string, args?: Array<any>, original?: any) => string;
/**
* an implementation of c printf
* @param {string} string format string
* @param {array} args arguments which should be filled into
* @returns {string}
*/
function printf(format: any, args: any): void;
}
declare var sprintf: (input: string, args?: Array<any>, original?: any) => string;
declare var printf: typeof lib_plankton.string.printf;
declare var eml_log: any;
declare var track_exports: any;
declare var make_logger: (prefix: any, current_loglevel: any) => (obj: any, lvl: any) => void;
declare namespace lib_plankton.code {
/**
* @author fenris
*/
interface interface_code<type_from, type_to> {
/**
* @author fenris
*/
encode(x: type_from): type_to;
/**
* @author fenris
*/
decode(x: type_to): type_from;
}
}
declare namespace lib_plankton.code {
/**
* @author fenris
*/
type type_code<type_from, type_to> = {
/**
* @author fenris
*/
encode: (x: type_from) => type_to;
/**
* @author fenris
*/
decode: (x: type_to) => type_from;
};
}
declare namespace lib_plankton.code {
/**
* @author fenris
*/
function inverse_encode<type_from, type_to>(decode: (to: type_to) => type_from, to: type_to): type_from;
/**
* @author fenris
*/
function inverse_decode<type_from, type_to>(encode: (from: type_from) => type_to, from: type_from): type_to;
}
declare namespace lib_plankton.code {
/**
* @author fenris
*/
class class_code_inverse<type_from, type_to> implements interface_code<type_to, type_from> {
/**
* @author fenris
*/
protected subject: interface_code<type_from, type_to>;
/**
* @author fenris
*/
constructor(subject: interface_code<type_from, type_to>);
/**
* @implementation
* @author fenris
*/
encode(to: type_to): type_from;
/**
* @implementation
* @author fenris
*/
decode(from: type_from): type_to;
}
}
declare namespace lib_plankton.code {
/**
* @author fenris
*/
function pair_encode<type_from, type_between, type_to>(encode_first: (from: type_from) => type_between, encode_second: (between: type_between) => type_to, from: type_from): type_to;
/**
* @author fenris
*/
function pair_decode<type_from, type_between, type_to>(decode_first: (between: type_between) => type_from, decode_second: (to: type_to) => type_between, to: type_to): type_from;
}
declare namespace lib_plankton.code {
/**
* @author fenris
*/
class class_code_pair<type_from, type_between, type_to> implements interface_code<type_from, type_to> {
/**
* @author fenris
*/
protected first: interface_code<type_from, type_between>;
/**
* @author fenris
*/
protected second: interface_code<type_between, type_to>;
/**
* @author fenris
*/
constructor(first: interface_code<type_from, type_between>, second: interface_code<type_between, type_to>);
/**
* @implementation
* @author fenris
*/
encode(from: type_from): type_to;
/**
* @implementation
* @author fenris
*/
decode(to: type_to): type_from;
}
}
declare namespace lib_plankton.code {
/**
* @author fenris
*/
function chain_encode(encode_links: Array<(from: any) => any>, from: any): any;
/**
* @author fenris
*/
function chain_decode(decode_links: Array<(to: any) => any>, to: any): any;
}
declare namespace lib_plankton.code {
/**
* @author fenris
*/
class class_code_chain implements interface_code<any, any> {
/**
* @author fenris
*/
protected links: Array<interface_code<any, any>>;
/**
* @author fenris
*/
constructor(links: Array<interface_code<any, any>>);
/**
* @implementation
* @author fenris
*/
encode(from: any): any;
/**
* @implementation
* @author fenris
*/
decode(to: any): any;
}
}
declare namespace lib_plankton.code {
/**
* @author Christian Fraß <frass@greenscale.de>
*/
type type_flatten_from = Array<{
[name: string]: any;
}>;
/**
* @author Christian Fraß <frass@greenscale.de>
*/
type type_flatten_to = {
keys: Array<string>;
data: Array<Array<any>>;
};
/**
* @author Christian Fraß <frass@greenscale.de>
*/
function flatten_encode(from: type_flatten_from, keys?: Array<string>): type_flatten_to;
/**
* @author Christian Fraß <frass@greenscale.de>
*/
function flatten_decode(to: type_flatten_to): type_flatten_from;
}
declare namespace lib_plankton.code {
/**
* @author fenris
*/
class class_code_flatten implements interface_code<type_flatten_from, type_flatten_to> {
/**
* @author fenris
*/
constructor();
/**
* @implementation
* @author fenris
*/
encode(x: type_flatten_from): type_flatten_to;
/**
* @implementation
* @author fenris
*/
decode(x: type_flatten_to): type_flatten_from;
}
}
declare namespace lib_plankton.json {
/**
* @author fenris
*/
function encode(x: any, formatted?: boolean): string;
/**
* @author fenris
*/
function decode(x: string): any;
}
declare namespace lib_plankton.json {
/**
* @author fenris
*/
class class_json implements lib_plankton.code.interface_code<any, string> {
/**
* @author fenris
*/
constructor();
/**
* @implementation
* @author fenris
*/
encode(x: any): string;
/**
* @implementation
* @author fenris
*/
decode(x: string): any;
}
}
declare namespace lib_plankton.file {
/**
* @author fenris
*/
function read(path: string): Promise<string>;
/**
* @author fenris
*/
function read_buffer(path: string): Promise<Buffer>;
/**
* @author fenris
*/
function read_stdin(): Promise<string>;
/**
* @author fenris
*/
function write(path: string, content: string, options?: {
encoding?: string;
}): Promise<void>;
/**
* @author fenris
*/
function write_buffer(path: string, content: Buffer, options?: {}): Promise<void>;
}
declare namespace lib_plankton.prog {
/**
*/
abstract class struct_expression {
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_expression_variable extends struct_expression {
name: string;
constructor(name: string);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_expression_literal extends struct_expression {
value: any;
constructor(value: any);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_expression_dict extends struct_expression {
fields: Array<{
key: string;
value: struct_expression;
}>;
constructor(fields: Array<{
key: string;
value: struct_expression;
}>);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_expression_abstraction extends struct_expression {
arguments: Array<{
name: string;
type: (null | struct_type);
}>;
output_type: (null | struct_type);
body: Array<struct_statement>;
constructor(arguments_: Array<{
name: string;
type: (null | struct_type);
}>, output_type: (null | struct_type), body: Array<struct_statement>);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_expression_function_application extends struct_expression {
head: struct_expression;
arguments: Array<struct_expression>;
constructor(head: struct_expression, arguments_: Array<struct_expression>);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_expression_projection extends struct_expression {
source: struct_expression;
index: struct_expression;
constructor(source: struct_expression, index: struct_expression);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_expression_fieldaccess extends struct_expression {
structure: struct_expression;
fieldname: string;
constructor(structure: struct_expression, fieldname: string);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_expression_operation_comparison extends struct_expression {
left: struct_expression;
right: struct_expression;
constructor(left: struct_expression, right: struct_expression);
}
}
declare namespace lib_plankton.prog {
/**
*/
abstract class struct_type {
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_type_literal extends struct_type {
value: struct_expression;
constructor(value: struct_expression);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_type_any extends struct_type {
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_type_void extends struct_type {
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_type_boolean extends struct_type {
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_type_integer extends struct_type {
constructor();
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_type_string extends struct_type {
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_type_list extends struct_type {
element: struct_type;
constructor(element: struct_type);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_type_map extends struct_type {
key: struct_type;
value: struct_type;
constructor(key: struct_type, value: struct_type);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_type_record extends struct_type {
fields: Array<{
name: string;
type: struct_type;
mandatory: boolean;
}>;
constructor(fields: Array<{
name: string;
type: struct_type;
mandatory: boolean;
}>);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_type_function extends struct_type {
arguments: Array<struct_type>;
target: struct_type;
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_type_construction extends struct_type {
name: string;
arguments: (null | Array<struct_type>);
constructor(name: string, arguments_: (null | Array<struct_type>));
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_type_union extends struct_type {
left: struct_type;
right: struct_type;
constructor(left: struct_type, right: struct_type);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_type_intersection extends struct_type {
left: struct_type;
right: struct_type;
}
}
declare namespace lib_plankton.prog {
/**
*/
abstract class struct_statement {
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_statement_block extends struct_statement {
statements: Array<struct_statement>;
constructor(statements: Array<struct_statement>);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_statement_type_definition extends struct_statement {
name: string;
type: struct_type;
constructor(name: string, type: struct_type);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_statement_declaration extends struct_statement {
constant: boolean;
name: string;
type: (null | struct_type);
value: (null | struct_expression);
constructor(constant: boolean, name: string, type: (null | struct_type), value: (null | struct_expression));
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_statement_assignment extends struct_statement {
name: string;
value: (null | struct_expression);
constructor(name: string, value: (null | struct_expression));
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_statement_function_definition extends struct_statement {
name: string;
arguments: Array<{
name: string;
type: (null | struct_type);
}>;
output_type: (null | struct_type);
body: Array<struct_statement>;
constructor(name: string, arguments_: Array<{
name: string;
type: (null | struct_type);
}>, output_type: (null | struct_type), body: Array<struct_statement>);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_statement_return extends struct_statement {
expression: struct_expression;
constructor(expression: struct_expression);
}
}
declare namespace lib_plankton.prog {
/**
*/
class struct_program {
statements: Array<struct_statement>;
constructor(statements: Array<struct_statement>);
}
}
declare namespace lib_plankton.prog {
/**
*/
type type_output = {
render_expression: ((expression: struct_expression) => string);
render_type: ((type: struct_type) => string);
render_statement: ((program: struct_statement) => string);
render_program: ((program: struct_program) => string);
};
}
declare namespace lib_plankton.prog {
/**
*/
function render_type(type: struct_type, options?: {
indent?: boolean;
level?: int;
}): string;
/**
*/
function render_expression(expression: struct_expression, options?: {
indent?: boolean;
level?: int;
}): string;
/**
*/
function render_statement(statement: struct_statement, options?: {
indent?: boolean;
level?: int;
}): string;
/**
*/
function render_program(program: struct_program): string;
/**
*/
function output_typescript(): type_output;
}
declare namespace lib_plankton.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 namespace lib_plankton.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<string>;
indicators_long: Array<string>;
}): 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 namespace lib_plankton.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;
}
}