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 } | |
366 }; | 358 }; |
367 | 359 |
368 // -1 is outside of the range of any real source code. | 360 // -1 is outside of the range of any real source code. |
369 static const int kNoOctalLocation = -1; | 361 static const int kNoOctalLocation = -1; |
370 | 362 |
371 explicit Scanner(UnicodeCache* scanner_contants); | 363 explicit Scanner(UnicodeCache* scanner_contants); |
372 | 364 |
373 void Initialize(Utf16CharacterStream* source); | 365 void Initialize(Utf16CharacterStream* source); |
374 | 366 |
375 // Returns the next token and advances input. | 367 // Returns the next token and advances input. |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 bool harmony_modules_; | 735 bool harmony_modules_; |
744 // Whether we scan 'class', 'extends', 'static' and 'super' as keywords. | 736 // Whether we scan 'class', 'extends', 'static' and 'super' as keywords. |
745 bool harmony_classes_; | 737 bool harmony_classes_; |
746 // Whether we allow \u{xxxxx}. | 738 // Whether we allow \u{xxxxx}. |
747 bool harmony_unicode_; | 739 bool harmony_unicode_; |
748 }; | 740 }; |
749 | 741 |
750 } } // namespace v8::internal | 742 } } // namespace v8::internal |
751 | 743 |
752 #endif // V8_SCANNER_H_ | 744 #endif // V8_SCANNER_H_ |
OLD | NEW |