| OLD | NEW |
| 1 # Copyright 2013 the V8 project authors. All rights reserved. | 1 # Copyright 2013 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 24 matching lines...) Expand all Loading... |
| 35 "literal" : (257, 257), | 35 "literal" : (257, 257), |
| 36 } | 36 } |
| 37 __lower_bound = 0 | 37 __lower_bound = 0 |
| 38 __upper_bound = reduce(lambda acc, (k, v): max(acc, v[1]), __class_bounds.item
s(), 0) | 38 __upper_bound = reduce(lambda acc, (k, v): max(acc, v[1]), __class_bounds.item
s(), 0) |
| 39 | 39 |
| 40 __cached_keys = {} | 40 __cached_keys = {} |
| 41 | 41 |
| 42 __unique_key_counter = -1 | 42 __unique_key_counter = -1 |
| 43 | 43 |
| 44 @staticmethod | 44 @staticmethod |
| 45 def alphabet_iter(): | |
| 46 for k, (lower, upper) in TransitionKey.__class_bounds.items(): | |
| 47 for i in range(lower, upper + 1): | |
| 48 yield i | |
| 49 | |
| 50 @staticmethod | |
| 51 def __in_latin_1(char): | 45 def __in_latin_1(char): |
| 52 bound = TransitionKey.__class_bounds["latin_1"] | 46 bound = TransitionKey.__class_bounds["latin_1"] |
| 53 return (bound[0] <= char and char <= bound[1]) | 47 return (bound[0] <= char and char <= bound[1]) |
| 54 | 48 |
| 55 @staticmethod | 49 @staticmethod |
| 56 def __is_class_range(r): | 50 def __is_class_range(r): |
| 57 return r[0] == r[1] and not TransitionKey.__in_latin_1(r[0]) | 51 return r[0] == r[1] and not TransitionKey.__in_latin_1(r[0]) |
| 58 | 52 |
| 59 @staticmethod | 53 @staticmethod |
| 60 def __is_unique_range(r): | 54 def __is_unique_range(r): |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 elif last[1] + 1 < r[0]: | 330 elif last[1] + 1 < r[0]: |
| 337 inverted.append((last[1] + 1, r[0] - 1)) | 331 inverted.append((last[1] + 1, r[0] - 1)) |
| 338 last = r | 332 last = r |
| 339 upper_bound = latin_1[1] | 333 upper_bound = latin_1[1] |
| 340 if last == None: | 334 if last == None: |
| 341 inverted.append(latin_1) | 335 inverted.append(latin_1) |
| 342 elif last[1] < upper_bound: | 336 elif last[1] < upper_bound: |
| 343 inverted.append((last[1] + 1, upper_bound)) | 337 inverted.append((last[1] + 1, upper_bound)) |
| 344 inverted += list(classes) | 338 inverted += list(classes) |
| 345 return inverted | 339 return inverted |
| OLD | NEW |