Revision: 17786
Author:   dcar...@chromium.org
Date:     Fri Nov 15 12:04:53 2013 UTC
Log:      Experimental parser: add back last re2c rules

TBR=ma...@chromium.org

BUG=

Review URL: https://codereview.chromium.org/71303005
http://code.google.com/p/v8/source/detail?r=17786

Modified:
 /branches/experimental/parser/src/lexer/even-more-experimental-scanner.cc
 /branches/experimental/parser/src/lexer/even-more-experimental-scanner.h
 /branches/experimental/parser/src/lexer/lexer_py.re

=======================================
--- /branches/experimental/parser/src/lexer/even-more-experimental-scanner.cc Thu Nov 14 12:43:42 2013 UTC +++ /branches/experimental/parser/src/lexer/even-more-experimental-scanner.cc Fri Nov 15 12:04:53 2013 UTC
@@ -69,6 +69,7 @@
       buffer_end_(NULL),
       start_(NULL),
       cursor_(NULL),
+      just_seen_line_terminator_(true),
       sink_(sink) {}


=======================================
--- /branches/experimental/parser/src/lexer/even-more-experimental-scanner.h Thu Nov 14 12:14:08 2013 UTC +++ /branches/experimental/parser/src/lexer/even-more-experimental-scanner.h Fri Nov 15 12:04:53 2013 UTC
@@ -34,10 +34,21 @@

 #define YYCTYPE uint8_t

-#define PUSH_TOKEN(T) { send(T); start_ = cursor_; }
-#define PUSH_LINE_TERMINATOR(s) { start_ = cursor_; }
-#define FORWARD() { yych = *(++cursor_); }
-#define SKIP() { start_ = cursor_; }
+#define PUSH_TOKEN(T) {               \
+  send(T);                            \
+  start_ = cursor_;                   \
+  just_seen_line_terminator_ = false; \
+}
+#define PUSH_LINE_TERMINATOR(s) {     \
+  start_ = cursor_;                   \
+  just_seen_line_terminator_ = true;  \
+}
+#define FORWARD() {                   \
+  yych = *(++cursor_);                \
+}
+#define SKIP() {                      \
+  start_ = cursor_;                   \
+}

 namespace v8 {
 namespace internal {
@@ -68,6 +79,7 @@
   YYCTYPE* buffer_end_;
   YYCTYPE* start_;
   YYCTYPE* cursor_;
+  bool just_seen_line_terminator_;

   YYCTYPE yych;
   ExperimentalScanner* sink_;
=======================================
--- /branches/experimental/parser/src/lexer/lexer_py.re Thu Nov 14 21:09:14 2013 UTC +++ /branches/experimental/parser/src/lexer/lexer_py.re Fri Nov 15 12:04:53 2013 UTC
@@ -65,7 +65,13 @@
 "/*"          <||MultiLineComment>
 "<!--"        <||HtmlComment>

-#whitespace* "-->" { if (just_seen_line_terminator_) { YYSETCONDITION(kConditionSingleLineComment); goto yyc_SingleLineComment; } else { --cursor_; send(Token::DEC); start_ = cursor_; goto yyc_Normal; } }
+whitespace? "-->" <{
+  if (!just_seen_line_terminator_) {
+    PUSH_TOKEN(Token::DEC);
+    start_ = cursor_ - 1;
+    goto code_start;
+  }
+}||SingleLineComment>

 ">>>="        <|push_token(ASSIGN_SHR)|>
 ">>>"         <|push_token(SHR)|>
@@ -165,8 +171,7 @@
 identifier_start <|push_token(IDENTIFIER)|Identifier>
 /\\u[0-9a-fA-F]{4}/ <{
   if (V8_UNLIKELY(!ValidIdentifierStart())) {
-    PUSH_TOKEN(Token::ILLEGAL);
-    // need to goto something here
+    goto default_action;
   }
 }|push_token(IDENTIFIER)|Identifier>

@@ -194,9 +199,8 @@
 <<Identifier>>
 identifier_char <|push_token(IDENTIFIER)|continue>
 /\\u[0-9a-fA-F]{4}/ <{
-  if (V8_UNLIKELY(!ValidIdentifierStart())) {
-    PUSH_TOKEN(Token::ILLEGAL);
-    // need to goto something here
+  if (V8_UNLIKELY(!ValidIdentifierPart())) {
+    goto default_action;
   }
 }|push_token(IDENTIFIER)|continue>

--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to