Index: src/parsing/token.h |
diff --git a/src/parsing/token.h b/src/parsing/token.h |
index fee1f7e85aa3a02ef9b3aa56d666ce203a4166f9..a7395f05da9e8c523698f7fb2d95fc89eae02ce7 100644 |
--- a/src/parsing/token.h |
+++ b/src/parsing/token.h |
@@ -174,12 +174,9 @@ namespace internal { |
class Token { |
public: |
- // All token values. |
+// All token values. |
#define T(name, string, precedence) name, |
- enum Value { |
- TOKEN_LIST(T, T) |
- NUM_TOKENS |
- }; |
+ enum Value { TOKEN_LIST(T, T) NUM_TOKENS }; |
#undef T |
// Returns a string corresponding to the C++ token name |
@@ -190,9 +187,7 @@ class Token { |
} |
// Predicates |
- static bool IsKeyword(Value tok) { |
- return token_type[tok] == 'K'; |
- } |
+ static bool IsKeyword(Value tok) { return token_type[tok] == 'K'; } |
static bool IsIdentifier(Value tok, LanguageMode language_mode, |
bool is_generator) { |
@@ -217,46 +212,46 @@ class Token { |
return INIT <= tok && tok <= ASSIGN_MOD; |
} |
- static bool IsBinaryOp(Value op) { |
- return COMMA <= op && op <= MOD; |
- } |
+ static bool IsBinaryOp(Value op) { return COMMA <= op && op <= MOD; } |
static bool IsTruncatingBinaryOp(Value op) { |
return BIT_OR <= op && op <= ROR; |
} |
- static bool IsCompareOp(Value op) { |
- return EQ <= op && op <= IN; |
- } |
+ static bool IsCompareOp(Value op) { return EQ <= op && op <= IN; } |
static bool IsOrderedRelationalCompareOp(Value op) { |
return op == LT || op == LTE || op == GT || op == GTE; |
} |
- static bool IsEqualityOp(Value op) { |
- return op == EQ || op == EQ_STRICT; |
- } |
+ static bool IsEqualityOp(Value op) { return op == EQ || op == EQ_STRICT; } |
- static bool IsInequalityOp(Value op) { |
- return op == NE || op == NE_STRICT; |
- } |
+ static bool IsInequalityOp(Value op) { return op == NE || op == NE_STRICT; } |
static bool IsArithmeticCompareOp(Value op) { |
- return IsOrderedRelationalCompareOp(op) || |
- IsEqualityOp(op) || IsInequalityOp(op); |
+ return IsOrderedRelationalCompareOp(op) || IsEqualityOp(op) || |
+ IsInequalityOp(op); |
} |
static Value NegateCompareOp(Value op) { |
DCHECK(IsArithmeticCompareOp(op)); |
switch (op) { |
- case EQ: return NE; |
- case NE: return EQ; |
- case EQ_STRICT: return NE_STRICT; |
- case NE_STRICT: return EQ_STRICT; |
- case LT: return GTE; |
- case GT: return LTE; |
- case LTE: return GT; |
- case GTE: return LT; |
+ case EQ: |
+ return NE; |
+ case NE: |
+ return EQ; |
+ case EQ_STRICT: |
+ return NE_STRICT; |
+ case NE_STRICT: |
+ return EQ_STRICT; |
+ case LT: |
+ return GTE; |
+ case GT: |
+ return LTE; |
+ case LTE: |
+ return GT; |
+ case GTE: |
+ return LT; |
default: |
UNREACHABLE(); |
return op; |
@@ -266,14 +261,22 @@ class Token { |
static Value ReverseCompareOp(Value op) { |
DCHECK(IsArithmeticCompareOp(op)); |
switch (op) { |
- case EQ: return EQ; |
- case NE: return NE; |
- case EQ_STRICT: return EQ_STRICT; |
- case NE_STRICT: return NE_STRICT; |
- case LT: return GT; |
- case GT: return LT; |
- case LTE: return GTE; |
- case GTE: return LTE; |
+ case EQ: |
+ return EQ; |
+ case NE: |
+ return NE; |
+ case EQ_STRICT: |
+ return EQ_STRICT; |
+ case NE_STRICT: |
+ return NE_STRICT; |
+ case LT: |
+ return GT; |
+ case GT: |
+ return LT; |
+ case LTE: |
+ return GTE; |
+ case GTE: |
+ return LTE; |
default: |
UNREACHABLE(); |
return op; |
@@ -288,13 +291,9 @@ class Token { |
return (NOT <= op && op <= VOID) || op == ADD || op == SUB; |
} |
- static bool IsCountOp(Value op) { |
- return op == INC || op == DEC; |
- } |
+ static bool IsCountOp(Value op) { return op == INC || op == DEC; } |
- static bool IsShiftOp(Value op) { |
- return (SHL <= op) && (op <= SHR); |
- } |
+ static bool IsShiftOp(Value op) { return (SHL <= op) && (op <= SHR); } |
// Returns a string corresponding to the JS token string |
// (.e., "<" for the token LT) or NULL if the token doesn't |