| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 namespace v8 { | 114 namespace v8 { |
| 115 namespace internal { | 115 namespace internal { |
| 116 uint32_t EvenMoreExperimentalScanner::DoLex() { | 116 uint32_t EvenMoreExperimentalScanner::DoLex() { |
| 117 YYCTYPE yych = *cursor_; | 117 YYCTYPE yych = *cursor_; |
| 118 goto code_%s; | 118 goto code_%s; |
| 119 ''' % start_node_number | 119 ''' % start_node_number |
| 120 def f(state, code): | 120 def f(state, code): |
| 121 code += CodeGenerator.dfa_state_to_code(state, start_node_number) | 121 code += CodeGenerator.dfa_state_to_code(state, start_node_number) |
| 122 return code | 122 return code |
| 123 code = dfa.visit_all_states(f, code) | 123 code = dfa.visit_all_states(f, code) |
| 124 |
| 125 default_action_code = '' |
| 126 if rule_processor.default_action: |
| 127 if rule_processor.default_action.type() == 'push_token': |
| 128 default_action_code = ''' |
| 129 default_action: |
| 130 //fprintf(stderr, "default action\\n"); |
| 131 PUSH_TOKEN(Token::%s) |
| 132 goto code_%s;''' % (rule_processor.default_action.data(), start_node_number) |
| 133 else: |
| 134 raise Exception("Default action type %s not supported" % action.type()) |
| 135 |
| 124 code += ''' | 136 code += ''' |
| 125 CHECK(false); | 137 CHECK(false); |
| 126 default_action: | 138 %s |
| 127 //fprintf(stderr, "default action\\n"); | |
| 128 %s | |
| 129 goto code_%s; | |
| 130 return 0; | 139 return 0; |
| 131 } | 140 } |
| 132 | 141 |
| 133 } | 142 } |
| 134 } | 143 } |
| 135 ''' % (rule_processor.default_action, start_node_number) | 144 ''' % default_action_code |
| 136 return code | 145 return code |
| OLD | NEW |