| OLD | NEW |
| 1 // Copyright 2008 The RE2 Authors. All Rights Reserved. | 1 // Copyright 2008 The RE2 Authors. All Rights Reserved. |
| 2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
| 3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Unicode case folding tables. | 5 // Unicode case folding tables. |
| 6 | 6 |
| 7 // The Unicode case folding tables encode the mapping from one Unicode point | 7 // The Unicode case folding tables encode the mapping from one Unicode point |
| 8 // to the next largest Unicode point with equivalent folding. The largest | 8 // to the next largest Unicode point with equivalent folding. The largest |
| 9 // point wraps back to the first. For example, the tables map: | 9 // point wraps back to the first. For example, the tables map: |
| 10 // | 10 // |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 namespace re2 { | 44 namespace re2 { |
| 45 | 45 |
| 46 enum { | 46 enum { |
| 47 EvenOdd = 1, | 47 EvenOdd = 1, |
| 48 OddEven = -1, | 48 OddEven = -1, |
| 49 EvenOddSkip = 1<<30, | 49 EvenOddSkip = 1<<30, |
| 50 OddEvenSkip, | 50 OddEvenSkip, |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 struct CaseFold { | 53 struct CaseFold { |
| 54 uint32 lo; | 54 Rune lo; |
| 55 uint32 hi; | 55 Rune hi; |
| 56 int32 delta; | 56 int32 delta; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 extern CaseFold unicode_casefold[]; | 59 extern const CaseFold unicode_casefold[]; |
| 60 extern int num_unicode_casefold; | 60 extern const int num_unicode_casefold; |
| 61 | 61 |
| 62 extern CaseFold unicode_tolower[]; | 62 extern const CaseFold unicode_tolower[]; |
| 63 extern int num_unicode_tolower; | 63 extern const int num_unicode_tolower; |
| 64 | 64 |
| 65 // Returns the CaseFold* in the tables that contains rune. | 65 // Returns the CaseFold* in the tables that contains rune. |
| 66 // If rune is not in the tables, returns the first CaseFold* after rune. | 66 // If rune is not in the tables, returns the first CaseFold* after rune. |
| 67 // If rune is larger than any value in the tables, returns NULL. | 67 // If rune is larger than any value in the tables, returns NULL. |
| 68 extern CaseFold* LookupCaseFold(CaseFold*, int, Rune rune); | 68 extern const CaseFold* LookupCaseFold(const CaseFold*, int, Rune rune); |
| 69 | 69 |
| 70 // Returns the result of applying the fold f to the rune r. | 70 // Returns the result of applying the fold f to the rune r. |
| 71 extern Rune ApplyFold(CaseFold *f, Rune r); | 71 extern Rune ApplyFold(const CaseFold *f, Rune r); |
| 72 | 72 |
| 73 } // namespace re2 | 73 } // namespace re2 |
| 74 | 74 |
| 75 #endif // RE2_UNICODE_CASEFOLD_H__ | 75 #endif // RE2_UNICODE_CASEFOLD_H__ |
| OLD | NEW |