| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/parser.h" | 5 #include "vm/parser.h" |
| 6 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/ast_transformer.h" | 9 #include "vm/ast_transformer.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 7098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7109 return false; | 7109 return false; |
| 7110 } | 7110 } |
| 7111 | 7111 |
| 7112 | 7112 |
| 7113 // Returns true if the current token is kIDENT or a pseudo-keyword. | 7113 // Returns true if the current token is kIDENT or a pseudo-keyword. |
| 7114 bool Parser::IsIdentifier() { | 7114 bool Parser::IsIdentifier() { |
| 7115 return Token::IsIdentifier(CurrentToken()) && | 7115 return Token::IsIdentifier(CurrentToken()) && |
| 7116 !(await_is_keyword_ && | 7116 !(await_is_keyword_ && |
| 7117 ((CurrentLiteral()->raw() == Symbols::Await().raw()) || | 7117 ((CurrentLiteral()->raw() == Symbols::Await().raw()) || |
| 7118 (CurrentLiteral()->raw() == Symbols::Async().raw()) || | 7118 (CurrentLiteral()->raw() == Symbols::Async().raw()) || |
| 7119 (CurrentLiteral()->raw() == Symbols::Yield().raw()))); | 7119 (CurrentLiteral()->raw() == Symbols::YieldKw().raw()))); |
| 7120 } | 7120 } |
| 7121 | 7121 |
| 7122 | 7122 |
| 7123 // Returns true if the next tokens can be parsed as a an optionally | 7123 // Returns true if the next tokens can be parsed as a an optionally |
| 7124 // qualified identifier: [ident '.'] ident. | 7124 // qualified identifier: [ident '.'] ident. |
| 7125 // Current token position is not restored. | 7125 // Current token position is not restored. |
| 7126 bool Parser::TryParseQualIdent() { | 7126 bool Parser::TryParseQualIdent() { |
| 7127 if (CurrentToken() != Token::kIDENT) { | 7127 if (CurrentToken() != Token::kIDENT) { |
| 7128 return false; | 7128 return false; |
| 7129 } | 7129 } |
| (...skipping 1894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9024 | 9024 |
| 9025 | 9025 |
| 9026 bool Parser::IsAwaitKeyword() { | 9026 bool Parser::IsAwaitKeyword() { |
| 9027 return await_is_keyword_ && | 9027 return await_is_keyword_ && |
| 9028 (CurrentLiteral()->raw() == Symbols::Await().raw()); | 9028 (CurrentLiteral()->raw() == Symbols::Await().raw()); |
| 9029 } | 9029 } |
| 9030 | 9030 |
| 9031 | 9031 |
| 9032 bool Parser::IsYieldKeyword() { | 9032 bool Parser::IsYieldKeyword() { |
| 9033 return await_is_keyword_ && | 9033 return await_is_keyword_ && |
| 9034 (CurrentLiteral()->raw() == Symbols::Yield().raw()); | 9034 (CurrentLiteral()->raw() == Symbols::YieldKw().raw()); |
| 9035 } | 9035 } |
| 9036 | 9036 |
| 9037 | 9037 |
| 9038 static bool IsIncrementOperator(Token::Kind token) { | 9038 static bool IsIncrementOperator(Token::Kind token) { |
| 9039 return token == Token::kINCR || token == Token::kDECR; | 9039 return token == Token::kINCR || token == Token::kDECR; |
| 9040 } | 9040 } |
| 9041 | 9041 |
| 9042 | 9042 |
| 9043 static bool IsPrefixOperator(Token::Kind token) { | 9043 static bool IsPrefixOperator(Token::Kind token) { |
| 9044 return (token == Token::kSUB) || | 9044 return (token == Token::kSUB) || |
| (...skipping 3479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12524 void Parser::SkipQualIdent() { | 12524 void Parser::SkipQualIdent() { |
| 12525 ASSERT(IsIdentifier()); | 12525 ASSERT(IsIdentifier()); |
| 12526 ConsumeToken(); | 12526 ConsumeToken(); |
| 12527 if (CurrentToken() == Token::kPERIOD) { | 12527 if (CurrentToken() == Token::kPERIOD) { |
| 12528 ConsumeToken(); // Consume the kPERIOD token. | 12528 ConsumeToken(); // Consume the kPERIOD token. |
| 12529 ExpectIdentifier("identifier expected after '.'"); | 12529 ExpectIdentifier("identifier expected after '.'"); |
| 12530 } | 12530 } |
| 12531 } | 12531 } |
| 12532 | 12532 |
| 12533 } // namespace dart | 12533 } // namespace dart |
| OLD | NEW |