OLD | NEW |
1 // Copyright 2011 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 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 return IsInRange(c, '0', '9'); | 64 return IsInRange(c, '0', '9'); |
65 } | 65 } |
66 | 66 |
67 | 67 |
68 inline bool IsHexDigit(uc32 c) { | 68 inline bool IsHexDigit(uc32 c) { |
69 // ECMA-262, 3rd, 7.6 (p 15) | 69 // ECMA-262, 3rd, 7.6 (p 15) |
70 return IsDecimalDigit(c) || IsInRange(AsciiAlphaToLower(c), 'a', 'f'); | 70 return IsDecimalDigit(c) || IsInRange(AsciiAlphaToLower(c), 'a', 'f'); |
71 } | 71 } |
72 | 72 |
73 | 73 |
| 74 inline bool IsOctalDigit(uc32 c) { |
| 75 // ECMA-262, 6th, 7.8.3 |
| 76 return IsInRange(c, '0', '7'); |
| 77 } |
| 78 |
| 79 |
| 80 inline bool IsBinaryDigit(uc32 c) { |
| 81 // ECMA-262, 6th, 7.8.3 |
| 82 return c == '0' || c == '1'; |
| 83 } |
| 84 |
| 85 |
74 inline bool IsRegExpWord(uc16 c) { | 86 inline bool IsRegExpWord(uc16 c) { |
75 return IsInRange(AsciiAlphaToLower(c), 'a', 'z') | 87 return IsInRange(AsciiAlphaToLower(c), 'a', 'z') |
76 || IsDecimalDigit(c) | 88 || IsDecimalDigit(c) |
77 || (c == '_'); | 89 || (c == '_'); |
78 } | 90 } |
79 | 91 |
80 | 92 |
81 inline bool IsRegExpNewline(uc16 c) { | 93 inline bool IsRegExpNewline(uc16 c) { |
82 switch (c) { | 94 switch (c) { |
83 // CR LF LS PS | 95 // CR LF LS PS |
84 case 0x000A: case 0x000D: case 0x2028: case 0x2029: | 96 case 0x000A: case 0x000D: case 0x2028: case 0x2029: |
85 return false; | 97 return false; |
86 default: | 98 default: |
87 return true; | 99 return true; |
88 } | 100 } |
89 } | 101 } |
90 | 102 |
91 | 103 |
92 } } // namespace v8::internal | 104 } } // namespace v8::internal |
93 | 105 |
94 #endif // V8_CHAR_PREDICATES_INL_H_ | 106 #endif // V8_CHAR_PREDICATES_INL_H_ |
OLD | NEW |