hsutter / cppfront

A personal experimental C++ Syntax 2 -> Syntax 1 compiler
Other
5.56k stars 248 forks source link

Feat: Add ability to compile from stdin #1327

Closed vanceism7 closed 3 weeks ago

vanceism7 commented 1 month ago

This PR adds the ability to compile from stdin.

This is useful so that cppfront can compile source code that's been piped in from another program. For my use-case specifically: when working on the LSP server, we already have access to source code within a TextDocument variable.

Prior to this PR, we have to either save the edited content to a temporary file, or save the source file itself prior to invoking cppfront, otherwise we end up with stale diagnostics data.

Happy to fix any issues anyone finds!

Thanks!

vanceism7 commented 1 month ago

Thanks for the reviews!

hsutter commented 3 weeks ago

Thanks for your pull request! It looks like this may be your first contribution to cppfront. I've emailed you the Contributor License Agreement (CLA), and once it's completed I can look at your pull request. Thanks again for your contribution.

vanceism7 commented 3 weeks ago

Thanks Herb! (I had read the in the section about contributing that we needed to sign something, and was wondering where we were supposed to sign, happy to see it just comes through email haha). I've signed and sent back the CLA

hsutter commented 3 weeks ago

Thanks!