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

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

Issue 80503002: Experimental lexer generator: Fix byte order mark detection. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month 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/code_generator.jinja ('k') | no next file » | 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 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 28 matching lines...) Expand all
39 __class_bounds = { 39 __class_bounds = {
40 'latin_1' : (1, 255), 40 'latin_1' : (1, 255),
41 # These are not real ranges; they just need to be separate from any real 41 # These are not real ranges; they just need to be separate from any real
42 # ranges. 42 # ranges.
43 'non_latin_1_whitespace' : (256, 256), 43 'non_latin_1_whitespace' : (256, 256),
44 'non_latin_1_letter' : (257, 257), 44 'non_latin_1_letter' : (257, 257),
45 'non_latin1_identifier_part_not_letter' : (258, 258), 45 'non_latin1_identifier_part_not_letter' : (258, 258),
46 'non_latin1_line_terminator' : (259, 259), 46 'non_latin1_line_terminator' : (259, 259),
47 'eos' : (260, 260), 47 'eos' : (260, 260),
48 'zero' : (261, 261), 48 'zero' : (261, 261),
49 'byte_order_mark' : (262, 262),
49 } 50 }
50 __lower_bound = min(__class_bounds.values(), key=lambda item: item[0])[0] 51 __lower_bound = min(__class_bounds.values(), key=lambda item: item[0])[0]
51 __upper_bound = max(__class_bounds.values(), key=lambda item: item[1])[1] 52 __upper_bound = max(__class_bounds.values(), key=lambda item: item[1])[1]
52 53
53 __cached_keys = {} 54 __cached_keys = {}
54 55
55 __unique_key_counter = -1 56 __unique_key_counter = -1
56 57
57 __predefined_ranges = { 58 __predefined_ranges = {
58 'whitespace' : [ 59 'whitespace' : [
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 elif last[1] + 1 < r[0]: 415 elif last[1] + 1 < r[0]:
415 inverted.append((last[1] + 1, r[0] - 1)) 416 inverted.append((last[1] + 1, r[0] - 1))
416 last = r 417 last = r
417 upper_bound = latin_1[1] 418 upper_bound = latin_1[1]
418 if last == None: 419 if last == None:
419 inverted.append(latin_1) 420 inverted.append(latin_1)
420 elif last[1] < upper_bound: 421 elif last[1] < upper_bound:
421 inverted.append((last[1] + 1, upper_bound)) 422 inverted.append((last[1] + 1, upper_bound))
422 inverted += list(classes) 423 inverted += list(classes)
423 return inverted 424 return inverted
OLDNEW
« no previous file with comments | « tools/lexer_generator/code_generator.jinja ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698