joshtemple / lkml

A speedy LookML parser & serializer implemented in pure Python.
MIT License
166 stars 31 forks source link

Parse sets with values that have whitespace following leading hyphens #87

Closed joshtemple closed 10 months ago

joshtemple commented 10 months ago

Closes #86

Note: This breaks the typical paradigm of lkml, which is that round-trip parsing should be possible (parsing and then dumping again should result in the same string).

I've decided to be slightly opinionated here: parsing fields: [ - view.dimension_name ] and then dumping it will result in fields: [ -view.dimension_name ]. Otherwise, I have to support a tricky concept: two literal tokens ('-', 'view.dimension_name') representing a single value in a list, or I have to support a literal token having spaces inside, which makes no sense.

I'm comfortable with this because I don't think - view.dimension_name is a good way to write LookML and shouldn't be actively supported beyond parsing without errors.