kenbot / goggles

Pleasant, yet principled Scala optics DSL
MIT License
195 stars 7 forks source link

String literal indexes #28

Open kenbot opened 7 years ago

kenbot commented 7 years ago

Strings seem a common enough index type that a literal syntax could be useful, ie for JSON or XML documents. Single quotes will be the most convenient. I don't think there is any value in supporting double quotes as well.

kenbot commented 7 years ago

This can and should be done, but it's a bit harder than it looks. The lexer & parser really need to be rewritten and combined into a proper monadic parser, instead of the hokey little Either-thing we have. The usual stream of lexed symbols can't be used, because the symbols might be meaningless text inside a string literal.

I suspect the resulting parser will still be small and tailored enough to justify keeping in the codebase; I am keen to avoid the dependency of a parser combinator library if I can help it.

kenbot commented 7 years ago

Descoping from 1.1; it will be a bit of work, and there are more important things to focus on.