| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 | 112 |
| 113 void Scanner::LiteralScope::Complete() { | 113 void Scanner::LiteralScope::Complete() { |
| 114 scanner_->TerminateLiteral(); | 114 scanner_->TerminateLiteral(); |
| 115 complete_ = true; | 115 complete_ = true; |
| 116 } | 116 } |
| 117 | 117 |
| 118 // ---------------------------------------------------------------------------- | 118 // ---------------------------------------------------------------------------- |
| 119 // V8JavaScriptScanner | 119 // V8JavaScriptScanner |
| 120 | 120 |
| 121 void V8JavaScriptScanner::Initialize(Handle<String> source) { | 121 void V8JavaScriptScanner::Initialize(Handle<String> source, |
| 122 int literal_flags) { |
| 122 source_ = stream_initializer_.Init(source, NULL, 0, source->length()); | 123 source_ = stream_initializer_.Init(source, NULL, 0, source->length()); |
| 124 // Need to capture identifiers in order to recognize "get" and "set" |
| 125 // in object literals. |
| 126 literal_flags_ = literal_flags | kLiteralIdentifier; |
| 123 Init(); | 127 Init(); |
| 124 // Skip initial whitespace allowing HTML comment ends just like | 128 // Skip initial whitespace allowing HTML comment ends just like |
| 125 // after a newline and scan first token. | 129 // after a newline and scan first token. |
| 126 has_line_terminator_before_next_ = true; | 130 has_line_terminator_before_next_ = true; |
| 127 SkipWhiteSpace(); | 131 SkipWhiteSpace(); |
| 128 Scan(); | 132 Scan(); |
| 129 } | 133 } |
| 130 | 134 |
| 131 | 135 |
| 132 void V8JavaScriptScanner::Initialize(Handle<String> source, | 136 void V8JavaScriptScanner::Initialize(Handle<String> source, |
| 133 unibrow::CharacterStream* stream) { | 137 unibrow::CharacterStream* stream, |
| 138 int literal_flags) { |
| 134 source_ = stream_initializer_.Init(source, stream, | 139 source_ = stream_initializer_.Init(source, stream, |
| 135 0, UTF16Buffer::kNoEndPosition); | 140 0, UTF16Buffer::kNoEndPosition); |
| 141 literal_flags_ = literal_flags | kLiteralIdentifier; |
| 136 Init(); | 142 Init(); |
| 137 // Skip initial whitespace allowing HTML comment ends just like | 143 // Skip initial whitespace allowing HTML comment ends just like |
| 138 // after a newline and scan first token. | 144 // after a newline and scan first token. |
| 139 has_line_terminator_before_next_ = true; | 145 has_line_terminator_before_next_ = true; |
| 140 SkipWhiteSpace(); | 146 SkipWhiteSpace(); |
| 141 Scan(); | 147 Scan(); |
| 142 } | 148 } |
| 143 | 149 |
| 144 | 150 |
| 145 void V8JavaScriptScanner::Initialize(Handle<String> source, | 151 void V8JavaScriptScanner::Initialize(Handle<String> source, |
| 146 int start_position, | 152 int start_position, |
| 147 int end_position) { | 153 int end_position, |
| 154 int literal_flags) { |
| 148 source_ = stream_initializer_.Init(source, NULL, | 155 source_ = stream_initializer_.Init(source, NULL, |
| 149 start_position, end_position); | 156 start_position, end_position); |
| 157 literal_flags_ = literal_flags | kLiteralIdentifier; |
| 150 Init(); | 158 Init(); |
| 151 // Skip initial whitespace allowing HTML comment ends just like | 159 // Skip initial whitespace allowing HTML comment ends just like |
| 152 // after a newline and scan first token. | 160 // after a newline and scan first token. |
| 153 has_line_terminator_before_next_ = true; | 161 has_line_terminator_before_next_ = true; |
| 154 SkipWhiteSpace(); | 162 SkipWhiteSpace(); |
| 155 Scan(); | 163 Scan(); |
| 156 } | 164 } |
| 157 | 165 |
| 158 | 166 |
| 159 Token::Value V8JavaScriptScanner::NextCheckStack() { | 167 Token::Value V8JavaScriptScanner::NextCheckStack() { |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 text++; | 439 text++; |
| 432 } | 440 } |
| 433 if (ScannerConstants::kIsIdentifierPart.get(c0_)) return Token::ILLEGAL; | 441 if (ScannerConstants::kIsIdentifierPart.get(c0_)) return Token::ILLEGAL; |
| 434 literal.Complete(); | 442 literal.Complete(); |
| 435 return token; | 443 return token; |
| 436 } | 444 } |
| 437 | 445 |
| 438 | 446 |
| 439 | 447 |
| 440 } } // namespace v8::internal | 448 } } // namespace v8::internal |
| OLD | NEW |