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
Comments are removed by the preprocessor, and cannot currently be parsed by pycparser eliben/pycparser#102 Ignoring comments. This therefore has the same underlying cause as #1 Preprocessor constants should be preserved, not expanded.
Idea for how to fix these issues: change the design of transpile-c-to-js to not write out the JavaScript from the AST — instead, have it parse C into the AST, and manipulate the C source as text to make it valid JavaScript, rewriting the C constructs to JS. Since JS is a C-style language, it won't have to be completely rewritten. And we do want to preserve the syntactical structure and style of the source code as much as possible.
Mainly transpile-c-to-js's task would be to find the character ranges of C types, and remove/replace them with JS let, function, arguments, operators, declarations, and so on — keeping everything else mostly intact. For GH-1, may also need to instrument a C preprocessor, to replace #define FOO 1 with const FOO = 1;; as this knowledge is lost when the original source is piped to cpp, then analyzed by pycparser.
Rather than manipulating the AST, Bublé manipulates the source code directly, using the AST as a guide – so there's no costly code generation step at the end.
No description provided.
The text was updated successfully, but these errors were encountered: