diff --git a/examples/logic/eval b/examples/logic/eval index b917e91..dc41896 100755 --- a/examples/logic/eval +++ b/examples/logic/eval @@ -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(): diff --git a/source/type2.ts b/source/type2.ts index 07b6d3d..c1e1475 100644 --- a/source/type2.ts +++ b/source/type2.ts @@ -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' »type2« is free software: you can redistribute it and/or modify @@ -38,7 +38,7 @@ async function generate_reader( path : string ) : Promise { - 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(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ß ", "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(new Error("reading failed")); diff --git a/tools/makefile b/tools/makefile index cd98f68..21c2f0b 100644 --- a/tools/makefile +++ b/tools/makefile @@ -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 diff --git a/tools/update-plankton b/tools/update-plankton index cf0b6b2..3962356 100755 --- a/tools/update-plankton +++ b/tools/update-plankton @@ -1,7 +1,6 @@ #!/usr/bin/env sh modules="" -modules="${modules} call" modules="${modules} args" modules="${modules} file" modules="${modules} lang"