[mod] cleanup

This commit is contained in:
Christian Fraß 2021-09-19 01:57:25 +02:00
parent bc95017f34
commit d67ca438be
4 changed files with 9 additions and 6 deletions

View file

@ -14,6 +14,10 @@ def evaluate(node):
return (evaluate(node["children"][0]) and evaluate(node["children"][1]))
elif (node["label"] == "disjunction"):
return (evaluate(node["children"][0]) or evaluate(node["children"][1]))
elif (node["label"] == "priorised"):
return evaluate(node["children"][0])
else:
raise ValueError("unhandled label: " + node["label"])
def main():

View file

@ -1,7 +1,7 @@
/*
This file is part of »type2«.
Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
<info@greenscale.de>
»type2« is free software: you can redistribute it and/or modify
@ -38,7 +38,7 @@ async function generate_reader(
path : string
) : Promise<type_myreader>
{
const content : string = await lib_file.read_promise(path);
const content : string = await lib_plankton.file.read(path);
const data : any = JSON.parse(content);
const reader : type_myreader = lib_plankton.lang.class_reader.default_raw(data);
return Promise.resolve<type_myreader>(reader);
@ -84,7 +84,7 @@ async function main(
process.stdout.write(
args_handler.generate_help({
"programname": "type2",
"description": "reads a string from stdin and parses it according to a given grammar to an abstract JSON output",
"description": "reads a string from stdin and parses it according to a given grammar to an abstract syntax tree as JSON",
"author": "Christian Fraß <frass@greenscale.de>",
"executable": "type2",
})
@ -111,7 +111,7 @@ async function main(
// exec
const reader : type_myreader = await generate_reader(args["path"]);
const input_raw : string = await lib_file.read_stdin();
const input_raw : string = await lib_plankton.file.read_stdin();
const result : type_resulttree = reader.run(input_raw.split(""));
if (result === null) {
return Promise.reject<void>(new Error("reading failed"));

View file

@ -7,7 +7,7 @@ cmd_log := echo "--"
cmd_directory_create := mkdir -p
cmd_concatenate := cat
cmd_chmod := chmod
cmd_typescript_compile := tsc --lib es2018
cmd_typescript_compile := tsc --removeComments --lib es2018
## rules
build/type2: source/head.js lib/plankton/plankton.js temp/unlinked.js

View file

@ -1,7 +1,6 @@
#!/usr/bin/env sh
modules=""
modules="${modules} call"
modules="${modules} args"
modules="${modules} file"
modules="${modules} lang"