| OLD | NEW |
| 1 # Copyright 2013 the V8 project authors. All rights reserved. | 1 # Copyright 2014 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 27 matching lines...) Expand all Loading... |
| 39 ord('\n') : '\\n', | 39 ord('\n') : '\\n', |
| 40 ord('\r') : '\\r', | 40 ord('\r') : '\\r', |
| 41 } | 41 } |
| 42 | 42 |
| 43 @staticmethod | 43 @staticmethod |
| 44 def to_str(encoding, x): | 44 def to_str(encoding, x): |
| 45 assert not encoding or encoding.in_primary_range(x, x) | 45 assert not encoding or encoding.in_primary_range(x, x) |
| 46 if x > 127: | 46 if x > 127: |
| 47 return str(x) | 47 return str(x) |
| 48 if not x in KeyEncoding.__printable_cache: | 48 if not x in KeyEncoding.__printable_cache: |
| 49 res = "'%s'" % chr(x) if chr(x) in printable else str(x) | 49 res = "%s" % chr(x) if chr(x) in printable else str(x) |
| 50 KeyEncoding.__printable_cache[x] = res | 50 KeyEncoding.__printable_cache[x] = res |
| 51 return KeyEncoding.__printable_cache[x] | 51 return KeyEncoding.__printable_cache[x] |
| 52 | 52 |
| 53 @staticmethod | 53 @staticmethod |
| 54 def get(name): | 54 def get(name): |
| 55 if not KeyEncoding.__encodings: | 55 if not KeyEncoding.__encodings: |
| 56 Latin1Encoding() | 56 Latin1Encoding() |
| 57 Utf16Encoding() | 57 Utf16Encoding() |
| 58 Utf8Encoding() | 58 Utf8Encoding() |
| 59 return KeyEncoding.__encodings[name] | 59 return KeyEncoding.__encodings[name] |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 { | 185 { |
| 186 'whitespace': | 186 'whitespace': |
| 187 [(9, 9), (11, 12), (32, 32), ('non_primary_whitespace',)], | 187 [(9, 9), (11, 12), (32, 32), ('non_primary_whitespace',)], |
| 188 'letter': | 188 'letter': |
| 189 [(65, 90), (97, 122), ('non_primary_letter',)], | 189 [(65, 90), (97, 122), ('non_primary_letter',)], |
| 190 'line_terminator': | 190 'line_terminator': |
| 191 [(10, 10), (13, 13), ('non_primary_line_terminator',)], | 191 [(10, 10), (13, 13), ('non_primary_line_terminator',)], |
| 192 'identifier_part_not_letter': | 192 'identifier_part_not_letter': |
| 193 [(48, 57), (95, 95), ('non_primary_identifier_part_not_letter',)], | 193 [(48, 57), (95, 95), ('non_primary_identifier_part_not_letter',)], |
| 194 }) | 194 }) |
| OLD | NEW |