test: allow passing of additional configuration #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "alternative-top"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Allows tests to encode additional parser configuration in the test
title. This allows the test to, i.e. override the
topto usewhen parsing the test expression.
Example:
Closes https://github.com/lezer-parser/lezer/issues/24
Could you do something like
/(.*?)(\{.*?\})?/.execinstead here, so that the intention is a bit clearer? The current code will also happily proceed with input like# Foo {bar: 2and# Foo } baz: 2 { } {}etc.Looks great. I added one nitpick comment.
The regex won't work, unfortunately due to the greedy matching semantics of regex parsing.
I did update the parsing via https://github.com/lezer-parser/lezer-generator/pull/3/commits/e0847ec57a6f8b93a6a4277bf7316ca1a5cd2d76.
Hope that brings the required clarity. The method is now robust enough to potentially handle nested configuration keys, too.
There are
?s after the*s to make them non-greedy, but indeed, it didn't work. Adding a$to the end fixes that. So I still prefer that one-liner to a 13-line parsing function.Updated PR + force pushed. Now works with a one-liner, again.
Wonderful, thanks for following up.