mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Reclaim "in" as an identifier
In Swift the "in" keyword is really a form of punctuation, and highly context specific punctuation at that. It never begins a statement, nor does the grammar require it be statement keyword. The grammar also doesn't use it outside of for-each loops, and its use within a for-each loop is highly unambiguous. Thanks to Chris for the performance related feedback. This improves the performance of getter/setter parsing as well. Swift SVN r3880
This commit is contained in:
@@ -75,7 +75,11 @@ public:
|
||||
bool isNotAnyOperator() const {
|
||||
return !isAnyOperator();
|
||||
}
|
||||
|
||||
|
||||
bool isContextualKeyword(StringRef ContextKW) const {
|
||||
return is(tok::identifier) && Text == ContextKW;
|
||||
}
|
||||
|
||||
bool isAnyLParen() const {
|
||||
return Kind == tok::l_paren || Kind == tok::l_paren_call;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ KEYWORD(subscript)
|
||||
|
||||
// Statement keywords.
|
||||
KEYWORD(if)
|
||||
KEYWORD(in)
|
||||
KEYWORD(do)
|
||||
KEYWORD(else)
|
||||
KEYWORD(for)
|
||||
|
||||
Reference in New Issue
Block a user