test: allow passing of additional configuration #3

Merged
nikku merged 1 commit from alternative-top into master 2020-06-14 21:39:14 +02:00
nikku commented 2020-06-12 11:54:56 +02:00 (Migrated from github.com)

Allows tests to encode additional parser configuration in the test
title. This allows the test to, i.e. override the top to use
when parsing the test expression.

Example:

Other

==>

OtherTop()

Closes https://github.com/lezer-parser/lezer/issues/24

Allows tests to encode additional parser configuration in the test title. This allows the test to, i.e. override the `top` to use when parsing the test expression. Example: ``` Other ==> OtherTop() ``` Closes https://github.com/lezer-parser/lezer/issues/24
marijnh (Migrated from github.com) reviewed 2020-06-12 18:44:32 +02:00
marijnh (Migrated from github.com) commented 2020-06-12 18:44:32 +02:00

Could you do something like /(.*?)(\{.*?\})?/.exec instead here, so that the intention is a bit clearer? The current code will also happily proceed with input like # Foo {bar: 2 and # Foo } baz: 2 { } {} etc.

Could you do something like `/(.*?)(\{.*?\})?/.exec` instead here, so that the intention is a bit clearer? The current code will also happily proceed with input like `# Foo {bar: 2` and `# Foo } baz: 2 { } {}` etc.
marijnh commented 2020-06-12 18:45:09 +02:00 (Migrated from github.com)

Looks great. I added one nitpick comment.

Looks great. I added one nitpick comment.
nikku (Migrated from github.com) reviewed 2020-06-12 22:37:48 +02:00
nikku (Migrated from github.com) commented 2020-06-12 22:37:48 +02:00

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.

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.
marijnh (Migrated from github.com) reviewed 2020-06-14 17:45:34 +02:00
marijnh (Migrated from github.com) commented 2020-06-14 17:45:33 +02:00

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.

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.
nikku (Migrated from github.com) reviewed 2020-06-14 20:04:29 +02:00
nikku (Migrated from github.com) commented 2020-06-14 20:04:29 +02:00

Updated PR + force pushed. Now works with a one-liner, again.

Updated PR + force pushed. Now works with a one-liner, again.
marijnh commented 2020-06-14 21:39:07 +02:00 (Migrated from github.com)

Wonderful, thanks for following up.

Wonderful, thanks for following up.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/generator!3
No description provided.