Skip to content

[Parse] Don't use tok::unknown as a dummy token #5171

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
Oct 7, 2016

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Oct 7, 2016

Use tok::NUM_TOKENS instead. tok::unknown can easily appear in source code.

For instance skipUntil(tok::eof) did not work as expected, because that was
skipUntil(tok::eof, tok::unknown) hence does stop at error tokens such as
0xG (invalid hex number literal).

Revert 2abc92b, since that was accidental side-effect of 4511803.
Forward references are not allowed at top level, actually.

@rintaro
Copy link
Member Author

rintaro commented Oct 7, 2016

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor

@lattner Can you review this?

Use tok::NUM_TOKENS instead. tok::unknown can easily appear in source code.

For instance `skipUntil(tok::eof)` did not work as expected, because that was
`skipUntil(tok::eof, tok::unknown)` hence does stop at error tokens such as
`0xG` (invalid hex number literal).

Revert 2abc92b, since that was
accidental side-effect of 4511803.
Forward references are not allowed actually.
@rintaro
Copy link
Member Author

rintaro commented Oct 7, 2016

@swift-ci Please smoke test

@lattner
Copy link
Contributor

lattner commented Oct 7, 2016

LGTM! This is a great idea.

@rintaro rintaro merged commit e52e043 into swiftlang:master Oct 7, 2016
@rintaro
Copy link
Member Author

rintaro commented Oct 7, 2016

Thank you!

@rintaro rintaro deleted the tok-sentinel branch October 7, 2016 05:37
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.

3 participants