nix-community / rnix-parser

A Nix parser written in Rust [maintainer=@oberblastmeister]
MIT License
366 stars 44 forks source link

Implement reading `SyntaxKind` from strings #163

Open abhillman opened 6 months ago

abhillman commented 6 months ago

Summary & Motivation

After parsing with rnix, I store an intermediate form in JSON which I wish to be able to re-serialize into an AST. Allowing reading SyntaxKind from strings is helpful for this use-case.

Backwards-incompatible changes

n/a

Further context

n/a

oberblastmeister commented 6 months ago

I don't know if I want to pull in the strum dependency for this. There's this issue in rowan for deserialization https://github.com/rust-analyzer/rowan/issues/74. I think you could just store the text and then parse it to deserialize it?