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

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

Issue 144603003: Experimental parser: better eos handling (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 11 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/rule_parser.py ('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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 elif last[1] < upper_bound: 468 elif last[1] < upper_bound:
469 inverted.append((last[1] + 1, upper_bound)) 469 inverted.append((last[1] + 1, upper_bound))
470 inverted += list(classes) 470 inverted += list(classes)
471 return inverted 471 return inverted
472 472
473 class Latin1Encoding(KeyEncoding): 473 class Latin1Encoding(KeyEncoding):
474 474
475 def __init__(self): 475 def __init__(self):
476 super(Latin1Encoding, self).__init__( 476 super(Latin1Encoding, self).__init__(
477 'latin1', 477 'latin1',
478 (1, 255), 478 (0, 255),
479 ['eos', 'zero']) 479 [])
480 self.add_predefined_range( 480 self.add_predefined_range(
481 'whitespace', [(9, 9), (11, 12), (32, 32), (133, 133), (160, 160)]) 481 'whitespace', [(9, 9), (11, 12), (32, 32), (133, 133), (160, 160)])
482 self.add_predefined_range( 482 self.add_predefined_range(
483 'letter', [ 483 'letter', [
484 (65, 90), (97, 122), (170, 170), (181, 181), 484 (65, 90), (97, 122), (170, 170), (181, 181),
485 (186, 186), (192, 214), (216, 246), (248, 255)]) 485 (186, 186), (192, 214), (216, 246), (248, 255)])
486 self.add_predefined_range('line_terminator', [(10, 10), (13, 13)]) 486 self.add_predefined_range('line_terminator', [(10, 10), (13, 13)])
487 self.add_predefined_range( 487 self.add_predefined_range(
488 'identifier_part_not_letter', [(48, 57), (95, 95)]) 488 'identifier_part_not_letter', [(48, 57), (95, 95)])
489 489
490 class Utf16Encoding(KeyEncoding): 490 class Utf16Encoding(KeyEncoding):
491 491
492 def __init__(self): 492 def __init__(self):
493 super(Utf16Encoding, self).__init__( 493 super(Utf16Encoding, self).__init__(
494 'utf16', 494 'utf16',
495 (1, 255), 495 (0, 255),
496 ['eos', 'zero', 'byte_order_mark', 496 ['byte_order_mark',
497 'non_primary_whitespace', 497 'non_primary_whitespace',
498 'non_primary_letter', 498 'non_primary_letter',
499 'non_primary_identifier_part_not_letter', 499 'non_primary_identifier_part_not_letter',
500 'non_primary_line_terminator', 500 'non_primary_line_terminator',
501 'non_primary_everything_else']) 501 'non_primary_everything_else'])
502 self.add_predefined_range( 502 self.add_predefined_range(
503 'whitespace', 503 'whitespace',
504 [(9, 9), (11, 12), (32, 32), (133, 133), (160, 160), 504 [(9, 9), (11, 12), (32, 32), (133, 133), (160, 160),
505 self.class_range('byte_order_mark'), 505 self.class_range('byte_order_mark'),
506 self.class_range('non_primary_whitespace')]) 506 self.class_range('non_primary_whitespace')])
507 self.add_predefined_range( 507 self.add_predefined_range(
508 'letter', [ 508 'letter', [
509 (65, 90), (97, 122), (170, 170), (181, 181), 509 (65, 90), (97, 122), (170, 170), (181, 181),
510 (186, 186), (192, 214), (216, 246), (248, 255), 510 (186, 186), (192, 214), (216, 246), (248, 255),
511 self.class_range('non_primary_letter')]) 511 self.class_range('non_primary_letter')])
512 self.add_predefined_range( 512 self.add_predefined_range(
513 'line_terminator', 513 'line_terminator',
514 [(10, 10), (13, 13), self.class_range('non_primary_line_terminator')]) 514 [(10, 10), (13, 13), self.class_range('non_primary_line_terminator')])
515 self.add_predefined_range( 515 self.add_predefined_range(
516 'identifier_part_not_letter', 516 'identifier_part_not_letter',
517 [(48, 57), (95, 95), 517 [(48, 57), (95, 95),
518 self.class_range('non_primary_identifier_part_not_letter')]) 518 self.class_range('non_primary_identifier_part_not_letter')])
519 519
520 class Utf8Encoding(KeyEncoding): 520 class Utf8Encoding(KeyEncoding):
521 521
522 def __init__(self): 522 def __init__(self):
523 super(Utf8Encoding, self).__init__( 523 super(Utf8Encoding, self).__init__(
524 'utf8', 524 'utf8',
525 (1, 127), 525 (0, 127),
526 ['eos', 'zero', 'byte_order_mark', 526 ['byte_order_mark',
527 'non_primary_whitespace', 527 'non_primary_whitespace',
528 'non_primary_letter', 528 'non_primary_letter',
529 'non_primary_identifier_part_not_letter', 529 'non_primary_identifier_part_not_letter',
530 'non_primary_line_terminator', 530 'non_primary_line_terminator',
531 'non_primary_everything_else']) 531 'non_primary_everything_else'])
532 self.add_predefined_range( 532 self.add_predefined_range(
533 'whitespace', 533 'whitespace',
534 [(9, 9), (11, 12), (32, 32), 534 [(9, 9), (11, 12), (32, 32),
535 self.class_range('byte_order_mark'), 535 self.class_range('byte_order_mark'),
536 self.class_range('non_primary_whitespace')]) 536 self.class_range('non_primary_whitespace')])
537 self.add_predefined_range( 537 self.add_predefined_range(
538 'letter', [(65, 90), (97, 122), self.class_range('non_primary_letter')]) 538 'letter', [(65, 90), (97, 122), self.class_range('non_primary_letter')])
539 self.add_predefined_range( 539 self.add_predefined_range(
540 'line_terminator', 540 'line_terminator',
541 [(10, 10), (13, 13), self.class_range('non_primary_line_terminator')]) 541 [(10, 10), (13, 13), self.class_range('non_primary_line_terminator')])
542 self.add_predefined_range( 542 self.add_predefined_range(
543 'identifier_part_not_letter', 543 'identifier_part_not_letter',
544 [(48, 57), (95, 95), 544 [(48, 57), (95, 95),
545 self.class_range('non_primary_identifier_part_not_letter')]) 545 self.class_range('non_primary_identifier_part_not_letter')])
OLDNEW
« no previous file with comments | « tools/lexer_generator/rule_parser.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698