| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Features shared by parsing and pre-parsing scanners. | 5 // Features shared by parsing and pre-parsing scanners. |
| 6 | 6 |
| 7 #ifndef V8_PARSING_SCANNER_H_ | 7 #ifndef V8_PARSING_SCANNER_H_ |
| 8 #define V8_PARSING_SCANNER_H_ | 8 #define V8_PARSING_SCANNER_H_ |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 const char* token = | 192 const char* token = |
| 193 reinterpret_cast<const char*>(literal_one_byte_string().start()); | 193 reinterpret_cast<const char*>(literal_one_byte_string().start()); |
| 194 return !strncmp(token, data, length); | 194 return !strncmp(token, data, length); |
| 195 } | 195 } |
| 196 return false; | 196 return false; |
| 197 } | 197 } |
| 198 inline bool UnescapedLiteralMatches(const char* data, int length) { | 198 inline bool UnescapedLiteralMatches(const char* data, int length) { |
| 199 return LiteralMatches(data, length, false); | 199 return LiteralMatches(data, length, false); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void IsGetOrSet(bool* is_get, bool* is_set) { | 202 bool IsGetOrSet(bool* is_get, bool* is_set) { |
| 203 if (is_literal_one_byte() && | 203 if (is_literal_one_byte() && |
| 204 literal_length() == 3 && | 204 literal_length() == 3 && |
| 205 !literal_contains_escapes()) { | 205 !literal_contains_escapes()) { |
| 206 const char* token = | 206 const char* token = |
| 207 reinterpret_cast<const char*>(literal_one_byte_string().start()); | 207 reinterpret_cast<const char*>(literal_one_byte_string().start()); |
| 208 *is_get = strncmp(token, "get", 3) == 0; | 208 *is_get = strncmp(token, "get", 3) == 0; |
| 209 *is_set = !*is_get && strncmp(token, "set", 3) == 0; | 209 *is_set = !*is_get && strncmp(token, "set", 3) == 0; |
| 210 return *is_get || *is_set; |
| 210 } | 211 } |
| 212 return false; |
| 211 } | 213 } |
| 212 | 214 |
| 213 int FindSymbol(DuplicateFinder* finder, int value); | 215 int FindSymbol(DuplicateFinder* finder, int value); |
| 214 | 216 |
| 215 UnicodeCache* unicode_cache() { return unicode_cache_; } | 217 UnicodeCache* unicode_cache() { return unicode_cache_; } |
| 216 | 218 |
| 217 // Returns the location of the last seen octal literal. | 219 // Returns the location of the last seen octal literal. |
| 218 Location octal_position() const { return octal_pos_; } | 220 Location octal_position() const { return octal_pos_; } |
| 219 void clear_octal_position() { octal_pos_ = Location::invalid(); } | 221 void clear_octal_position() { octal_pos_ = Location::invalid(); } |
| 220 // Returns the location of the last seen decimal literal with a leading zero. | 222 // Returns the location of the last seen decimal literal with a leading zero. |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 bool found_html_comment_; | 794 bool found_html_comment_; |
| 793 | 795 |
| 794 MessageTemplate::Template scanner_error_; | 796 MessageTemplate::Template scanner_error_; |
| 795 Location scanner_error_location_; | 797 Location scanner_error_location_; |
| 796 }; | 798 }; |
| 797 | 799 |
| 798 } // namespace internal | 800 } // namespace internal |
| 799 } // namespace v8 | 801 } // namespace v8 |
| 800 | 802 |
| 801 #endif // V8_PARSING_SCANNER_H_ | 803 #endif // V8_PARSING_SCANNER_H_ |
| OLD | NEW |