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

Side by Side Diff: tools/lexer_generator/code_generator.jinja

Issue 98843002: Experimental parser: set start_ properly after illegal token. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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 | « test/lexer/utf-2.js ('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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 {%- if start_node_number == node_number -%} 166 {%- if start_node_number == node_number -%}
167 code_start: 167 code_start:
168 {%- else -%} 168 {%- else -%}
169 code_{{node_number}}: 169 code_{{node_number}}:
170 {%- endif -%} 170 {%- endif -%}
171 {%- else -%} 171 {%- else -%}
172 // inlined state {{node_number}} 172 // inlined state {{node_number}}
173 {%- endif %} 173 {%- endif %}
174 174
175 {% if debug_print %} 175 {% if debug_print %}
176 fprintf(stderr, "state {{state.node_number}}\n"); 176 fprintf(stderr, "state {{state.node_number}}, start %d, cursor %d\n", start_ - buffer_, cursor_ - buffer_);
177 {% endif -%} 177 {% endif -%}
178 178
179 {%- set entry_action = state.entry_action -%} 179 {%- set entry_action = state.entry_action -%}
180 {%- if entry_action %} 180 {%- if entry_action %}
181 {{ dispatch_action(entry_action[0], entry_action[1]) }} 181 {{ dispatch_action(entry_action[0], entry_action[1]) }}
182 {%- endif %} 182 {%- endif %}
183 183
184 {%- if state['has_goto_after_entry'] -%} 184 {%- if state['has_goto_after_entry'] -%}
185 code_after_entry_{{node_number}}: 185 code_after_entry_{{node_number}}:
186 {%- endif %} 186 {%- endif %}
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 #define DO_TOKEN(T) { \ 255 #define DO_TOKEN(T) { \
256 PREPARE_TOKEN(); \ 256 PREPARE_TOKEN(); \
257 next_.token = T; \ 257 next_.token = T; \
258 return; \ 258 return; \
259 } 259 }
260 260
261 #define DO_TOKEN_AND_GO_FORWARD(T) { \ 261 #define DO_TOKEN_AND_GO_FORWARD(T) { \
262 PREPARE_TOKEN(); \ 262 PREPARE_TOKEN(); \
263 FORWARD(); \ 263 FORWARD(); \
264 next_.token = T; \ 264 next_.token = T; \
265 start_ = cursor_; \
265 return; \ 266 return; \
266 } 267 }
267 268
268 #define DO_EOS() { \ 269 #define DO_EOS() { \
269 cursor_ -= 1; \ 270 cursor_ -= 1; \
270 DO_TOKEN(Token::EOS); \ 271 DO_TOKEN(Token::EOS); \
271 } 272 }
272 273
273 #define DO_LINE_TERMINATOR(s) { \ 274 #define DO_LINE_TERMINATOR(s) { \
274 start_ = cursor_; \ 275 start_ = cursor_; \
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 FORWARD(); 321 FORWARD();
321 goto code_start; 322 goto code_start;
322 323
323 fell_through: 324 fell_through:
324 ((void(*)())0)(); // crash 325 ((void(*)())0)(); // crash
325 // force use of stored_token 326 // force use of stored_token
326 stored_token = Token::ILLEGAL; 327 stored_token = Token::ILLEGAL;
327 } 328 }
328 } } 329 } }
329 330
OLDNEW
« no previous file with comments | « test/lexer/utf-2.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698