#include <token.h>
Definition at line 212 of file token.h.
◆ Attribute
Enumerator |
---|
kNoAttribute | |
kKeyword | |
kPseudoKeyword | |
Definition at line 218 of file token.h.
◆ Kind
Enumerator |
---|
DART_TOKEN_LIST | |
Definition at line 215 of file token.h.
#define DART_KEYWORD_LIST(KW)
◆ Attributes()
Definition at line 292 of file token.h.
292 {
294 return attributes_[tok];
295 }
◆ CanBeOverloaded()
static bool dart::Token::CanBeOverloaded |
( |
Kind |
tok | ) |
|
|
inlinestatic |
Definition at line 297 of file token.h.
297 {
300 (tok >= kADD && tok <= kMOD) ||
301 (tok >= kBIT_OR && tok <= kUSHR) ||
302 (tok == kINDEX) || (tok == kASSIGN_INDEX);
303 }
static bool IsRelationalOperator(Kind tok)
◆ FlipComparison()
Definition at line 352 of file token.h.
352 {
353 switch (op) {
354 case Token::kEQ:
355 return Token::kEQ;
356 case Token::kNE:
357 return Token::kNE;
358 case Token::kLT:
359 return Token::kGT;
360 case Token::kGT:
361 return Token::kLT;
362 case Token::kLTE:
363 return Token::kGTE;
364 case Token::kGTE:
365 return Token::kLTE;
366 case Token::kEQ_STRICT:
367 return Token::kEQ_STRICT;
368 case Token::kNE_STRICT:
369 return Token::kNE_STRICT;
370 default:
372 return Token::kILLEGAL;
373 }
374 }
◆ FromStr()
static bool dart::Token::FromStr |
( |
const char * |
str, |
|
|
Kind * |
out |
|
) |
| |
|
inlinestatic |
Definition at line 274 of file token.h.
274 {
275 ASSERT(str !=
nullptr &&
out !=
nullptr);
276#define TOK_CASE(t, s, p, a) \
277 if (strcmp(str, tok_str_[(t)]) == 0) { \
278 *out = (t); \
279 return true; \
280 }
283#undef TOK_CASE
284 return false;
285 }
#define TOK_CASE(t, s, p, a)
◆ IsAssignmentOperator()
static bool dart::Token::IsAssignmentOperator |
( |
Kind |
tok | ) |
|
|
inlinestatic |
Definition at line 228 of file token.h.
228 {
229 return kASSIGN <= tok && tok <= kASSIGN_COND;
230 }
◆ IsBinaryArithmeticOperator()
bool dart::Token::IsBinaryArithmeticOperator |
( |
Token::Kind |
token | ) |
|
|
static |
Definition at line 45 of file token.cc.
45 {
46 switch (token) {
47 case Token::kADD:
48 case Token::kSUB:
49 case Token::kMUL:
50 case Token::kDIV:
51 case Token::kTRUNCDIV:
52 case Token::kMOD:
53 case Token::kBIT_OR:
54 case Token::kBIT_XOR:
55 case Token::kBIT_AND:
56 case Token::kSHL:
57 case Token::kSHR:
58 case Token::kUSHR:
59 case Token::kMAX:
60 case Token::kMIN:
61 return true;
62 default:
63 return false;
64 }
65}
◆ IsBinaryBitwiseOperator()
bool dart::Token::IsBinaryBitwiseOperator |
( |
Token::Kind |
token | ) |
|
|
static |
Definition at line 85 of file token.cc.
85 {
86 switch (token) {
87 case Token::kBIT_OR:
88 case Token::kBIT_XOR:
89 case Token::kBIT_AND:
90 case Token::kSHL:
91 case Token::kSHR:
92 case Token::kUSHR:
93 return true;
94 default:
95 return false;
96 }
97}
◆ IsBinaryOperator()
bool dart::Token::IsBinaryOperator |
( |
Token::Kind |
token | ) |
|
|
static |
Definition at line 31 of file token.cc.
31 {
32 switch (token) {
33 case Token::kOR:
34 case Token::kAND:
35 return true;
36 default:
38 }
39}
static bool IsBinaryArithmeticOperator(Token::Kind token)
◆ IsEqualityOperator()
static bool dart::Token::IsEqualityOperator |
( |
Kind |
tok | ) |
|
|
inlinestatic |
Definition at line 236 of file token.h.
236 {
237 return kEQ <= tok && tok <= kNE_STRICT;
238 }
◆ IsIdentifier()
static bool dart::Token::IsIdentifier |
( |
Kind |
tok | ) |
|
|
inlinestatic |
Definition at line 260 of file token.h.
260 {
262 }
static bool IsPseudoKeyword(Kind tok)
◆ IsIndexOperator()
static bool dart::Token::IsIndexOperator |
( |
Kind |
tok | ) |
|
|
inlinestatic |
Definition at line 250 of file token.h.
250 {
251 return tok == kINDEX || tok == kASSIGN_INDEX;
252 }
◆ IsKeyword()
static bool dart::Token::IsKeyword |
( |
Kind |
tok | ) |
|
|
inlinestatic |
Definition at line 258 of file token.h.
static Attribute Attributes(Kind tok)
◆ IsPseudoKeyword()
static bool dart::Token::IsPseudoKeyword |
( |
Kind |
tok | ) |
|
|
inlinestatic |
◆ IsRelationalOperator()
static bool dart::Token::IsRelationalOperator |
( |
Kind |
tok | ) |
|
|
inlinestatic |
Definition at line 232 of file token.h.
232 {
233 return kLT <= tok && tok <= kGTE;
234 }
◆ IsStrictEqualityOperator()
static bool dart::Token::IsStrictEqualityOperator |
( |
Kind |
tok | ) |
|
|
inlinestatic |
Definition at line 240 of file token.h.
240 {
241 return (tok == kEQ_STRICT) || (tok == kNE_STRICT);
242 }
◆ IsTypeCastOperator()
static bool dart::Token::IsTypeCastOperator |
( |
Kind |
tok | ) |
|
|
inlinestatic |
Definition at line 248 of file token.h.
248{ return tok == kAS; }
◆ IsTypeTestOperator()
static bool dart::Token::IsTypeTestOperator |
( |
Kind |
tok | ) |
|
|
inlinestatic |
Definition at line 244 of file token.h.
244 {
245 return (tok == kIS) || (tok == kISNOT);
246 }
◆ IsUnaryArithmeticOperator()
bool dart::Token::IsUnaryArithmeticOperator |
( |
Token::Kind |
token | ) |
|
|
static |
Definition at line 67 of file token.cc.
67 {
68 switch (token) {
69 case Token::kBIT_NOT:
70 case Token::kNEGATE:
71 case Token::kABS:
72 case Token::kSQRT:
73 case Token::kSQUARE:
74 case Token::kRECIPROCAL:
75 case Token::kRECIPROCAL_SQRT:
76 case Token::kTRUNCATE:
77 case Token::kFLOOR:
78 case Token::kCEILING:
79 return true;
80 default:
81 return false;
82 }
83}
◆ IsUnaryOperator()
Definition at line 41 of file token.cc.
41 {
43}
static bool IsUnaryArithmeticOperator(Token::Kind token)
◆ Name()
static const char * dart::Token::Name |
( |
Kind |
tok | ) |
|
|
inlinestatic |
Definition at line 264 of file token.h.
264 {
266 return name_[tok];
267 }
◆ NeedsLiteralToken()
static bool dart::Token::NeedsLiteralToken |
( |
Kind |
tok | ) |
|
|
inlinestatic |
Definition at line 305 of file token.h.
305 {
307 return ((tok == Token::kINTEGER) || (tok == Token::kSTRING) ||
308 (tok == Token::kINTERPOL_VAR) || (tok == Token::kERROR) ||
309 (tok == Token::kDOUBLE));
310 }
◆ NegateComparison()
Definition at line 322 of file token.h.
322 {
323 switch (op) {
324 case Token::kEQ:
325 return Token::kNE;
326 case Token::kNE:
327 return Token::kEQ;
328 case Token::kLT:
329 return Token::kGTE;
330 case Token::kGT:
331 return Token::kLTE;
332 case Token::kLTE:
333 return Token::kGT;
334 case Token::kGTE:
335 return Token::kLT;
336 case Token::kEQ_STRICT:
337 return Token::kNE_STRICT;
338 case Token::kNE_STRICT:
339 return Token::kEQ_STRICT;
340 case Token::kIS:
341 return Token::kISNOT;
342 case Token::kISNOT:
343 return Token::kIS;
344 default:
346 return Token::kILLEGAL;
347 }
348 }
◆ Precedence()
static int dart::Token::Precedence |
( |
Kind |
tok | ) |
|
|
inlinestatic |
Definition at line 287 of file token.h.
287 {
289 return precedence_[tok];
290 }
◆ Str()
static const char * dart::Token::Str |
( |
Kind |
tok | ) |
|
|
inlinestatic |
Definition at line 269 of file token.h.
269 {
271 return tok_str_[tok];
272 }
◆ kFirstKeyword
const Kind dart::Token::kFirstKeyword = kABSTRACT |
|
static |
◆ kLastKeyword
const Kind dart::Token::kLastKeyword = kWITH |
|
static |
◆ kNumKeywords
The documentation for this class was generated from the following files:
- third_party/dart-lang/sdk/runtime/vm/token.h
- third_party/dart-lang/sdk/runtime/vm/token.cc