geoffreylitt / wildcard

A browser extension for customizing web apps with a spreadsheet view
https://www.geoffreylitt.com/wildcard/
244 stars 14 forks source link

Add support for underscores to column refs in formulas #14

Closed geoffreylitt closed 4 years ago

geoffreylitt commented 4 years ago

To play with this:

Go to the Ohm Editor: https://ohmlang.github.io/editor/

Copy-paste the grammar from formula.ts into the editor.

There's some weird gotcha with copy-pasting back and forth -- I think when you copy paste from the code to the online editor, you have to replace \\\" with \", and vice versa. But don't worry too much about that -- if you can get it working in the online editor we can figure out how to port that into the code.

I think step 1 would be add a test case with an underscore. Then try editing the grammar to parse it correctly. You can play around with lots of different changes and use the editor to see what they do.

I don't know exactly what the solution is. My initial guess is something like this -- define what a valid character is in a colref, and then define colref as 1+ of those characters put together.

Colref = ColRefChar+
ColRefChar = alnum | "_"

resources for learning ohm:

Let me know if you want help figuring out Ohm, although I'm not an expert.