local tokens support precedence #20

Closed
AlexErrant wants to merge 3 commits from localTokenPrecedence into main
AlexErrant commented 2024-06-17 04:21:13 +02:00 (Migrated from github.com)

This PR makes @local tokens support @precedence.

It's mostly a copy/paste of existing code from buildTokenGroups. Do you want to refactor/extract the common logic? I didn't do it because I'm pretty unfamiliar with the code. I can refactor it if you like the overall idea; I'll probably create 2 methods on TokenSet: validate, and buildTokenGroup, which correspond to the 2 copy/paste blocks below.

This PR makes `@local tokens` support `@precedence`. It's mostly a copy/paste of existing code from `buildTokenGroups`. Do you want to refactor/extract the common logic? I didn't do it because I'm pretty unfamiliar with the code. I can refactor it if you like the overall idea; I'll probably create 2 methods on `TokenSet`: `validate`, and `buildTokenGroup`, which correspond to the 2 copy/paste blocks below.
AlexErrant (Migrated from github.com) reviewed 2024-06-17 04:47:13 +02:00
@ -1759,0 +1823,4 @@
}
// state.tokenGroup = tokenGroup.groupID
}
AlexErrant (Migrated from github.com) commented 2024-06-17 04:44:55 +02:00

A literal copy-paste from buildTokenGroups.

A literal copy-paste from `buildTokenGroups`.
AlexErrant (Migrated from github.com) commented 2024-06-17 04:46:57 +02:00

Also (mostly) a copy-paste from buildTokenGroups. However, I don't know if the commented-out code on Line1824 is necessary. Uncommenting it causes tests to fail, but I'm not sure about its semantics soooo... leaving it in to highlight the fact that I removed it.

Also (mostly) a copy-paste from `buildTokenGroups`. However, I don't know if the commented-out code on Line1824 is necessary. Uncommenting it causes tests to fail, but I'm not sure about its semantics soooo... leaving it in to highlight the fact that I removed it.
marijnh commented 2024-06-17 07:53:34 +02:00 (Migrated from github.com)

Given that local tokens already support @precedence, and your tests case passes with the current code, I'm rather confused what it is you are trying to do here.

Given that local tokens already support `@precedence`, and your tests case passes with the current code, I'm rather confused what it is you are trying to do here.
AlexErrant commented 2024-06-17 16:29:07 +02:00 (Migrated from github.com)

Ulgh my apologies. I was using this playground which was using an old version of generator. I then started implementing without going through the red of TDD.

Ulgh my apologies. I was using [this playground](https://lezer-playground.vercel.app/) which was using an old version of `generator`. I then started implementing without going through the `red` of TDD.

Pull request closed

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!20
No description provided.