| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 class_keys += 1 | 92 class_keys += 1 |
| 93 elif t == 'PRIMARY_RANGE': | 93 elif t == 'PRIMARY_RANGE': |
| 94 distinct_keys += r[1] - r[0] + 1 | 94 distinct_keys += r[1] - r[0] + 1 |
| 95 ranges += 1 | 95 ranges += 1 |
| 96 else: | 96 else: |
| 97 raise Exception() | 97 raise Exception() |
| 98 return { | 98 return { |
| 99 'node_number' : None, | 99 'node_number' : None, |
| 100 'original_node_number' : state.node_number(), | 100 'original_node_number' : state.node_number(), |
| 101 'transitions' : transitions, | 101 'transitions' : transitions, |
| 102 'can_elide_read' : len(transitions) == 0, |
| 102 'switch_transitions' : [], | 103 'switch_transitions' : [], |
| 103 'deferred_transitions' : [], | 104 'deferred_transitions' : [], |
| 104 'long_char_transitions' : [], | 105 'long_char_transitions' : [], |
| 105 'disjoint_keys' : disjoint_keys, | 106 'disjoint_keys' : disjoint_keys, |
| 106 'inline' : None, | 107 'inline' : None, |
| 107 'action' : action, | 108 'action' : action, |
| 108 'entry_action' : entry_action, | 109 'entry_action' : entry_action, |
| 109 'match_action' : match_action, | 110 'match_action' : match_action, |
| 110 'class_keys' : class_keys, | 111 'class_keys' : class_keys, |
| 111 'distinct_keys' : distinct_keys, | 112 'distinct_keys' : distinct_keys, |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 'goto_start']) | 280 'goto_start']) |
| 280 for state in states: | 281 for state in states: |
| 281 if not state['match_action']: | 282 if not state['match_action']: |
| 282 continue | 283 continue |
| 283 if state['match_action'][0] in mapped_actions: | 284 if state['match_action'][0] in mapped_actions: |
| 284 value = state['match_action'][1] | 285 value = state['match_action'][1] |
| 285 value = tuple(list(value[:-1]) + [goto_map[value[-1]]]) | 286 value = tuple(list(value[:-1]) + [goto_map[value[-1]]]) |
| 286 state['match_action'] = (state['match_action'][0], value) | 287 state['match_action'] = (state['match_action'][0], value) |
| 287 if state['match_action'][0] != 'goto_start': | 288 if state['match_action'][0] != 'goto_start': |
| 288 states[value[-1]]['entry_points']['after_entry_code'] = True | 289 states[value[-1]]['entry_points']['after_entry_code'] = True |
| 290 state['can_elide_read'] = False |
| 291 else: |
| 292 states[value[-1]]['can_elide_read'] = False |
| 289 | 293 |
| 290 @staticmethod | 294 @staticmethod |
| 291 def __mark_entry_points(dfa_states): | 295 def __mark_entry_points(dfa_states): |
| 292 # inlined states can write no labels | 296 # inlined states can write no labels |
| 293 for state in dfa_states: | 297 for state in dfa_states: |
| 294 entry_points = state['entry_points'] | 298 entry_points = state['entry_points'] |
| 295 if state['inline']: | 299 if state['inline']: |
| 296 for k in entry_points.keys(): | 300 for k in entry_points.keys(): |
| 297 entry_points[k] = False | 301 entry_points[k] = False |
| 298 | 302 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 char_type = char_types[encoding.name()] | 338 char_type = char_types[encoding.name()] |
| 335 | 339 |
| 336 return template.render( | 340 return template.render( |
| 337 start_node_number = 0, | 341 start_node_number = 0, |
| 338 debug_print = self.__debug_print, | 342 debug_print = self.__debug_print, |
| 339 default_action = default_action, | 343 default_action = default_action, |
| 340 dfa_states = dfa_states, | 344 dfa_states = dfa_states, |
| 341 encoding = encoding.name(), | 345 encoding = encoding.name(), |
| 342 char_type = char_type, | 346 char_type = char_type, |
| 343 upper_bound = encoding.primary_range()[1]) | 347 upper_bound = encoding.primary_range()[1]) |
| OLD | NEW |