Skip to content

Remove check for endOfFile in advance #1457

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

Merged
merged 1 commit into from
Mar 28, 2023
Merged

Conversation

hamishknight
Copy link
Contributor

Instead, let the lexer produce .eof itself. This will be needed for regex literal lexing, where the lexer may still want to produce an empty regex literal pattern when at the end of the file, before the .eof token.

Instead, let the lexer produce `.eof` itself. This
will be needed for regex literal lexing, where the
lexer may still want to produce an empty regex
literal pattern when at the end of the file, before
the `.eof` token.
@hamishknight hamishknight requested a review from ahoppen as a code owner March 28, 2023 12:04
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight
Copy link
Contributor Author

@ahoppen FWIW it seems this is a minor performance win too, parsing MovieSwiftUI:

  • time: ~16ms -> ~15ms
  • instructions: ~128,670,000 -> ~128,400,000

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

LGTM

@hamishknight hamishknight merged commit 96e6850 into swiftlang:main Mar 28, 2023
@hamishknight hamishknight deleted the eof branch March 28, 2023 18:07
ahoppen pushed a commit to ahoppen/swift-syntax that referenced this pull request Mar 31, 2023
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