diff --git a/lib/plankton/plankton.d.ts b/lib/plankton/plankton.d.ts index ffc5761..7f1bf51 100644 --- a/lib/plankton/plankton.d.ts +++ b/lib/plankton/plankton.d.ts @@ -925,6 +925,215 @@ declare namespace lib_plankton.file { */ function write_buffer(path: string, content: Buffer, options?: {}): Promise; } +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_function_application extends struct_expression { + head: struct_expression; + arguments: Array; + constructor(head: struct_expression, arguments_: Array); + } +} +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_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; + target: struct_type; + } +} +declare namespace lib_plankton.prog { + /** + */ + class struct_type_construction extends struct_type { + name: string; + arguments: (null | Array); + constructor(name: string, arguments_: (null | Array)); + } +} +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_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); + } +} +declare namespace lib_plankton.prog { + /** + */ + class struct_program { + statements: Array; + constructor(statements: Array); + } +} +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_expression(expression: struct_expression): string; + /** + */ + function render_type(type: struct_type): string; + /** + */ + function render_statement(statement: struct_statement): string; + /** + */ + function render_program(program: struct_program): string; + /** + */ + function output_typescript(): type_output; +} declare namespace lib_plankton.args { /** */ diff --git a/lib/plankton/plankton.js b/lib/plankton/plankton.js index 7c895a7..780aa43 100644 --- a/lib/plankton/plankton.js +++ b/lib/plankton/plankton.js @@ -2729,7 +2729,7 @@ var lib_plankton; return (new Promise(function (resolve, reject) { nm_fs.readFile(path, { "encoding": "utf8", - "flag": "r", + "flag": "r" }, function (error, content) { if (error == null) { resolve(content); @@ -2748,7 +2748,7 @@ var lib_plankton; var nm_fs = require("fs"); return (new Promise(function (resolve, reject) { nm_fs.readFile(path, { - "flag": "r", + "flag": "r" }, function (error, content) { if (error == null) { resolve(content); @@ -2785,13 +2785,13 @@ var lib_plankton; function write(path, content, options) { if (options === void 0) { options = {}; } options = Object.assign({ - "encoding": "utf-8", + "encoding": "utf-8" }, options); var nm_fs = require("fs"); return (new Promise(function (resolve, reject) { nm_fs.writeFile(path, content, { "encoding": options.encoding, - "flag": "w", + "flag": "w" }, function (error) { if (error == null) { resolve(undefined); @@ -2812,7 +2812,7 @@ var lib_plankton; var nm_fs = require("fs"); return (new Promise(function (resolve, reject) { nm_fs.writeFile(path, content, { - "flag": "w", + "flag": "w" }, function (error) { if (error == null) { resolve(undefined); @@ -2826,6 +2826,1038 @@ var lib_plankton; file.write_buffer = write_buffer; })(file = lib_plankton.file || (lib_plankton.file = {})); })(lib_plankton || (lib_plankton = {})); +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_expression = /** @class */ (function () { + function struct_expression() { + } + return struct_expression; + }()); + prog.struct_expression = struct_expression; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_expression_variable = /** @class */ (function (_super) { + __extends(struct_expression_variable, _super); + function struct_expression_variable(name) { + var _this = _super.call(this) || this; + _this.name = name; + return _this; + } + return struct_expression_variable; + }(prog.struct_expression)); + prog.struct_expression_variable = struct_expression_variable; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_expression_literal = /** @class */ (function (_super) { + __extends(struct_expression_literal, _super); + function struct_expression_literal(value) { + var _this = _super.call(this) || this; + _this.value = value; + return _this; + } + return struct_expression_literal; + }(prog.struct_expression)); + prog.struct_expression_literal = struct_expression_literal; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_expression_function_application = /** @class */ (function (_super) { + __extends(struct_expression_function_application, _super); + function struct_expression_function_application(head, arguments_) { + var _this = _super.call(this) || this; + _this.head = head; + _this.arguments = arguments_; + return _this; + } + return struct_expression_function_application; + }(prog.struct_expression)); + prog.struct_expression_function_application = struct_expression_function_application; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_expression_operation_comparison = /** @class */ (function (_super) { + __extends(struct_expression_operation_comparison, _super); + function struct_expression_operation_comparison(left, right) { + var _this = _super.call(this) || this; + _this.left = left; + _this.right = right; + return _this; + } + return struct_expression_operation_comparison; + }(prog.struct_expression)); + prog.struct_expression_operation_comparison = struct_expression_operation_comparison; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_type = /** @class */ (function () { + function struct_type() { + } + return struct_type; + }()); + prog.struct_type = struct_type; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_type_literal = /** @class */ (function (_super) { + __extends(struct_type_literal, _super); + function struct_type_literal(value) { + var _this = _super.call(this) || this; + _this.value = value; + return _this; + } + return struct_type_literal; + }(prog.struct_type)); + prog.struct_type_literal = struct_type_literal; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_type_boolean = /** @class */ (function (_super) { + __extends(struct_type_boolean, _super); + function struct_type_boolean() { + return _super !== null && _super.apply(this, arguments) || this; + } + return struct_type_boolean; + }(prog.struct_type)); + prog.struct_type_boolean = struct_type_boolean; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_type_integer = /** @class */ (function (_super) { + __extends(struct_type_integer, _super); + function struct_type_integer() { + return _super.call(this) || this; + } + return struct_type_integer; + }(prog.struct_type)); + prog.struct_type_integer = struct_type_integer; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_type_string = /** @class */ (function (_super) { + __extends(struct_type_string, _super); + function struct_type_string() { + return _super !== null && _super.apply(this, arguments) || this; + } + return struct_type_string; + }(prog.struct_type)); + prog.struct_type_string = struct_type_string; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_type_list = /** @class */ (function (_super) { + __extends(struct_type_list, _super); + function struct_type_list(element) { + var _this = _super.call(this) || this; + _this.element = element; + return _this; + } + return struct_type_list; + }(prog.struct_type)); + prog.struct_type_list = struct_type_list; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_type_map = /** @class */ (function (_super) { + __extends(struct_type_map, _super); + function struct_type_map(key, value) { + var _this = _super.call(this) || this; + _this.key = key; + _this.value = value; + return _this; + } + return struct_type_map; + }(prog.struct_type)); + prog.struct_type_map = struct_type_map; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_type_record = /** @class */ (function (_super) { + __extends(struct_type_record, _super); + function struct_type_record(fields) { + var _this = _super.call(this) || this; + _this.fields = fields; + return _this; + } + return struct_type_record; + }(prog.struct_type)); + prog.struct_type_record = struct_type_record; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_type_function = /** @class */ (function (_super) { + __extends(struct_type_function, _super); + function struct_type_function() { + return _super !== null && _super.apply(this, arguments) || this; + } + return struct_type_function; + }(prog.struct_type)); + prog.struct_type_function = struct_type_function; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_type_construction = /** @class */ (function (_super) { + __extends(struct_type_construction, _super); + function struct_type_construction(name, arguments_) { + var _this = _super.call(this) || this; + _this.name = name; + _this.arguments = arguments_; + return _this; + } + return struct_type_construction; + }(prog.struct_type)); + prog.struct_type_construction = struct_type_construction; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_type_union = /** @class */ (function (_super) { + __extends(struct_type_union, _super); + function struct_type_union(left, right) { + var _this = _super.call(this) || this; + _this.left = left; + _this.right = right; + return _this; + } + return struct_type_union; + }(prog.struct_type)); + prog.struct_type_union = struct_type_union; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_type_intersection = /** @class */ (function (_super) { + __extends(struct_type_intersection, _super); + function struct_type_intersection() { + return _super !== null && _super.apply(this, arguments) || this; + } + return struct_type_intersection; + }(prog.struct_type)); + prog.struct_type_intersection = struct_type_intersection; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_statement = /** @class */ (function () { + function struct_statement() { + } + return struct_statement; + }()); + prog.struct_statement = struct_statement; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_statement_type_definition = /** @class */ (function (_super) { + __extends(struct_statement_type_definition, _super); + function struct_statement_type_definition(name, type) { + var _this = _super.call(this) || this; + _this.name = name; + _this.type = type; + return _this; + } + return struct_statement_type_definition; + }(prog.struct_statement)); + prog.struct_statement_type_definition = struct_statement_type_definition; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_statement_declaration = /** @class */ (function (_super) { + __extends(struct_statement_declaration, _super); + function struct_statement_declaration(constant, name, type, value) { + var _this = _super.call(this) || this; + _this.constant = constant; + _this.name = name; + _this.type = type; + _this.value = value; + return _this; + } + return struct_statement_declaration; + }(prog.struct_statement)); + prog.struct_statement_declaration = struct_statement_declaration; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_statement_assignment = /** @class */ (function (_super) { + __extends(struct_statement_assignment, _super); + function struct_statement_assignment() { + return _super !== null && _super.apply(this, arguments) || this; + } + return struct_statement_assignment; + }(prog.struct_statement)); + prog.struct_statement_assignment = struct_statement_assignment; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + var struct_program = /** @class */ (function () { + function struct_program(statements) { + this.statements = statements; + } + return struct_program; + }()); + prog.struct_program = struct_program; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +/* +This file is part of »bacterio-plankton:prog«. + +Copyright 2016-2023 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' + + +»bacterio-plankton:prog« is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +»bacterio-plankton:prog« is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with »bacterio-plankton:prog«. If not, see . + */ +var lib_plankton; +(function (lib_plankton) { + var prog; + (function (prog) { + /** + */ + function render_expression(expression) { + if (expression instanceof prog.struct_expression_variable) { + var expression_variable = expression; + return expression.name; + } + else if (expression instanceof prog.struct_expression_literal) { + var expression_literal = expression; + return JSON.stringify(expression_literal.value); + } + else if (expression instanceof prog.struct_expression_function_application) { + var expression_function_application = expression; + return lib_plankton.string.coin("{{name}}({{arguments}})", { + "name": render_expression(expression_function_application.head), + "arguments": (expression_function_application.arguments + .map(function (argument) { return render_expression(argument); }) + .join(", ")) + }); + } + else if (expression instanceof prog.struct_expression_operation_comparison) { + var expression_operation_comparison = expression; + return lib_plankton.string.coin("({{left}} === {{right}})", { + "left": render_expression(expression_operation_comparison.left), + "right": render_expression(expression_operation_comparison.right) + }); + } + else { + throw (new Error("unhandled expression: " + String(expression))); + } + } + prog.render_expression = render_expression; + /** + */ + function render_type(type) { + if (type instanceof prog.struct_type_literal) { + var type_literal = type; + return render_expression(type_literal.value); + } + else if (type instanceof prog.struct_type_boolean) { + var type_boolean = type; + return "boolean"; + } + else if (type instanceof prog.struct_type_integer) { + var type_integer = type; + return "number"; + } + else if (type instanceof prog.struct_type_string) { + var type_string = type; + return "string"; + } + else if (type instanceof prog.struct_type_list) { + var type_list = type; + return lib_plankton.string.coin("Array<{{element}}>", { + "element": render_type(type_list.element) + }); + } + else if (type instanceof prog.struct_type_map) { + var type_map = type; + return lib_plankton.string.coin("Record<{{key}}, {{value}}>", { + "key": render_type(type_map.key), + "value": render_type(type_map.value) + }); + } + else if (type instanceof prog.struct_type_record) { + var type_record = type; + return lib_plankton.string.coin("{{{fields}}}", { + "fields": (type_record.fields + .map(function (field) { return lib_plankton.string.coin("{{name}} {{assignment}} {{type}}", { + "name": field.name, + "assignment": (field.mandatory ? ":" : "?:"), + "type": render_type(field.type) + }); }) + .join("; ")) + }); + } + else if (type instanceof prog.struct_type_function) { + var type_function = type; + return lib_plankton.string.coin("(({{arguments}}) => {{target}})", { + "arguments": (type_function.arguments + .map(function (argument) { return render_type(argument); }) + .join(", ")), + "target": render_type(type_function.target) + }); + } + else if (type instanceof prog.struct_type_construction) { + var type_construction = type; + return lib_plankton.string.coin("{{name}}{{macro_arguments}}", { + "name": type_construction.name, + "macro_arguments": ((type_construction.arguments === null) + ? "" + : lib_plankton.string.coin("<{{arguments}}>", { + "arguments": (type_construction.arguments + .map(function (argument) { return render_type(argument); }) + .join(", ")) + })) + }); + } + else if (type instanceof prog.struct_type_union) { + var type_union = type; + return lib_plankton.string.coin("({{left}} | {{right}}", { + "left": render_type(type_union.left), + "right": render_type(type_union.right) + }); + } + else if (type instanceof prog.struct_type_intersection) { + var type_intersection = type; + return lib_plankton.string.coin("({{left}} | {{right}}", { + "left": render_type(type_intersection.left), + "right": render_type(type_intersection.right) + }); + } + else { + throw (new Error("unhandled type kind: " + String(type))); + } + } + prog.render_type = render_type; + /** + */ + function render_statement(statement) { + if (statement instanceof prog.struct_statement_type_definition) { + var statement_type_definition = statement; + return lib_plankton.string.coin("type {{name}} = {{type}};\n", { + "name": statement_type_definition.name, + "type": render_type(statement_type_definition.type) + }); + } + if (statement instanceof prog.struct_statement_declaration) { + var statement_declaration = statement; + return lib_plankton.string.coin("{{kind}} {{name}}{{macro_type}}{{macro_value}};\n", { + "kind": (statement_declaration.constant + ? "const" + : "let"), + "name": statement_declaration.name, + "macro_type": ((statement_declaration.type === null) + ? "" + : lib_plankton.string.coin(" : {{type}}", { + "type": render_type(statement_declaration.type) + })), + "macro_value": ((statement_declaration.value === null) + ? "" + : lib_plankton.string.coin(" = {{value}}", { + "value": render_expression(statement_declaration.value) + })) + }); + } + if (statement instanceof prog.struct_statement_assignment) { + var statement_assignment = statement; + return lib_plankton.string.coin("{{name}} = {{value}};\n", { + "name": statement_assignment.name, + "value": render_expression(statement_assignment.value) + }); + } + else { + throw (new Error("unhandled statement: " + String(statement))); + } + } + prog.render_statement = render_statement; + /** + */ + function render_program(program) { + return (program.statements + .map(function (statement) { return render_statement(statement); }) + .join("")); + } + prog.render_program = render_program; + /** + */ + function output_typescript() { + return { + "render_expression": render_expression, + "render_type": render_type, + "render_statement": render_statement, + "render_program": render_program + }; + } + prog.output_typescript = output_typescript; + })(prog = lib_plankton.prog || (lib_plankton.prog = {})); +})(lib_plankton || (lib_plankton = {})); /* This file is part of »bacterio-plankton:args«. @@ -2949,8 +3981,8 @@ var lib_plankton; "info": info, "hidden": hidden, "parameters": { - "index": index, - }, + "index": index + } })); }; /** @@ -2968,8 +4000,8 @@ var lib_plankton; "hidden": hidden, "parameters": { "indicators_short": indicators_short, - "indicators_long": indicators_long, - }, + "indicators_long": indicators_long + } })); }; /** @@ -3215,17 +4247,17 @@ var lib_plankton; "symbols": { "delimiter": " ", "prefix": "--", - "assignment": "=", - }, + "assignment": "=" + } }, "url": { "symbols": { "delimiter": "&", "prefix": "", - "assignment": "=", + "assignment": "=" } } - }, + } }; /** * @author fenris @@ -3302,14 +4334,14 @@ var lib_plankton; "pattern_from": pattern_from, "pattern_to": pattern_to, "input": input, - "result": result, + "result": result }); input = result; } } } lib_plankton.log.debug("lib_args:read:current_input", { - "input": input, + "input": input }); } // parsing @@ -3320,18 +4352,18 @@ var lib_plankton; var index_expected_1 = 0; parts.forEach(function (part) { lib_plankton.log.debug("lib_args:read:analyzing", { - "part": part, + "part": part }); var found = [ function () { lib_plankton.log.debug("lib_args:read:probing_as_volatile", { - "part": part, + "part": part }); for (var _i = 0, _a = Object.entries(_this.filter(args.enum_kind.volatile)); _i < _a.length; _i++) { var _b = _a[_i], name = _b[0], argument = _b[1]; lib_plankton.log.debug("lib_args:read:probing_as_volatile:trying", { "part": part, - "argument": argument.toString(), + "argument": argument.toString() }); var pattern = ""; { @@ -3350,12 +4382,12 @@ var lib_plankton; pattern += pattern_back; } lib_plankton.log.debug("lib_args:read:probing_as_volatile:pattern", { - "pattern": pattern, + "pattern": pattern }); var regexp = new RegExp(pattern); var matching = regexp.exec(part); lib_plankton.log.debug("lib_args:read:probing_as_volatile:matching", { - "matching": matching, + "matching": matching }); if (matching == null) { // do nothing @@ -3369,7 +4401,7 @@ var lib_plankton; }, function () { lib_plankton.log.debug("lib_args:read:probing_as_positional", { - "part": part, + "part": part }); var positional = _this.filter(args.enum_kind.positional); for (var _i = 0, _a = Object.entries(positional); _i < _a.length; _i++) { @@ -3380,7 +4412,7 @@ var lib_plankton; else { lib_plankton.log.debug("lib_args:read:probing_as_positional:trying", { "part": part, - "argument": argument.toString(), + "argument": argument.toString() }); var pattern = ""; { @@ -3389,12 +4421,12 @@ var lib_plankton; pattern += pattern_back; } lib_plankton.log.debug("lib_args:read:probing_as_positional:pattern", { - "pattern": pattern, + "pattern": pattern }); var regexp = new RegExp(pattern); var matching = regexp.exec(part); lib_plankton.log.debug("lib_args:read:probing_as_positional:matching", { - "matching": matching, + "matching": matching }); if (matching == null) { return false; @@ -3411,7 +4443,7 @@ var lib_plankton; ].some(function (x) { return x(); }); if (!found) { lib_plankton.log.warning("lib_args:read:could_not_parse", { - "part": part, + "part": part }); } }); diff --git a/tools/get-plankton b/tools/get-plankton index 673b026..2c286ca 100755 --- a/tools/get-plankton +++ b/tools/get-plankton @@ -6,6 +6,7 @@ modules="${modules} base" modules="${modules} string" modules="${modules} json" modules="${modules} file" +modules="${modules} prog" modules="${modules} args" mkdir -p lib/plankton