Skip to content

Generalize Lexeme State into Flags #805

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 2 commits into from
Sep 16, 2022
Merged

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Sep 16, 2022

Generalize the current "is at start of line" bit into a small flag set. On top of that, pass the lexer's "is multiline string" flag up to the parser. This mirrors the behavior of the C++ parser and makes sure we don't have to spend time re-lexing the string literal to determine this for ourselves in a completely separate component.

The important part here is that we have a space to attach a future "error" bit to the tokens, rather than yielding plain .unknown back. This should give us the space to start issuing (what were formerly) lex-time diagnostics.

Generalize the isAtStartOfLine bit into flags. In the future this will allow us to identify multiline string literals and start to diagnose erroneous tokens.
Use this to prevent the parser from having to re-infer the number of quotes it needs to eat to make progress.
@CodaFi CodaFi requested a review from ahoppen as a code owner September 16, 2022 17:54
@CodaFi
Copy link
Contributor Author

CodaFi commented Sep 16, 2022

@swift-ci test

@CodaFi CodaFi merged commit 0522c83 into swiftlang:main Sep 16, 2022
@CodaFi CodaFi deleted the string-of-pearls branch September 16, 2022 20:05
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