Index: src/scanner.cc |
diff --git a/src/scanner.cc b/src/scanner.cc |
index 01fe81c64646ccf1ac039ed9a9b4d2a47a1f4461..42a1c2bc31e93cd0cd859d1fc461bb03b9732585 100755 |
--- a/src/scanner.cc |
+++ b/src/scanner.cc |
@@ -41,7 +41,8 @@ namespace internal { |
Scanner::Scanner(UnicodeCache* unicode_cache) |
: unicode_cache_(unicode_cache), |
octal_pos_(Location::invalid()), |
- harmony_scoping_(false) { } |
+ harmony_scoping_(false), |
+ harmony_modules_(false) { } |
void Scanner::Initialize(UC16CharacterStream* source) { |
@@ -830,7 +831,8 @@ uc32 Scanner::ScanIdentifierUnicodeEscape() { |
KEYWORD_GROUP('e') \ |
KEYWORD("else", Token::ELSE) \ |
KEYWORD("enum", Token::FUTURE_RESERVED_WORD) \ |
- KEYWORD("export", Token::FUTURE_RESERVED_WORD) \ |
+ KEYWORD("export", harmony_modules \ |
+ ? Token::EXPORT : Token::FUTURE_RESERVED_WORD) \ |
KEYWORD("extends", Token::FUTURE_RESERVED_WORD) \ |
KEYWORD_GROUP('f') \ |
KEYWORD("false", Token::FALSE_LITERAL) \ |
@@ -840,13 +842,17 @@ uc32 Scanner::ScanIdentifierUnicodeEscape() { |
KEYWORD_GROUP('i') \ |
KEYWORD("if", Token::IF) \ |
KEYWORD("implements", Token::FUTURE_STRICT_RESERVED_WORD) \ |
- KEYWORD("import", Token::FUTURE_RESERVED_WORD) \ |
+ KEYWORD("import", harmony_modules \ |
+ ? Token::IMPORT : Token::FUTURE_RESERVED_WORD) \ |
KEYWORD("in", Token::IN) \ |
KEYWORD("instanceof", Token::INSTANCEOF) \ |
KEYWORD("interface", Token::FUTURE_STRICT_RESERVED_WORD) \ |
KEYWORD_GROUP('l') \ |
KEYWORD("let", harmony_scoping \ |
? Token::LET : Token::FUTURE_STRICT_RESERVED_WORD) \ |
+ KEYWORD_GROUP('m') \ |
+ KEYWORD("module", harmony_modules \ |
+ ? Token::MODULE : Token::IDENTIFIER) \ |
KEYWORD_GROUP('n') \ |
KEYWORD("new", Token::NEW) \ |
KEYWORD("null", Token::NULL_LITERAL) \ |
@@ -879,7 +885,8 @@ uc32 Scanner::ScanIdentifierUnicodeEscape() { |
static Token::Value KeywordOrIdentifierToken(const char* input, |
int input_length, |
- bool harmony_scoping) { |
+ bool harmony_scoping, |
+ bool harmony_modules) { |
ASSERT(input_length >= 1); |
const int kMinLength = 2; |
const int kMaxLength = 10; |
@@ -955,7 +962,8 @@ Token::Value Scanner::ScanIdentifierOrKeyword() { |
Vector<const char> chars = next_.literal_chars->ascii_literal(); |
return KeywordOrIdentifierToken(chars.start(), |
chars.length(), |
- harmony_scoping_); |
+ harmony_scoping_, |
+ harmony_modules_); |
} |
return Token::IDENTIFIER; |