| Index: src/scanner.h
|
| diff --git a/src/scanner.h b/src/scanner.h
|
| index 2979082e3f152623527df8a69a4b2d177f592323..dd8d7d72cdf6e1252efaab39c80107732e1dfb0b 100644
|
| --- a/src/scanner.h
|
| +++ b/src/scanner.h
|
| @@ -214,14 +214,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>(
|
| @@ -229,14 +229,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);
|
| }
|
|
|
| @@ -245,6 +245,8 @@ class LiteralBuffer {
|
| is_one_byte_ = true;
|
| }
|
|
|
| + Handle<String> Internalize(Isolate* isolate) const;
|
| +
|
| private:
|
| static const int kInitialCapacity = 16;
|
| static const int kGrowthFactory = 4;
|
| @@ -450,6 +452,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 {
|
| @@ -571,6 +578,8 @@ class Scanner {
|
|
|
| bool SkipWhiteSpace();
|
| Token::Value SkipSingleLineComment();
|
| + Token::Value SkipMagicComment();
|
| + void TryToParseMagicComment();
|
| Token::Value SkipMultiLineComment();
|
| // Scans a possible HTML comment -- begins with '<!'.
|
| Token::Value ScanHtmlComment();
|
| @@ -605,6 +614,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)
|
|
|
|
|