saresend/dotfile-parser

Quoted identifiers should be unquoted

Closed this issue · 1 comments

eras commented

E.g. the dot-file:

digraph {
  "a" -> a;
}

represents a loop according to graphviz; however with dotfile-parser you have two nodes with distinct identifiers, as the quoting is not removed.


I realize this might need quite a few changes, as the tokens from logos' lexer are used directly.

One option to implement this would be to have mapping functionality in PeekableLexer to map parsed tokens into other tokens (or same ones with different contents). This would need only changing the construction sites of PeekableLexers and maybe renaming it to AugmentedLexer or some such :).

eras commented

I noticed there's a way easier solution using logos callbacks: https://docs.rs/logos/latest/logos/index.html#callbacks