Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: src/token.h

Issue 3061056: Merge r5192 (Re-apply support for ES5's propertyname production)... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.cc ('k') | src/token.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 #undef T 213 #undef T
214 214
215 // Returns a string corresponding to the C++ token name 215 // Returns a string corresponding to the C++ token name
216 // (e.g. "LT" for the token LT). 216 // (e.g. "LT" for the token LT).
217 static const char* Name(Value tok) { 217 static const char* Name(Value tok) {
218 ASSERT(0 <= tok && tok < NUM_TOKENS); 218 ASSERT(0 <= tok && tok < NUM_TOKENS);
219 return name_[tok]; 219 return name_[tok];
220 } 220 }
221 221
222 // Predicates 222 // Predicates
223 static bool IsKeyword(Value tok) {
224 return token_type[tok] == 'K';
225 }
226
223 static bool IsAssignmentOp(Value tok) { 227 static bool IsAssignmentOp(Value tok) {
224 return INIT_VAR <= tok && tok <= ASSIGN_MOD; 228 return INIT_VAR <= tok && tok <= ASSIGN_MOD;
225 } 229 }
226 230
227 static bool IsBinaryOp(Value op) { 231 static bool IsBinaryOp(Value op) {
228 return COMMA <= op && op <= MOD; 232 return COMMA <= op && op <= MOD;
229 } 233 }
230 234
231 static bool IsCompareOp(Value op) { 235 static bool IsCompareOp(Value op) {
232 return EQ <= op && op <= IN; 236 return EQ <= op && op <= IN;
(...skipping 23 matching lines...) Expand all
256 // operators; returns 0 otherwise. 260 // operators; returns 0 otherwise.
257 static int Precedence(Value tok) { 261 static int Precedence(Value tok) {
258 ASSERT(0 <= tok && tok < NUM_TOKENS); 262 ASSERT(0 <= tok && tok < NUM_TOKENS);
259 return precedence_[tok]; 263 return precedence_[tok];
260 } 264 }
261 265
262 private: 266 private:
263 static const char* name_[NUM_TOKENS]; 267 static const char* name_[NUM_TOKENS];
264 static const char* string_[NUM_TOKENS]; 268 static const char* string_[NUM_TOKENS];
265 static int8_t precedence_[NUM_TOKENS]; 269 static int8_t precedence_[NUM_TOKENS];
270 static const char token_type[NUM_TOKENS];
266 }; 271 };
267 272
268 } } // namespace v8::internal 273 } } // namespace v8::internal
269 274
270 #endif // V8_TOKEN_H_ 275 #endif // V8_TOKEN_H_
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/token.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698