aep / pug-rs

pug.js reimplemented in rust for speed
27 stars 7 forks source link

add wasm support and edition 2018 #3

Closed pickfire closed 5 years ago

pickfire commented 5 years ago

Next is to put a package and deploy it. I also tested out neon as well but not included here.

aep commented 5 years ago

thanks!

whats the rationale behind duplicating the entire parse function? the diff is broken due to that, so i can't really see what you changed that requires a difference between wasm and non wasm

pickfire commented 5 years ago

@aep That's just temporary as for now, the error handling for wasm could be better. By the way, is it possible for me to put the bindings for nodejs with neon library here as well or should be start an organization for this?

aep commented 5 years ago

totally happy putting it in here, if you want my review. :)

pickfire commented 5 years ago

@aep Okay, I will put it in another issue. Maybe try to merge review this first.

aep commented 5 years ago

as i said, the current PR is not ok. It duplicates most of the code.

pickfire commented 5 years ago

@aep I removed the duplicates, can you please check again?

pickfire commented 5 years ago

@aep What is the reason behind using pest instead of nom or manual parser other than resulting in more code? Would there be performance impact? I am kinda interested to see how does it differs after rewriting it in nom or manual parser.

As well, I haven't figure out how do we parse the #{stuff}? Passing it into from webassembly? Calling deno?

aep commented 5 years ago

pest separates grammar from parser, making it alot easier to read. nom is probably faster.

interpolation could be supported by passing it to a JS engine, yes. But at that point i'm not sure what the use case would be. If someone wanted to put javascript in their templates, why not just use the original pug parser?

pickfire commented 5 years ago

@aep The rust version of parsing can be a lot faster than the original.

aep commented 5 years ago

Right, I guess that makes some sense.

If you feel like working on that, let me know if you need my peer review :)