You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wavedrom GUI supports IIFE, but wavedrom-cli does not. It would be good to have better compatibility between the 2 tools, to avoid having to convert existing .js files to .json5.
This is the output when trying to convert .js files:
Error:
SyntaxError: JSON5: invalid character '(' at 1:1
at syntaxError (C:\Users\XYZI\Apps_DONT_DELETE\node-v18.15.0-win-x64\node_modules\wavedrom-cli\node_modules\json5\lib\parse.js:1110:17)
Expected result:
IIFE would be evaluated first, then its returned result would be used to create the waveform.
The text was updated successfully, but these errors were encountered:
I have a very similar result with recent (July 2024) wavedrom-cli.js; to reproduce, try it with the Hitchhiker's Guide closing example (that features an IIFE): on Web editor it works fine, with the downloaded wavedrom-cli.js it does not (error very similar to that reported by tpoikeka).
Other Hitchhikers' examples I tried worked fine.
SyntaxError: JSON5: invalid character '(' at 1:1
at syntaxError ($HOME/node_modules/json5/lib/parse.js:1110:17)
at invalidChar ($HOME/node_modules/json5/lib/parse.js:1055:12)
at Object.value ($HOME/node_modules/json5/lib/parse.js:309:15)
at lex ($HOME/node_modules/json5/lib/parse.js:100:42)
at Object.parse ($HOME/node_modules/json5/lib/parse.js:25:17)
at $HOME/misc/wavedrom/git/wavedrom-cli.js:37:24
at $HOME/node_modules/graceful-fs/graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3) {
lineNumber: 1,
columnNumber: 1
}
Code:
(function (P,F,T) {
var i,data = [];
for (i = 0; i < P; i++) {
data.push(String.fromCharCode(F.charCodeAt(0)+i))
};
data.push(T);
return {signal: [
{name: 'clk', wave: "p"+".".repeat(P-1)+"|p."},
{name: 'bin', wave: '='.repeat(P)+"|=x", data: data}
]};
})(5,"d","z")
Wavedrom GUI supports IIFE, but wavedrom-cli does not. It would be good to have better compatibility between the 2 tools, to avoid having to convert existing .js files to .json5.
This is the output when trying to convert .js files:
Expected result:
IIFE would be evaluated first, then its returned result would be used to create the waveform.
The text was updated successfully, but these errors were encountered: