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

Side by Side Diff: src/token.h

Issue 3041050: Merge r5182 (Revert support for ES5's propertyname production) to trunk... (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
227 static bool IsAssignmentOp(Value tok) { 223 static bool IsAssignmentOp(Value tok) {
228 return INIT_VAR <= tok && tok <= ASSIGN_MOD; 224 return INIT_VAR <= tok && tok <= ASSIGN_MOD;
229 } 225 }
230 226
231 static bool IsBinaryOp(Value op) { 227 static bool IsBinaryOp(Value op) {
232 return COMMA <= op && op <= MOD; 228 return COMMA <= op && op <= MOD;
233 } 229 }
234 230
235 static bool IsCompareOp(Value op) { 231 static bool IsCompareOp(Value op) {
236 return EQ <= op && op <= IN; 232 return EQ <= op && op <= IN;
(...skipping 23 matching lines...) Expand all
260 // operators; returns 0 otherwise. 256 // operators; returns 0 otherwise.
261 static int Precedence(Value tok) { 257 static int Precedence(Value tok) {
262 ASSERT(0 <= tok && tok < NUM_TOKENS); 258 ASSERT(0 <= tok && tok < NUM_TOKENS);
263 return precedence_[tok]; 259 return precedence_[tok];
264 } 260 }
265 261
266 private: 262 private:
267 static const char* name_[NUM_TOKENS]; 263 static const char* name_[NUM_TOKENS];
268 static const char* string_[NUM_TOKENS]; 264 static const char* string_[NUM_TOKENS];
269 static int8_t precedence_[NUM_TOKENS]; 265 static int8_t precedence_[NUM_TOKENS];
270 static const char token_type[NUM_TOKENS];
271 }; 266 };
272 267
273 } } // namespace v8::internal 268 } } // namespace v8::internal
274 269
275 #endif // V8_TOKEN_H_ 270 #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