Reviewers: dcarney,

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

Description:
Experimental scanner: HTML comments.

Failures now down to 8.

[email protected]

BUG=

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

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

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

Affected files (+7, -3 lines):
  M src/lexer/lexer.h
  M src/lexer/lexer.re


Index: src/lexer/lexer.h
diff --git a/src/lexer/lexer.h b/src/lexer/lexer.h
index 259f42628ddcd3c36671dbac60c45cef420ee21f..087b46c3ec884c791d9095c068f587dab8623eb5 100644
--- a/src/lexer/lexer.h
+++ b/src/lexer/lexer.h
@@ -71,6 +71,8 @@ class PushScanner {
   uint8_t yych;
   uint32_t yyaccept;

+  bool just_seen_line_terminator_;
+
   ExperimentalScanner* sink_;
 };

Index: src/lexer/lexer.re
diff --git a/src/lexer/lexer.re b/src/lexer/lexer.re
index d51771910fe1cb56526b581e3379a55906c86854..9d6d881684102256a145b0b1d935b744d95bcb74 100644
--- a/src/lexer/lexer.re
+++ b/src/lexer/lexer.re
@@ -56,8 +56,6 @@


 // TODO:
-// - SpiderMonkey compatibility hack: "  --> something" is treated
-//   as a single line comment.
// - Run-time lexing modifications: harmony number literals, keywords depending
 //   on harmony_modules, harmony_scoping
 // - Escaping the string literals (like the baseline does)
@@ -115,7 +113,7 @@ inline int HexValue(uc32 c) {
 #define PUSH_TOKEN(T) { send(T); SKIP(); }
 #define PUSH_TOKEN_LOOKAHEAD(T) { --cursor_; send(T); SKIP(); }
 #define PUSH_EOF_AND_RETURN() { send(Token::EOS); eof_ = true; return 1;}
-#define PUSH_LINE_TERMINATOR() { SKIP(); }
+#define PUSH_LINE_TERMINATOR() { just_seen_line_terminator_ = true; SKIP(); } #define TERMINATE_ILLEGAL() { send(Token::ILLEGAL); send(Token::EOS); return 1; }

 #define YYCTYPE uint8_t
@@ -134,6 +132,7 @@ PushScanner::PushScanner(ExperimentalScanner* sink, UnicodeCache* unicode_cache)
   buffer_end_(NULL),
   yych(0),
   yyaccept(0),
+  just_seen_line_terminator_(true),
   sink_(sink) {

 }
@@ -174,6 +173,7 @@ void PushScanner::send(Token::Value token) {
     for (uint8_t* s = start_; s != cursor_; s++) printf("%c", (char)*s);
     printf(".\n");
   }
+  just_seen_line_terminator_ = false;
   sink_->Record(token, beg, end);
 }

@@ -331,6 +331,7 @@ start_:
     <Normal> "!"           { PUSH_TOKEN(Token::NOT); }

     <Normal> "//"          :=> SingleLineComment
+ <Normal> whitespace? "-->" { if (just_seen_line_terminator_) { YYSETCONDITION(kConditionSingleLineComment); goto yy0; } else { --cursor_; send(Token::DEC); start_ = cursor_; goto yy0; } }
     <Normal> "/*"          :=> MultiLineComment
     <Normal> "<!--"        :=> HtmlComment

@@ -432,6 +433,7 @@ start_:

     <HtmlComment> eof        { TERMINATE_ILLEGAL(); }
     <HtmlComment> "-->"      { PUSH_LINE_TERMINATOR();}
+    <HtmlComment> line_terminator+ { PUSH_LINE_TERMINATOR();}
     <HtmlComment> 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