Skip to content

Enhanced Enum support in the Dart.bnf parser for Dart 2.17 #849

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

Closed
wants to merge 1 commit into from

Conversation

jwren
Copy link
Contributor

@jwren jwren commented Jan 11, 2022

@alexander-doroshko alexander-doroshko self-assigned this Jan 11, 2022

enumConstantDeclaration ::= componentName
enumConstantDeclaration ::= metadata* componentName typeArguments? arguments? |
metadata* componentName typeArguments? '.' componentName arguments
Copy link
Contributor

Choose a reason for hiding this comment

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

Any input matches arguments?, and this means that the second branch of this rule (after |) will never be reached. To make it work as expected, I flipped the branches. Test updated as well.

enumConstantDeclaration ::= metadata* componentName typeArguments? '.' componentName arguments |
                            metadata* componentName typeArguments? arguments?

{
mixin="com.jetbrains.lang.dart.psi.impl.AbstractDartComponentImpl"
implements="com.jetbrains.lang.dart.psi.DartComponent"
methods = [getMetadataList]
methods= [getMetadataList]
Copy link
Contributor

Choose a reason for hiding this comment

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

With the updated grammar, we don't need custom getMetadataList() method declaration anymore (otherwize the generated code contains 2 of them and doesn't compile). But now we need custom getComponentName method declaration. Added it here and in DartPsiImplUtil, so now the generated code compiles fine.

@alexander-doroshko
Copy link
Contributor

Thanks, pushed.

@SergeyZh SergeyZh closed this in 0c5da87 Jan 12, 2022
SergeyZh pushed a commit that referenced this pull request Mar 4, 2022
close #849

(cherry picked from commit 6ef1c112bf87d6e9a6803a0c36157178a6b6913e)
(cherry picked from commit 93fc285ed9fa443195fca4fb4b8123a281183013)

GitOrigin-RevId: 48efcf939b18d87b36703e4aa14d0de20cd903d4
SergeyZh pushed a commit that referenced this pull request Mar 4, 2022
close #849

(cherry picked from commit 6ef1c112bf87d6e9a6803a0c36157178a6b6913e)
(cherry picked from commit 93fc285ed9fa443195fca4fb4b8123a281183013)
(cherry picked from commit 48efcf939b18d87b36703e4aa14d0de20cd903d4)

GitOrigin-RevId: 892def6b88031c0c5e40953dffffc1a47c226c9c
SergeyZh pushed a commit that referenced this pull request Mar 4, 2022
close #849

(cherry picked from commit 6ef1c112bf87d6e9a6803a0c36157178a6b6913e)

GitOrigin-RevId: 93fc285ed9fa443195fca4fb4b8123a281183013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants