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
I'm trying to work out how to use the peggy command line to generate the same output as the online version. So far I've been unable.
It looks like the online version prepends the "module.exports = " bit on to the front of whatever it is that the parser generates, that bit isn't being generated by the parser generator itself. But even accounting for that, I can't find a set of command line options that make the rest get generated in the same way. "--format=globals" seems to generate the closest output that I've seen, but even this isn't quite right.
I'm not that expert in javascript, I'm just trying to set up automation of the build process rather than actually developing the parser, or the javascript that makes use of it, so forgive me if my question seems dumb. I've tried looking at the source code of the online version and the source code of the command line, but found neither particularly illuminating.
What gets you closes, is the "--format=globals" output, but the command line generates this:
So there's not currently a command line option that does exactly that. Depending on what you're trying to accomplish --format umd --export-var myParser might be useful. That will allow the .js file to be imported, required, or used with window.myParser in the browser.
No, I'm not sure why the online version does that, so let's keep this bug open for the online version to be normalized in some way.
I'm trying to work out how to use the peggy command line to generate the same output as the online version. So far I've been unable.
It looks like the online version prepends the "module.exports = " bit on to the front of whatever it is that the parser generates, that bit isn't being generated by the parser generator itself. But even accounting for that, I can't find a set of command line options that make the rest get generated in the same way. "--format=globals" seems to generate the closest output that I've seen, but even this isn't quite right.
I'm not that expert in javascript, I'm just trying to set up automation of the build process rather than actually developing the parser, or the javascript that makes use of it, so forgive me if my question seems dumb. I've tried looking at the source code of the online version and the source code of the command line, but found neither particularly illuminating.
What gets you closes, is the "--format=globals" output, but the command line generates this:
The online version generates:
Thanks.
The text was updated successfully, but these errors were encountered: