From b0d2f9869f5768fc0733be6df9f2daa75e50151b Mon Sep 17 00:00:00 2001 From: Manuel Serrano Date: Fri, 5 Jan 2024 21:47:51 +0100 Subject: [PATCH] Fix signame dependency --- lib/compiler.js | 8 ++++---- lib/hhc-compiler.mjs | 5 ++--- lib/hiphop-loader.mjs | 14 +++++++++----- preprocessor/hhaccess.js | 9 ++++++--- test/eval.hh.js | 2 +- test/eval.out | 30 +++++++++++++++--------------- test/loopeach.hh.js | 2 +- 7 files changed, 38 insertions(+), 32 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index d3122b39..8623248c 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -3,8 +3,8 @@ /* ------------------------------------------------------------- */ /* Author : Colin Vidal, Manuel Serrano */ /* Creation : Mon Jul 16 18:06:28 2018 */ -/* Last change : Fri Dec 15 15:37:47 2023 (serrano) */ -/* Copyright : 2018-23 Inria */ +/* Last change : Fri Jan 5 16:49:45 2024 (serrano) */ +/* Copyright : 2018-24 Inria */ /* ------------------------------------------------------------- */ /* HipHop compiler */ /*=====================================================================*/ @@ -84,7 +84,7 @@ class Circuit { function getSignalObject(env, signame, ast_node) { function unbound_error() { - throw error.TypeError(`${ast_node.tag}: unbound signal "${signame}".`, + throw error.TypeError(`${ast_node.tag}: unbound signal ${signame}`, ast_node.loc); } @@ -95,7 +95,7 @@ function getSignalObject(env, signame, ast_node) { if (sigprop.signal) { return sigprop.signal; } else { - throw error.TypeError(`${ast_node.tag}: wrong signal "${signame}".`, + throw error.TypeError(`${ast_node.tag}: wrong signal ${signame}`, ast_node.loc); } } diff --git a/lib/hhc-compiler.mjs b/lib/hhc-compiler.mjs index 47bfb370..3d6f1eff 100644 --- a/lib/hhc-compiler.mjs +++ b/lib/hhc-compiler.mjs @@ -3,8 +3,8 @@ /* ------------------------------------------------------------- */ /* Author : manuel serrano */ /* Creation : Wed Oct 25 08:13:33 2023 */ -/* Last change : Sat Dec 23 14:58:37 2023 (serrano) */ -/* Copyright : 2023 manuel serrano */ +/* Last change : Fri Jan 5 10:29:53 2024 (serrano) */ +/* Copyright : 2023-24 manuel serrano */ /* ------------------------------------------------------------- */ /* HipHop compiler */ /*=====================================================================*/ @@ -128,7 +128,6 @@ function compileHandler(err) { "message": err.msg || err.message, forceexit: true }); - throw "Syntax error."; } else { throw err; } diff --git a/lib/hiphop-loader.mjs b/lib/hiphop-loader.mjs index aff24be8..c3a960bd 100644 --- a/lib/hiphop-loader.mjs +++ b/lib/hiphop-loader.mjs @@ -3,8 +3,8 @@ /* ------------------------------------------------------------- */ /* Author : Manuel Serrano */ /* Creation : Fri Nov 17 08:15:59 2023 */ -/* Last change : Tue Dec 12 09:43:53 2023 (serrano) */ -/* Copyright : 2023 Manuel Serrano */ +/* Last change : Fri Jan 5 10:49:33 2024 (serrano) */ +/* Copyright : 2023-24 Manuel Serrano */ /* ------------------------------------------------------------- */ /* HipHop loader/resolver loaders. */ /*=====================================================================*/ @@ -102,9 +102,13 @@ async function HHcompile(url) { return target; } else { const prog = compile(path); - await prog.output(target); - await prog.sourcemap(target); - return target; + if (prog) { + await prog.output(target); + await prog.sourcemap(target); + return target; + } else { + return false; + } } } diff --git a/preprocessor/hhaccess.js b/preprocessor/hhaccess.js index 3bfac049..ce6de67a 100644 --- a/preprocessor/hhaccess.js +++ b/preprocessor/hhaccess.js @@ -3,8 +3,8 @@ /* ------------------------------------------------------------- */ /* Author : manuel serrano */ /* Creation : Wed Oct 25 10:36:55 2023 */ -/* Last change : Thu Dec 14 08:11:08 2023 (serrano) */ -/* Copyright : 2023 manuel serrano */ +/* Last change : Fri Jan 5 21:21:11 2024 (serrano) */ +/* Copyright : 2023-24 manuel serrano */ /* ------------------------------------------------------------- */ /* This is the version used by the nodejs port (see _hhaccess.hop) */ /* ------------------------------------------------------------- */ @@ -125,7 +125,7 @@ function nodeAccessors(node, axs, iscnt, hhname, accessors) { switch (field.val) { case "signame": - return sigaccess(loc, name, false, false); + return sigaccess(loc, name, true, false); case "now": return sigaccess(loc, name, false, false); case "nowval": @@ -208,6 +208,9 @@ function nodeAccessors(node, axs, iscnt, hhname, accessors) { case "preval": axs.val = true; axs.pre = true; + case "signame": + axs.val = false; + axs.pre = true; } } }); diff --git a/test/eval.hh.js b/test/eval.hh.js index f107617c..54316ce0 100644 --- a/test/eval.hh.js +++ b/test/eval.hh.js @@ -13,4 +13,4 @@ const prog = hh.eval(`hiphop module() { } every(R.now) }`); -const mach = new hh.ReactiveMachine(prog, "ABRO"); +const mach = new hh.ReactiveMachine(prog, "EABRO"); diff --git a/test/eval.out b/test/eval.out index f48dbeda..d77b82e3 100644 --- a/test/eval.out +++ b/test/eval.out @@ -1,30 +1,30 @@ -ABRO> ; +EABRO> ; --- Output: -ABRO> A B; +EABRO> A B; --- Output: O -ABRO> A B; +EABRO> A B; --- Output: -ABRO> R; +EABRO> R; --- Output: -ABRO> A B; +EABRO> A B; --- Output: O -ABRO> A B; +EABRO> A B; --- Output: -ABRO> R; +EABRO> R; --- Output: -ABRO> B; +EABRO> B; --- Output: -ABRO> A; +EABRO> A; --- Output: O -ABRO> A; +EABRO> A; --- Output: -ABRO> B; +EABRO> B; --- Output: -ABRO> R B; +EABRO> R B; --- Output: -ABRO> A; +EABRO> A; --- Output: -ABRO> ; +EABRO> ; --- Output: -ABRO> B; +EABRO> B; --- Output: O diff --git a/test/loopeach.hh.js b/test/loopeach.hh.js index f486efde..efad8f60 100644 --- a/test/loopeach.hh.js +++ b/test/loopeach.hh.js @@ -4,7 +4,7 @@ hiphop module prg() { in I; out O; do { emit O(); - } every( I.now ) + } every(I.now) } export const mach = new hh.ReactiveMachine(prg, "loopeach");