Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mini-parse refactors #60

Open
wants to merge 63 commits into
base: main
Choose a base branch
from
Open

Mini-parse refactors #60

wants to merge 63 commits into from

Conversation

stefnotch
Copy link
Contributor

@stefnotch stefnotch commented Jan 30, 2025

While working with the mini-parse library, I found a few bits that I wanted to tweak. This PR does that, and tries to merge it into the import-rework branch. With these changes then in place, we can merge import-rework into the main branch.

This PR does the following

  • Replaces the mini-parse tokenizing and lexing with a new Stream abstraction. To avoid having to rewrite all the tests, the existing tokenizing and lexing implementations now simply call the Stream stuff under the hood.
  • Replaces the WESL tokenizing with a bespoke tokenizer.
    • CommentsGrammar.ts got removed
  • Adds an assertUnreachable function. Super cool for saying that a branch of an if statement should never be reachable, and getting the Typescript compiler to check it
  • Adds types for expression elements, but does not use them yet.

Fix #46

@stefnotch stefnotch marked this pull request as ready for review February 1, 2025 19:39
@stefnotch
Copy link
Contributor Author

I think this is ready to be merged. Time to get M1 done!

@stefnotch stefnotch mentioned this pull request Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Unprioritized
Development

Successfully merging this pull request may close these issues.

add hook in tokenizer to recognize comments for speedier parsing
2 participants