OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_SYMBOLS_H_ | 5 #ifndef VM_SYMBOLS_H_ |
6 #define VM_SYMBOLS_H_ | 6 #define VM_SYMBOLS_H_ |
7 | 7 |
8 #include "vm/object.h" | 8 #include "vm/object.h" |
9 #include "vm/snapshot_ids.h" | 9 #include "vm/snapshot_ids.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 // Forward declarations. | 13 // Forward declarations. |
14 class Isolate; | 14 class Isolate; |
15 class ObjectPointerVisitor; | 15 class ObjectPointerVisitor; |
16 | 16 |
17 // One-character symbols are added implicitly. | 17 // One-character symbols are added implicitly. |
18 #define PREDEFINED_SYMBOLS_LIST(V) \ | 18 #define PREDEFINED_SYMBOLS_LIST(V) \ |
19 V(Empty, "") \ | 19 V(Empty, "") \ |
20 V(EqualOperator, "==") \ | 20 V(EqualOperator, "==") \ |
21 V(GreaterEqualOperator, ">=") \ | 21 V(GreaterEqualOperator, ">=") \ |
22 V(LessEqualOperator, "<=") \ | 22 V(LessEqualOperator, "<=") \ |
| 23 V(LeftShiftOperator, "<<") \ |
| 24 V(RightShiftOperator, ">>") \ |
| 25 V(TruncDivOperator, "~/") \ |
23 V(UnaryMinus, "unary-") \ | 26 V(UnaryMinus, "unary-") \ |
24 V(Identical, "identical") \ | 27 V(Identical, "identical") \ |
25 V(Length, "length") \ | 28 V(Length, "length") \ |
26 V(IndexToken, "[]") \ | 29 V(IndexToken, "[]") \ |
27 V(AssignIndexToken, "[]=") \ | 30 V(AssignIndexToken, "[]=") \ |
28 V(TopLevel, "::") \ | 31 V(TopLevel, "::") \ |
29 V(DefaultLabel, ":L") \ | 32 V(DefaultLabel, ":L") \ |
30 V(This, "this") \ | 33 V(This, "this") \ |
31 V(Other, "other") \ | 34 V(Other, "other") \ |
32 V(Super, "super") \ | 35 V(Super, "super") \ |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 } | 466 } |
464 static const String& Slash() { | 467 static const String& Slash() { |
465 return *(symbol_handles_[kNullCharId + '/']); | 468 return *(symbol_handles_[kNullCharId + '/']); |
466 } | 469 } |
467 static const String& At() { | 470 static const String& At() { |
468 return *(symbol_handles_[kNullCharId + '@']); | 471 return *(symbol_handles_[kNullCharId + '@']); |
469 } | 472 } |
470 static const String& Semicolon() { | 473 static const String& Semicolon() { |
471 return *(symbol_handles_[kNullCharId + ';']); | 474 return *(symbol_handles_[kNullCharId + ';']); |
472 } | 475 } |
| 476 static const String& Star() { |
| 477 return *(symbol_handles_[kNullCharId + '*']); |
| 478 } |
| 479 static const String& Percent() { |
| 480 return *(symbol_handles_[kNullCharId + '%']); |
| 481 } |
| 482 static const String& Caret() { |
| 483 return *(symbol_handles_[kNullCharId + '^']); |
| 484 } |
| 485 static const String& Tilde() { |
| 486 return *(symbol_handles_[kNullCharId + '~']); |
| 487 } |
473 | 488 |
474 // Access methods for symbol handles stored in the vm isolate. | 489 // Access methods for symbol handles stored in the vm isolate. |
475 #define DEFINE_SYMBOL_HANDLE_ACCESSOR(symbol, literal) \ | 490 #define DEFINE_SYMBOL_HANDLE_ACCESSOR(symbol, literal) \ |
476 static const String& symbol() { return *(symbol_handles_[k##symbol##Id]); } | 491 static const String& symbol() { return *(symbol_handles_[k##symbol##Id]); } |
477 PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_HANDLE_ACCESSOR) | 492 PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_HANDLE_ACCESSOR) |
478 #undef DEFINE_SYMBOL_HANDLE_ACCESSOR | 493 #undef DEFINE_SYMBOL_HANDLE_ACCESSOR |
479 | 494 |
480 // Get symbol for scanner keyword. | 495 // Get symbol for scanner keyword. |
481 static const String& Keyword(Token::Kind keyword); | 496 static const String& Keyword(Token::Kind keyword); |
482 | 497 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 friend class SnapshotReader; | 574 friend class SnapshotReader; |
560 friend class SnapshotWriter; | 575 friend class SnapshotWriter; |
561 friend class ApiMessageReader; | 576 friend class ApiMessageReader; |
562 | 577 |
563 DISALLOW_COPY_AND_ASSIGN(Symbols); | 578 DISALLOW_COPY_AND_ASSIGN(Symbols); |
564 }; | 579 }; |
565 | 580 |
566 } // namespace dart | 581 } // namespace dart |
567 | 582 |
568 #endif // VM_SYMBOLS_H_ | 583 #endif // VM_SYMBOLS_H_ |
OLD | NEW |