Revision: 17396
Author: [email protected]
Date: Fri Oct 25 11:59:14 2013 UTC
Log: Experimental scanner: HTML comments.
Failures now down to 8.
[email protected]
BUG=
Review URL: https://codereview.chromium.org/43883003
http://code.google.com/p/v8/source/detail?r=17396
Modified:
/branches/experimental/parser/src/lexer/lexer.h
/branches/experimental/parser/src/lexer/lexer.re
=======================================
--- /branches/experimental/parser/src/lexer/lexer.h Mon Oct 21 15:30:42
2013 UTC
+++ /branches/experimental/parser/src/lexer/lexer.h Fri Oct 25 11:59:14
2013 UTC
@@ -71,6 +71,8 @@
uint8_t yych;
uint32_t yyaccept;
+ bool just_seen_line_terminator_;
+
ExperimentalScanner* sink_;
};
=======================================
--- /branches/experimental/parser/src/lexer/lexer.re Fri Oct 25 11:57:24
2013 UTC
+++ /branches/experimental/parser/src/lexer/lexer.re Fri Oct 25 11:59:14
2013 UTC
@@ -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 @@
#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 @@
buffer_end_(NULL),
yych(0),
yyaccept(0),
+ just_seen_line_terminator_(true),
sink_(sink) {
}
@@ -174,6 +173,7 @@
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 @@
<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 @@
<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.