rust-analyzer / rowan

Apache License 2.0
704 stars 58 forks source link

Allow non UTF-8 source code #157

Closed edgarogh closed 1 year ago

edgarogh commented 1 year ago

Currently, rowan requires string slices. However, not all programming languages require UTF-8, which makes it impossible to represent them using a rowan tree without adding arbitrary rules to the existing specification. It would be convenient if we could, for instance, use byte slices as our base source code representation. If a maintainer has an idea of how this would work (how to specify whether or not Unicode is enforced using &str), I would love to draft a PR.

matklad commented 1 year ago

This is explicitly out of scope - rowan supports only utf8 documents. The best way to support other encodings would be to fork the library.

edgarogh commented 1 year ago

Ok, thanks for the information, I didn't know that.

edgarogh commented 1 year ago

For anyone reading this, it looks like Rune's syntree library can be a good alternative. And it also provides a solution for #26.