chris-l / php-unparser

A JavaScript based code generator, to unparse glayzzle/php-parser compatible AST back to code.
https://chris-l.github.io/php-unparser/
33 stars 12 forks source link

How much is this module support nodejs version #4

Closed iptop closed 7 years ago

iptop commented 7 years ago

I use nodejs v6.1.0,The following error occurred `C:\Users\Administrator\Desktop\php-test>node index.js C:\Users\Administrator\Desktop\php-test\node_modules\php-unparser\node_translators\index.js:26 throw new Error( ^

Error: Unhandled node type [use] at CodeGen.process (C:\Users\Administrator\Desktop\php-test\node_modules\php-unparser\node_translators\index.js:26:13) at C:\Users\Administrator\Desktop\php-test\node_modules\php-unparser\node_translators\helper\body.js:15:30 at Array.map (native) at module.exports (C:\Users\Administrator\Desktop\php-test\node_modules\php-unparser\node_translators\helper\body.js:11:14) at CodeGen.module.exports [as program] (C:\Users\Administrator\Desktop\php-test\node_modules\php-unparser\node_translators\program.js:10:7) at CodeGen.process (C:\Users\Administrator\Desktop\php-test\node_modules\php-unparser\node_translators\index.js:24:29) at module.exports (C:\Users\Administrator\Desktop\php-test\node_modules\php-unparser\index.js:8:18) at Object. (C:\Users\Administrator\Desktop\php-test\index.js:6:13) at Module._compile (module.js:541:32) at Object.Module._extensions..js (module.js:550:10)

`

ichiriac commented 7 years ago

Hi @iptop,

This module is compatible with all nodejs version, and even with the browser. The message you can see is caused by the fact the unparser does not know how to handle the use statement from your PHP code.

This project is actually under development, to try it with a larger PHP language support, you can try with this fork : https://github.com/glayzzle/php-unparser (the use statement is implemented)

chris-l commented 7 years ago

I think this would be fixed on the new release.