OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 Letter_Other | Number_Letter; | 44 Letter_Other | Number_Letter; |
45 const uint32_t unicodeCombiningMark = Mark_NonSpacing | Mark_SpacingCombining; | 45 const uint32_t unicodeCombiningMark = Mark_NonSpacing | Mark_SpacingCombining; |
46 const uint32_t unicodeDigit = Number_DecimalDigit; | 46 const uint32_t unicodeDigit = Number_DecimalDigit; |
47 const uint32_t unicodeConnectorPunctuation = Punctuation_Connector; | 47 const uint32_t unicodeConnectorPunctuation = Punctuation_Connector; |
48 | 48 |
49 static inline bool isIdentifierStartCharacter(UChar c) { | 49 static inline bool isIdentifierStartCharacter(UChar c) { |
50 return (category(c) & unicodeLetter) || (c == '$') || (c == '_'); | 50 return (category(c) & unicodeLetter) || (c == '$') || (c == '_'); |
51 } | 51 } |
52 | 52 |
53 static inline bool isIdentifierCharacter(UChar c) { | 53 static inline bool isIdentifierCharacter(UChar c) { |
54 return (category(c) & (unicodeLetter | unicodeCombiningMark | unicodeDigit | | 54 return (category(c) & |
55 unicodeConnectorPunctuation)) || | 55 (unicodeLetter | unicodeCombiningMark | unicodeDigit | |
| 56 unicodeConnectorPunctuation)) || |
56 (c == '$') || (c == '_') || (c == zeroWidthNonJoinerCharacter) || | 57 (c == '$') || (c == '_') || (c == zeroWidthNonJoinerCharacter) || |
57 (c == zeroWidthJoinerCharacter); | 58 (c == zeroWidthJoinerCharacter); |
58 } | 59 } |
59 | 60 |
60 bool isIdentifier(const String& s) { | 61 bool isIdentifier(const String& s) { |
61 size_t length = s.length(); | 62 size_t length = s.length(); |
62 if (!length) | 63 if (!length) |
63 return false; | 64 return false; |
64 if (!isIdentifierStartCharacter(s[0])) | 65 if (!isIdentifierStartCharacter(s[0])) |
65 return false; | 66 return false; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 case StringType: | 195 case StringType: |
195 return m_string == other.m_string; | 196 return m_string == other.m_string; |
196 case ArrayType: | 197 case ArrayType: |
197 return m_array == other.m_array; | 198 return m_array == other.m_array; |
198 } | 199 } |
199 ASSERT_NOT_REACHED(); | 200 ASSERT_NOT_REACHED(); |
200 return false; | 201 return false; |
201 } | 202 } |
202 | 203 |
203 } // namespace blink | 204 } // namespace blink |
OLD | NEW |