Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1476)

Side by Side Diff: tools/lexer_generator/encoding.py

Issue 159853009: Experimental parser: split off dot processing (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/lexer_generator/dot_utilities.py ('k') | tools/lexer_generator/generator.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 })
OLDNEW
« no previous file with comments | « tools/lexer_generator/dot_utilities.py ('k') | tools/lexer_generator/generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698