rust-simplicity icon indicating copy to clipboard operation
rust-simplicity copied to clipboard

human_encoding: Expose `simplicity::human_encoding::parse::ast::Token` to public

Open ikripaka opened this issue 3 weeks ago • 0 comments

Hi, everyone!

I've been working on some improvements to the Simplicity ecosystem.

The VS Code integration has been fairly straightforward. I've run into an issue integrating with simplicityhl-lsp. To implement the LSP semantic tokens protocol for simplicityhl-vscode, we need a Simplicity lexer to extract tokens and their spans. It looks like this is already implemented in simplicity::human_encoding::parse::ast::Token, but the enum is currently private. Would you mind exposing it publicly?

Another thing I've noticed is that comments are currently skipped during parsing. https://github.com/BlockstreamResearch/rust-simplicity/blob/7fb2601433ef3aa052b443512f96fc82841c5e1f/src/human_encoding/parse/ast.rs#L112 Would it make sense to either include comments in the Token enum or implement a wrapping structure, FmtTokens (with LineComment, Newline, Whitespace, similar to SimplicityHL)? https://github.com/BlockstreamResearch/SimplicityHL/blob/56e8f39e75a79767b06e02a20659b9bef184ce13/src/lexer.rs#L145 I can implement a formatter for it later.

(Neither of these is particularly urgent, but it's needed for an ecosystem)

ikripaka avatar Nov 12 '26 16:11 ikripaka