Skip to content

[Parse] Simplify parsing name for function declarations #13141

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
Dec 4, 2017

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Nov 29, 2017

Previously, when parsing func ==<T>(
The parser used to consume ==< as an operator, then mark it as split tokens.
In this PR, consume 2 characters (excepting <) as tok::identifier tok::oper_binary_spaced, then reset Lexer position at <.

@benlangmuir This PR changes the kind of the token into tok::identifier which affects SourceKit doc-info results. Is it OK? I want to make it so because libSyntax expects tok::identifier token at this position.

@rintaro
Copy link
Member Author

rintaro commented Nov 29, 2017

@swift-ci Please smoke test

@benlangmuir
Copy link
Contributor

Does this really only affect doc-info, or is that just where it happened to be tested? Wouldn't this affect all the other syntactic sourcekit requests?

Also, to clarify: this isn't just changing the token kind for ==, but for any operator declaration, right? That doesn't seem correct to me. We don't treat a reference to an operator as an identifier in SK, so why would we should the decl as an identifier? + @akyrtzi as well.

@akyrtzi
Copy link
Contributor

akyrtzi commented Nov 29, 2017

It looks like for the syntax-map (sourcekitd-test -req=syntax-map /path/to/test.swift) operators are not included at all (both in the decl or in expressions). We could preserve current behavior for sourcekitd by checking if the 'identifier' is an operator and avoid reporting it if it is.

@rintaro rintaro force-pushed the parse-declfunc-name branch from af88bac to b4ac843 Compare November 30, 2017 01:43
@rintaro
Copy link
Member Author

rintaro commented Nov 30, 2017

@swift-ci Please smoke test

@rintaro
Copy link
Member Author

rintaro commented Nov 30, 2017

OK, I changed it to tok::oper_binary_spaced.
We can make libSyntax to accept operator tokens at this position.

@rintaro rintaro merged commit c0ceb7a into swiftlang:master Dec 4, 2017
@rintaro rintaro deleted the parse-declfunc-name branch December 4, 2017 17:04
davidungar pushed a commit to davidungar/swift that referenced this pull request Dec 5, 2017
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