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

Use a DSL for grammar definition, and add next_token #564

Merged

Conversation

AntonyBlakey
Copy link
Contributor

No description provided.

@AntonyBlakey AntonyBlakey requested a review from a team as a code owner August 7, 2023 09:53
@changeset-bot
Copy link

changeset-bot bot commented Aug 7, 2023

🦋 Changeset detected

Latest commit: da722fe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@nomicfoundation/slang Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@AntonyBlakey AntonyBlakey self-assigned this Aug 7, 2023
@AntonyBlakey AntonyBlakey marked this pull request as draft August 7, 2023 10:02
@AntonyBlakey AntonyBlakey force-pushed the AntonyBlakey/to_rust_types branch 5 times, most recently from ca341c1 to 6671e9d Compare August 10, 2023 10:17
@AntonyBlakey AntonyBlakey marked this pull request as ready for review August 10, 2023 10:18
@AntonyBlakey AntonyBlakey requested review from OmarTawfik and removed request for a team August 10, 2023 10:18
.vscode/settings.json Outdated Show resolved Hide resolved
Copy link
Contributor

@Xanewok Xanewok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, however it's hard for me to do an in-depth review, since I am not familiar with the codebase from before this PR and the scope of the changes is very big, as it basically overhauls the parsing.

Left some notes, happy to merge it once we bring the changes from #561 back 🙏

crates/solidity/inputs/language/src/lib.rs Outdated Show resolved Hide resolved
crates/infra/utils/src/codegen/read_write.rs Outdated Show resolved Hide resolved
crates/codegen/parser_runtime/src/templates/language.tera Outdated Show resolved Hide resolved
crates/codegen/parser_runtime/src/support/stream.rs Outdated Show resolved Hide resolved
@AntonyBlakey
Copy link
Contributor Author

Not a blocker, but I think we should keep it up to date with the generated sources, to eliminate confusion.

I did.

@AntonyBlakey AntonyBlakey added this pull request to the merge queue Aug 23, 2023
Merged via the queue into NomicFoundation:main with commit e326a06 Aug 23, 2023
1 check passed
@AntonyBlakey AntonyBlakey deleted the AntonyBlakey/to_rust_types branch August 23, 2023 07:25
Xanewok added a commit to Xanewok/slang that referenced this pull request Aug 23, 2023
Xanewok added a commit to Xanewok/slang that referenced this pull request Aug 23, 2023
github-merge-queue bot pushed a commit that referenced this pull request Aug 24, 2023
They were disabled in #564 .. This enables them and updates the
snapshots.
@Xanewok Xanewok mentioned this pull request Aug 29, 2023
github-merge-queue bot pushed a commit that referenced this pull request Aug 29, 2023
Based on #564

EDIT:
As asked, this was split into supporting PRs (#579, #580, merged now),
doesn't use the Error CST node anymore and only contains terminated-by
recovery.

To support error side-channel in a backtracking scenario,
`Vec<ParseError>` was added to the `Stream` which serves more as a parse
context now. To backtrack, we first record the position of the stream
and how many errors are there; then, we reset the errors and the
position to the first recorded `Marker` struct (basically copying what
`chumsky` does).

This wasn't changed everywhere as `Stream::set_position` in the lexer
will never emit errors (only parsers do), nor will the optional trivia
parsers. I'm happy to polish the lexer interface a bit to accommodate
for this change later, if that's okay. First, I wanted to make sure the
approach is fine and accepted, until we proceed with the DelimitedBy
error recovery.
@OmarTawfik OmarTawfik linked an issue Aug 31, 2023 that may be closed by this pull request
@github-actions github-actions bot mentioned this pull request Sep 4, 2023
github-merge-queue bot pushed a commit that referenced this pull request Sep 27, 2023
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## @nomicfoundation/slang@0.10.0

### Minor Changes

- [#595](#595)
[`1a258c4`](1a258c4)
Thanks [@Xanewok](https://github.com/Xanewok)! - Attempt error recovery
when parsing incomplete lists

- [#564](#564)
[`e326a06`](e326a06)
Thanks [@AntonyBlakey](https://github.com/AntonyBlakey)! - Parsing
operators with missing operands should no longer panic

- [#564](#564)
[`e326a06`](e326a06)
Thanks [@AntonyBlakey](https://github.com/AntonyBlakey)! - Inline parse
rules are no longer exposed to the API.

- [#564](#564)
[`e326a06`](e326a06)
Thanks [@AntonyBlakey](https://github.com/AntonyBlakey)! - Scanners are
no longer available as methods - use next_token instead

- [#564](#564)
[`e326a06`](e326a06)
Thanks [@AntonyBlakey](https://github.com/AntonyBlakey)! - Scanners are
now grouped into contexts to deal with contextual scanning

### Patch Changes

- [#601](#601)
[`cbd2a79`](cbd2a79)
Thanks [@Xanewok](https://github.com/Xanewok)! - Attempt parser error
recovery between bracket delimiters

- [#599](#599)
[`4bbad48`](4bbad48)
Thanks [@Xanewok](https://github.com/Xanewok)! - Use correct versions
for the `revert` and `global` keywords

- [#561](#561)
[`cb6a138`](cb6a138)
Thanks [@Xanewok](https://github.com/Xanewok)! - Add preliminary
documentation for the `solidity_language` Rust package

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants