Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Unified Diff: src/scanner.cc

Issue 953563002: Implement experimental exponentiation operator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add more tests and fix some bugs Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/compiler/typer.cc ('K') | « src/scanner.h ('k') | src/token.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner.cc
diff --git a/src/scanner.cc b/src/scanner.cc
index de1b8e8b7202d211b297e8ca5737fb8f411299ed..267ae86204e3b7adfd79dc4f7694fc64bab47600 100644
--- a/src/scanner.cc
+++ b/src/scanner.cc
@@ -40,7 +40,8 @@ Scanner::Scanner(UnicodeCache* unicode_cache)
harmony_numeric_literals_(false),
harmony_classes_(false),
harmony_templates_(false),
- harmony_unicode_(false) {}
+ harmony_unicode_(false),
+ harmony_exponentiation_(false) {}
void Scanner::Initialize(Utf16CharacterStream* source) {
@@ -533,8 +534,19 @@ void Scanner::Scan() {
break;
case '*':
- // * *=
- token = Select('=', Token::ASSIGN_MUL, Token::MUL);
+ // * *= ** **=
+ Advance();
+ if (c0_ == '*') {
+ if (HarmonyExponentiation()) {
+ token = Select('=', Token::ASSIGN_EXP, Token::EXP);
+ } else {
+ token = Token::ILLEGAL;
+ }
+ } else if (c0_ == '=') {
+ token = Select(Token::ASSIGN_MUL);
+ } else {
+ token = Token::MUL;
+ }
break;
case '%':
« src/compiler/typer.cc ('K') | « src/scanner.h ('k') | src/token.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698