by vinceguidry · 8y ago · 0 comments
In my side projects, generally I'll hand-write a parser with regular expressions because I haven't yet found one I actually like both looking at and editing. I can fix every single other problem except that one. With SAN, the issue is the bracket delimiters. I hate futzing with them, just let me use tabs. I want this:
Monthly Recurring
Patreon: 8 | 9/17/2018 | 2mo - Acc: Capital One - Tags: arts
Workflowy: 4.99 | 9/17/2018 | 6mo - Acc: Amex - Tags: tools
RubyTapas: 15 | 9/17/2018 | 6mo - Acc: Amex - Tags: education
Verizon: 70.17 | 9/17/2018 | 6mo - Acc: Amex - Tags: utilities,tools
This is easy to look at, easy to edit with a text editor, and, once the parser's written, dead simple with Ruby POROs, easy to parse into queryable data structures.I have yet to find any format that's intended to be human-editable that doesn't actually feel 'nice to the touch'. So I just make my own.
When hand-editing the format above, I generally don't type in a whole line at a time. I'll just add in the basics, and fill it out later, perhaps with machine processing. Tags in particular are easy to copy-paste in by hand and are generally the last part of the line.
I hate, hate, hate the ambiguity and the flavor of the week tokenization/operator precedence/does it trim whitespace questions.
This is JSON's biggest strength: it's trivially unambiguous.
The reason for brackets are auto formatting by the san CLI (think go/rust fmt)
If my configuration needs auto-formatting, something's gone very very wrong in the design of my application.