OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 inline bool IsCarriageReturn(uc32 c) { | 45 inline bool IsCarriageReturn(uc32 c) { |
46 return c == 0x000D; | 46 return c == 0x000D; |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 inline bool IsLineFeed(uc32 c) { | 50 inline bool IsLineFeed(uc32 c) { |
51 return c == 0x000A; | 51 return c == 0x000A; |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 static inline bool IsInRange(int value, int lower_limit, int higher_limit) { | 55 inline bool IsInRange(int value, int lower_limit, int higher_limit) { |
56 ASSERT(lower_limit <= higher_limit); | 56 ASSERT(lower_limit <= higher_limit); |
57 return static_cast<unsigned int>(value - lower_limit) <= | 57 return static_cast<unsigned int>(value - lower_limit) <= |
58 static_cast<unsigned int>(higher_limit - lower_limit); | 58 static_cast<unsigned int>(higher_limit - lower_limit); |
59 } | 59 } |
60 | 60 |
61 | 61 |
62 inline bool IsDecimalDigit(uc32 c) { | 62 inline bool IsDecimalDigit(uc32 c) { |
63 // ECMA-262, 3rd, 7.8.3 (p 16) | 63 // ECMA-262, 3rd, 7.8.3 (p 16) |
64 return IsInRange(c, '0', '9'); | 64 return IsInRange(c, '0', '9'); |
65 } | 65 } |
(...skipping 19 matching lines...) Expand all Loading... |
85 return false; | 85 return false; |
86 default: | 86 default: |
87 return true; | 87 return true; |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 | 91 |
92 } } // namespace v8::internal | 92 } } // namespace v8::internal |
93 | 93 |
94 #endif // V8_CHAR_PREDICATES_INL_H_ | 94 #endif // V8_CHAR_PREDICATES_INL_H_ |
OLD | NEW |