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_SCANNER_H_ | 7 #ifndef V8_SCANNER_H_ |
8 #define V8_SCANNER_H_ | 8 #define V8_SCANNER_H_ |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 Location() : beg_pos(0), end_pos(0) { } | 348 Location() : beg_pos(0), end_pos(0) { } |
349 | 349 |
350 bool IsValid() const { | 350 bool IsValid() const { |
351 return beg_pos >= 0 && end_pos >= beg_pos; | 351 return beg_pos >= 0 && end_pos >= beg_pos; |
352 } | 352 } |
353 | 353 |
354 static Location invalid() { return Location(-1, -1); } | 354 static Location invalid() { return Location(-1, -1); } |
355 | 355 |
356 int beg_pos; | 356 int beg_pos; |
357 int end_pos; | 357 int end_pos; |
| 358 |
| 359 bool inline operator==(const Location& other) const { |
| 360 return beg_pos == other.beg_pos && end_pos == other.end_pos; |
| 361 } |
| 362 |
| 363 bool inline operator!=(const Location& other) const { |
| 364 return !(*this == other); |
| 365 } |
358 }; | 366 }; |
359 | 367 |
360 // -1 is outside of the range of any real source code. | 368 // -1 is outside of the range of any real source code. |
361 static const int kNoOctalLocation = -1; | 369 static const int kNoOctalLocation = -1; |
362 | 370 |
363 explicit Scanner(UnicodeCache* scanner_contants); | 371 explicit Scanner(UnicodeCache* scanner_contants); |
364 | 372 |
365 void Initialize(Utf16CharacterStream* source); | 373 void Initialize(Utf16CharacterStream* source); |
366 | 374 |
367 // Returns the next token and advances input. | 375 // Returns the next token and advances input. |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 bool harmony_modules_; | 743 bool harmony_modules_; |
736 // Whether we scan 'class', 'extends', 'static' and 'super' as keywords. | 744 // Whether we scan 'class', 'extends', 'static' and 'super' as keywords. |
737 bool harmony_classes_; | 745 bool harmony_classes_; |
738 // Whether we allow \u{xxxxx}. | 746 // Whether we allow \u{xxxxx}. |
739 bool harmony_unicode_; | 747 bool harmony_unicode_; |
740 }; | 748 }; |
741 | 749 |
742 } } // namespace v8::internal | 750 } } // namespace v8::internal |
743 | 751 |
744 #endif // V8_SCANNER_H_ | 752 #endif // V8_SCANNER_H_ |
OLD | NEW |