Open
Description
Description
Problem
We have a number of bug reports around problems interpreting complex query lines. For example:
- malformed boolean query for valid regex search that includes () #1500
- Escaping path includes #2078
- Allow parenthesis to be used in search strings in boolean filters #1308
Idea
I have been thinking for some time that as we add more features, our regular expressions are getting more complex.
And it would be worth investigating whether re-using an existing parsing solution would be more sustainable, long-term.
Options
I asked in OMG Discord - #plugin-dev on 2023-05-29, and the replies were:
- Both From River in Discord - plugin-dev 2023-05-29 Mon
- ab1908
- To add to this, ledger-obsidian uses moo for parsing and there's some decent examples in there you could work off of.
- It uses some sort of combination of moo and nearley from what I saw and there were a good number of tests to work with.
- There’s also lezer, but I don’t know whether it’s suited to Tasks
- https://lezer.codemirror.net/
- It also takes some getting used to.
- johanfriis
- https://nearley.js.org/ would be an option to study as well.
Required Steps
-
Establish our requirements for parsers
-
Pick a library
- Review the options listed above (and any more found since)
- See how much they increase release distribution size by
- Show what the code would look like in Tasks
-
Start migrating code, incrementally.
How to Test
Confirm that the existing Jest tests and smoke tests all work.