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

Unified Diff: src/scanner.h

Issue 316173002: Handle "//# sourceURL" comments in the Parser instead of the JS. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: yet another trivial rebase Created 6 years, 6 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
« no previous file with comments | « src/parser.cc ('k') | src/scanner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner.h
diff --git a/src/scanner.h b/src/scanner.h
index 6e7dabcff3e2a5c89b9cbc85ce9b7e1862605f3b..d71b994850be336df0c74f6d4f24c0ac6d9b5ea9 100644
--- a/src/scanner.h
+++ b/src/scanner.h
@@ -216,14 +216,14 @@ class LiteralBuffer {
position_ += kUC16Size;
}
- bool is_one_byte() { return is_one_byte_; }
+ bool is_one_byte() const { return is_one_byte_; }
- bool is_contextual_keyword(Vector<const char> keyword) {
+ bool is_contextual_keyword(Vector<const char> keyword) const {
return is_one_byte() && keyword.length() == position_ &&
(memcmp(keyword.start(), backing_store_.start(), position_) == 0);
}
- Vector<const uint16_t> two_byte_literal() {
+ Vector<const uint16_t> two_byte_literal() const {
ASSERT(!is_one_byte_);
ASSERT((position_ & 0x1) == 0);
return Vector<const uint16_t>(
@@ -231,14 +231,14 @@ class LiteralBuffer {
position_ >> 1);
}
- Vector<const uint8_t> one_byte_literal() {
+ Vector<const uint8_t> one_byte_literal() const {
ASSERT(is_one_byte_);
return Vector<const uint8_t>(
reinterpret_cast<const uint8_t*>(backing_store_.start()),
position_);
}
- int length() {
+ int length() const {
return is_one_byte_ ? position_ : (position_ >> 1);
}
@@ -247,6 +247,8 @@ class LiteralBuffer {
is_one_byte_ = true;
}
+ Handle<String> Internalize(Isolate* isolate) const;
+
private:
static const int kInitialCapacity = 16;
static const int kGrowthFactory = 4;
@@ -451,6 +453,11 @@ class Scanner {
// be empty).
bool ScanRegExpFlags();
+ const LiteralBuffer* source_url() const { return &source_url_; }
+ const LiteralBuffer* source_mapping_url() const {
+ return &source_mapping_url_;
+ }
+
private:
// The current and look-ahead token.
struct TokenDesc {
@@ -572,6 +579,8 @@ class Scanner {
bool SkipWhiteSpace();
Token::Value SkipSingleLineComment();
+ Token::Value SkipSourceURLComment();
+ void TryToParseSourceURLComment();
Token::Value SkipMultiLineComment();
// Scans a possible HTML comment -- begins with '<!'.
Token::Value ScanHtmlComment();
@@ -606,6 +615,10 @@ class Scanner {
LiteralBuffer literal_buffer1_;
LiteralBuffer literal_buffer2_;
+ // Values parsed from magic comments.
+ LiteralBuffer source_url_;
+ LiteralBuffer source_mapping_url_;
+
TokenDesc current_; // desc for current token (as returned by Next())
TokenDesc next_; // desc for next token (one token look-ahead)
« no previous file with comments | « src/parser.cc ('k') | src/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698