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
Currently we have a fixed set of processor macros/function that are mostly defined in parseTools.js
Adding new macros in JS libraries is possible, but its rather ugly syntax, and has some limitations:
{{{
globalThis.newMacro = () = { .. }
}}}
A major drawback (IIUC) of doing this is that the macros are not available during preprocessing since macros expansion happens after preprocessing. So to use these macros in a preprocessor directive one would need define them in a separate file that is loaded first. e.g. --js-library=my_macros.js --js-library=my_library.js. Here the macros defined in my_macros.js would be available in my_library.js.
One way to improve this would be to allow my_library.js to somehow #include "my_macros.js" .. however that isn't currently how the #include directive works. Currently #include files are placed directly into the output file and don't have macros expanded, so we would need somekind of new #include mechanism.
The text was updated successfully, but these errors were encountered:
Currently we have a fixed set of processor macros/function that are mostly defined in
parseTools.js
Adding new macros in JS libraries is possible, but its rather ugly syntax, and has some limitations:
A major drawback (IIUC) of doing this is that the macros are not available during preprocessing since macros expansion happens after preprocessing. So to use these macros in a preprocessor directive one would need define them in a separate file that is loaded first. e.g.
--js-library=my_macros.js --js-library=my_library.js
. Here the macros defined inmy_macros.js
would be available inmy_library.js
.One way to improve this would be to allow
my_library.js
to somehow#include "my_macros.js"
.. however that isn't currently how the #include directive works. Currently #include files are placed directly into the output file and don't have macros expanded, so we would need somekind of new #include mechanism.The text was updated successfully, but these errors were encountered: