Skip to content

Markmap removal - #671

Open
ratmice wants to merge 1 commit into
softdevteam:masterfrom
ratmice:markmap_removal
Open

ratmice wants to merge 1 commit into
softdevteam:masterfrom
ratmice:markmap_removal

Conversation

@ratmice

@ratmice ratmice commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Here is an attempt at replacing the MarkMap structure with HashMap.

I think but am not totally certain that we've replaced the unused errors with the previously added iter_prefix_keys checks in places like nimbleparse. I'm not totally sure we've covered all such places that the unused checks removed here covered though.

Regarding the merge process change, in lrpar we had already removed all of the merge_from code as part of removing Location from the errors emitted there. The second patch here does the same for lrlex. I was kind of uncertain whether to do that in this patch but it seemed like it was easier to drop the patch than to try and explain it.

The second patch then allows the cleanup in the 3rd patch of removing Location entirely.
That one was public and seems like a semver breakage technically, even though I think it was only ever used in hidden
APIs.

@ratmice

ratmice commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

So my thoughts regarding 'lessons learned', here is that a lot of this was attempting to remove duplicated code between nimbleparse, and CTParserBuilder, providing e.g. uniform settings/error handling and the like.

But I think although it hasn't quite been realized yet, is that with CodeGen in the future we can still share alot of that code but without the somewhat painful abstractions and less string marshalling, and jumping through hoops.

Comment thread lrlex/src/lib/codegen.rs Resolved
Comment thread cfgrammar/src/lib/span.rs Resolved
Comment thread lrlex/src/lib/codegen.rs Resolved
@ltratt

ltratt commented Nov 26, 2026

Copy link
Copy Markdown
Member

Overall I very much like this -- it's difficult not to like a PR which deletes so much code while retaining behaviour!

Comment thread lrlex/src/lib/codegen.rs Resolved
Comment thread lrlex/src/lib/codegen.rs Resolved
@ltratt

ltratt commented Nov 27, 2026

Copy link
Copy Markdown
Member

I think this is ready for squashing?

Comment thread cfgrammar/src/lib/header.rs Resolved
@ratmice

ratmice commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

Yeah I agree, and will try squash it this evening, just noted one more thing above.

@ltratt

ltratt commented Nov 28, 2026

Copy link
Copy Markdown
Member

I think we're ready! Please squash.

1. This replaces the `MarkMap` structure with a `HashMap`.
2. Avoid passing `Header` as an argument to `LexSrcEnv`, instead
   we now pass `LexFlags` directly.
3. That then makes it possible to remove the `Location` structure.

This brings lrlex's codegen module more in line with lrpar.
@ratmice

ratmice commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator Author

Squashed, There was one very small copy/paste error in some text which I found while squashing.
"Found bool" changed to "Found numeric".
Unfortunately I no longer see a comparable commit here after squashing.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants