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

Reinstate not_followed_by and add to DecimalLiteral also remove _ in dsl keywords. #575

Conversation

AntonyBlakey
Copy link
Contributor

No description provided.

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

changeset-bot bot commented Aug 23, 2023

⚠️ No Changeset found

Latest commit: 401b1ee

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@AntonyBlakey AntonyBlakey requested review from OmarTawfik and removed request for a team August 23, 2023 09:43
@AntonyBlakey AntonyBlakey self-assigned this Aug 23, 2023
Copy link
Collaborator

@OmarTawfik OmarTawfik left a comment

Choose a reason for hiding this comment

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

I suggest checking the other places in the YAML grammar where we are using notFollowedBy. For example, I just checked MultilineComment, and because the new DSL doesn't use it, we fail to scan /* foo **/. I suggest adding a test for that in crates/solidity/outputs/cargo/tests/src/scanner/mod.rs.

@AntonyBlakey AntonyBlakey force-pushed the AntonyBlakey/revive-not_followed_by branch from a585e35 to f57ee26 Compare August 24, 2023 12:48
@AntonyBlakey
Copy link
Contributor Author

AntonyBlakey commented Aug 24, 2023

I suggest checking the other places in the YAML grammar where we are using notFollowedBy. For example, I just checked MultilineComment, and because the new DSL doesn't use it, we fail to scan /* foo **/. I suggest adding a test for that in crates/solidity/outputs/cargo/tests/src/scanner/mod.rs.

I have added it to the other items that have it in the yaml. This raises some issues, although not a regression:

"unicode'abc'ZZ" => Identifier
"hex'abcd'ZZz" => HexKeyword

@AntonyBlakey AntonyBlakey force-pushed the AntonyBlakey/revive-not_followed_by branch from 4dc5e20 to ffed3f7 Compare August 24, 2023 15:58
Copy link
Collaborator

@OmarTawfik OmarTawfik 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!

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.

Left a small suggestion.

})
}};
}

#[allow(unused_macros)]
macro_rules! scan_not_followed_by {
($stream:ident, $scanner:expr, $not_followed_by:expr) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I like how delimited by tokens improve legibility of the DSL, maybe changing it to

($stream:ident, $scanner:expr, not followed by: $not_followed_by:expr)

would improve legibility of scan_not_followed_by macro calls here?

})
}};
}

#[allow(unused_macros)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this allow still needed?

@AntonyBlakey AntonyBlakey added this pull request to the merge queue Aug 29, 2023
Merged via the queue into NomicFoundation:main with commit 3ac7729 Aug 29, 2023
1 check passed
@AntonyBlakey AntonyBlakey deleted the AntonyBlakey/revive-not_followed_by branch August 29, 2023 11:16
@OmarTawfik OmarTawfik linked an issue Aug 31, 2023 that may be closed by this pull request
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.

Reinstate negative lookahead rule in scanners
3 participants