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:
Dave Zarzycki
2013-01-26 01:49:18 +00:00
parent 6cfcb412b3
commit d7cc4b4a91
7 changed files with 13 additions and 31 deletions

View File

@@ -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;
}

View File

@@ -58,7 +58,6 @@ KEYWORD(subscript)
// Statement keywords.
KEYWORD(if)
KEYWORD(in)
KEYWORD(do)
KEYWORD(else)
KEYWORD(for)