You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the [statements][5, 12] ... [directive][8, 8] - [8, 14] should be nested under [directive][4, 8] - [4, 17] ?
And in some sense the we need the entire if-elseif like parsing here.
The text was updated successfully, but these errors were encountered:
ketkarameya
changed the title
Incorrectly parsed derivatives
Incorrectly parsed directives
Jun 21, 2023
Yep, we parse directives like extras, but Swift is actually restrictive enough with its macro system that we can do better. That is, I was leaving open the possibility that there could be something like:
class MyClass
#if DEBUG
}
#else
}
class MyOtherClass
#endif
}
But Swift doesn't allow this case (it says "Unexpected '}' in conditional compilation block"), and I suspect they disallow any such cases. It probably makes sense to just add this into the choice in _local_statement and _top_level_statement, and add the structure for the if/else like you say.
I observed that the directives (https://docs.swift.org/swift-book/documentation/the-swift-programming-language/statements/#Compiler-Control-Statements) do not parse well.
Tree:
I think the
[statements][5, 12] ... [directive][8, 8] - [8, 14]
should be nested under[directive][4, 8] - [4, 17]
?And in some sense the we need the entire
if-elseif
like parsing here.The text was updated successfully, but these errors were encountered: