Reviewers: dcarney,

Message:
Committed patchset #1 manually as r17285 (presubmit successful).

Description:
Experimental parser: unify regexp handling with the baseline some more.

BUG=
[email protected]

Committed: https://code.google.com/p/v8/source/detail?r=17285

Please review this at https://codereview.chromium.org/31453004/

SVN Base: https://v8.googlecode.com/svn/branches/experimental/parser

Affected files (+15, -9 lines):
  M src/lexer/lexer-shell.cc
  M src/lexer/lexer.re


Index: src/lexer/lexer-shell.cc
diff --git a/src/lexer/lexer-shell.cc b/src/lexer/lexer-shell.cc
index a125e0a12c8ea0a160df9d5e59919586db9ddb37..85ec5f203daa7c81016adf8819388ebdb14748d0 100644
--- a/src/lexer/lexer-shell.cc
+++ b/src/lexer/lexer-shell.cc
@@ -149,23 +149,27 @@ int main(int argc, char* argv[]) {
       }

       for (size_t i = 0; i < experimental_tokens.size(); ++i) {
-        printf("=> %11s at (%zd, %zd)\n",
+        printf("=> %11s at (%d, %d)\n",
                Token::Name(experimental_tokens[i]),
-               experimental_beg[i], experimental_end[i]);
+               static_cast<int>(experimental_beg[i]),
+               static_cast<int>(experimental_end[i]));
         if (experimental_tokens[i] != baseline_tokens[i] ||
             experimental_beg[i] != baseline_beg[i] ||
             experimental_end[i] != baseline_end[i]) {
           printf("MISMATCH:\n");
-          printf("Expected: %s at (%zd, %zd)\n",
+          printf("Expected: %s at (%d, %d)\n",
                  Token::Name(baseline_tokens[i]),
-                 baseline_beg[i], baseline_end[i]);
-          printf("Actual:   %s at (%zd, %zd)\n",
+                 static_cast<int>(baseline_beg[i]),
+                 static_cast<int>(baseline_end[i]));
+          printf("Actual:   %s at (%d, %d)\n",
                  Token::Name(experimental_tokens[i]),
-                 experimental_beg[i], experimental_end[i]);
+                 static_cast<int>(experimental_beg[i]),
+                 static_cast<int>(experimental_end[i]));
           return 1;
         }
       }
-      printf("No of tokens: %zd\n", experimental_tokens.size());
+      printf("No of tokens: %d\n",
+             static_cast<int>(experimental_tokens.size()));
       printf("Baseline: %f ms\nExperimental %f ms\n",
              baseline_time.InMillisecondsF(),
              experimental_time.InMillisecondsF());
Index: src/lexer/lexer.re
diff --git a/src/lexer/lexer.re b/src/lexer/lexer.re
index b67acf27e84ba9b8af68a2aa056e53eb37e96314..da2c974d8ee1ad7f91e8b33387e5722e93ef33a0 100644
--- a/src/lexer/lexer.re
+++ b/src/lexer/lexer.re
@@ -326,7 +326,8 @@ start_:
     <DoubleQuoteString> '"'     { PUSH_TOKEN(Token::STRING);}
     <DoubleQuoteString> "\\" "\n" "\r"? { goto yy0; }
     <DoubleQuoteString> "\\" "\r" "\n"? { goto yy0; }
-    <DoubleQuoteString> line_terminator { TERMINATE_ILLEGAL(); }
+ <DoubleQuoteString> "\n" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL); } + <DoubleQuoteString> "\r" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL); }
     <DoubleQuoteString> eof     { TERMINATE_ILLEGAL(); }
     <DoubleQuoteString> any     { goto yy0; }

@@ -334,7 +335,8 @@ start_:
     <SingleQuoteString> "'"     { PUSH_TOKEN(Token::STRING);}
     <SingleQuoteString> "\\" "\n" "\r"? { goto yy0; }
     <SingleQuoteString> "\\" "\r" "\n"? { goto yy0; }
-    <SingleQuoteString> line_terminator { TERMINATE_ILLEGAL(); }
+ <SingleQuoteString> "\n" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL); } + <SingleQuoteString> "\r" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL); }
     <SingleQuoteString> eof     { TERMINATE_ILLEGAL(); }
     <SingleQuoteString> any     { goto yy0; }



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to