ITADN

Add feature to add spans tracking source positions in AST nodes

#373Pull RequestErtanic 创建于 2024-11-16
enhancementcrate:fluent-syntaxcrate:fluent-bundle
E
Ertaniccommented
I needed a parser for .ftl files. I found tree-sitter-fluent, but for some reason it couldn't parse a valid file, throwing errors when trying to use replaceable expressions. Decided to use fluent-syntax, but why does the javascript version have node spans but the rust version does not. This PR solves this issue, but since there is usually no need for spans, I hid them behind the `spans` feature. And also to avoid conflicts in tests, because there the tree is formatted, because of which the spans change, the implementation version of `PartialEq` for AST nodes was divided into a `derive` implementation and a manual one. The good idea is to write tests to match the spans, but I'm not sure how best to do that, I need help with this.
合并状态:未合并 16 条评论